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

Jose Morell jose.morell.at.sakai at gmail.com
Tue Mar 10 10:28:34 PDT 2009


Hi Matthew,

I have a problem with this.

I'm working in the site-manage-tool.

I need to extend the Site class with another attribute visitedTime.

I have created VisitedSiteImpl that extends from BaseSite and implements
VisitedSited (that extends from Site).

The first problem with this, is that if I add the kernel-impl dependency
with <scope>provided</scope>, then the classes from kernel-impl there isn't
found in execution time, but if I add the dependency with the default scope,
then the kernel-impl-1.0.jar is in components, and in the deployed
site-manage, and I get the ClassCastException of the first mail.

Any idea with this??



On Tue, Mar 10, 2009 at 1:10 PM, Matthew Buckett <
matthew.buckett at oucs.ox.ac.uk> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20090310/2b784e56/attachment.html 


More information about the sakai-dev mailing list