incubator-graffito-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Mora" <moradan...@gmail.com>
Subject Re: Classloader problem
Date Wed, 19 Apr 2006 16:38:44 GMT
Yes, I am using Tomcat. The problem is that I have a custom classloader
called LocalClassLoader and is conflicting with WebAppClassloader, and both
are loading DefaultTipology.class from WEB-INF\classes.
I had the same problem using XStream, but XStream has the posibility to set
the classloader.
        ClassLoader classLoader = DefaultTipology.class.getClassLoader();
        xstream.setClassLoader(classLoader);
The solution I am thinking is to modify some graffito files, for example
ReflectionUtils.java , and change Class.forName(className) into
Class.forName(className, classloader).
Maybe I can contribute with Graffito with this extra feature, what do you
think?


On 4/19/06, Christophe Lombart <christophe.lombart@gmail.com> wrote:
>
> Graffito is a classic java application. So, classloader is working as
> usual.
> Can you give me more information on your deployement. How your jars are
> deployed ? Are you using Jetspeed ?
> Where is deployed DefaultTipology ? Are you using Tomcat ? I'm not sure it
> is necessary to set the classloader.
>
>
> On 4/19/06, Daniel Mora <moradaniel@gmail.com> wrote:
> >
> > Hi all,
> > I am successfully integrating Graffito mapping tools into my J2EE CMS
> > environment. But now Im facing a classloader problem. The following code
> > is
> > throwing a ClassCastException in (DefaultTipology) resultIter.next()
> > because
> > DefaultTipology.class.getClassLoader() != resultIter.next
> > ().getClass().getClassLoader()
> > One is LocalClassLoader and the other is WebAppClassLoader.
> >
> >           Filter filter = this.queryManager.createFilter(
> > DefaultTipology.class);
> >           Query query = this.queryManager.createQuery(filter);
> >           Collection result = this.persistenceManager.getObjects(query);
> >           Iterator resultIter = result.iterator();
> >           while(resultIter.hasNext()){
> >               DefaultTipology defTipo = (DefaultTipology)
> resultIter.next
> > ();
> >               this.tipologyIds.put(defTipo.getIdName(),defTipo);
> >           }
> >
> > Is there a way to set the classloader in graffito, in order to have only
> > one
> > instance of a class?
> >
> >
>
>
> --
> Best regards,
>
> Christophe
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message