[Building Sakai] ClassCastException: Cannot cast org.sakaiproject.site.impl.BaseSite (id=260) to org.sakaiproject.site.impl.BaseSite

Matthew Buckett matthew.buckett at oucs.ox.ac.uk
Tue Mar 10 05:10:39 PDT 2009


On Tue, Mar 10, 2009 at 11:43 AM, Jose Morell
<jose.morell.at.sakai at gmail.com> wrote:
> Hi list,
>
> I'm trying to extend Site with a new attribute visitedTime.
>
> This new class VisitedSite has this constructor:
>
>     public VisitedSiteImpl(BaseSiteService arg0, Site arg1) {
>         super(arg0, arg1);
>         // TODO Auto-generated constructor stub
>     }
>
> The argument arg1 is a BaseSite from the site-manage-tool site list, but
> when calling the superclass constructor:
>
>     public BaseSite(BaseSiteService siteService, Site other)
>     {
>         this.siteService = siteService;
>
>         BaseSite bOther = (BaseSite) other;
>         set(bOther, true);
>     }
>
> (BaseSite) other throws this class cast exception:
>
> ClassCastException: Cannot cast org.sakaiproject.site.impl.BaseSite (id=260)
> to  org.sakaiproject.site.impl.BaseSite
>
> Any idea about this?

This is normally because the two classes come from different
classloaders. This might be because:
- You have BaseSite in both components and somewhere else (it should
only be in components).
- You have redeployed a webapp and you are comparing an object from
the previous webapp classloader with the current one (I don't think
it's this one this time)

-- 
  Matthew Buckett


More information about the sakai-dev mailing list