Re: [Simple-support] More on dropped annotations
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2008-07-11 19:39:30
|
Hi,
Did you try putting the jar in the JBoss core classpath lib directory. This may help, but interference like this is typical of J2EE. I would imagine you'd get better information from the JBoss mailing list. Also, this is not a class loading issue, it _must_ be byte manipulation/generation. Do you annotate an interface or an abstract class? If not you'd get a ClassNotFoundException when you try to serialize.
Niall
--- On Fri, 7/11/08, Quirino Zagarese <qu...@la...> wrote:
> From: Quirino Zagarese <qu...@la...>
> Subject: Re: [Simple-support] More on dropped annotations
> To: gal...@ya...
> Date: Friday, July 11, 2008, 2:08 AM
> Hi,
> thanks for the hint, but it seems I can't find a way to
> load classes
> correctly in J2EE setting.
> The class I was trying to serialize is an entity bean, but
> I found the same
> behavior with a POJO (serialization works perfectly in
> stand-alone setting).
> JBoss works on top of javassist to implement aop, but I
> don't know if
> classloading is also done in that way.
> I already found this problem with a framework I'm
> developing and I solved it
> using javassist annotation scanning.
> Maybe this could be a solution for Simple. An interesting
> and fast solution
> could be implemented using Scannotation (by Bill Burke).
> About my current
> issue....I feel lost.
>
>
> 2008/7/11 Niall Gallagher
> <gal...@ya...>:
>
> > Hi,
> >
> > This seems really strange that JBoss would do this,
> strange that it would
> > treat annotations differently to normal classes. What
> type of object are you
> > annotating? Is it CGLIB generated or something
> similar? Anyway, yes you can
> > tell Simple to do this. Simple always tries the
> > Thread.currentThread().getContextClassLoader(). So
> before write or read do
> > this.
> >
> > ClassLoader previousClassLoader =
> > Thread.currentThread().getContextClassLoader():
> > try {
> >
> Thread.currentThread().setContextClassLoader(myClassLoader);
> > persister.write(myObject, myStream);
> > }finally {
> >
> Thread.currentThread().setContextClassLoader(previousClassLoader);
> > }
> >
> > This will work for you with a custom class loader.
> However, I think there
> > has to be a better solution than this, either JBoss is
> manupulating the
> > class with CGLIB or something similar, or there is
> some other subtle issue
> > as to why JBoss drops annotations. If not then JBoss
> is just plain crap.
> >
> > Hope this helps,
> > Niall
> >
> >
> > --- On Thu, 7/10/08, Quirino Zagarese
> <qu...@la...> wrote:
> >
> > > From: Quirino Zagarese
> <qu...@la...>
> > > Subject: [Simple-support] More on dropped
> annotations
> > > To: sim...@li...
> > > Date: Thursday, July 10, 2008, 9:36 AM
> > > I'm trying to find a solution, but I
> can't get out
> > > of it for now.
> > > I toke a look at Simple serialization mechanism:
> maybe I
> > > lost some steps,
> > > but the key is:
> > >
> > > 1) I use persister.write(annotatedObject,
> > > anOutputStream,etc)
> > > 2) Persister calls Traverser which should be the
> root of
> > > all serialization
> > > operations
> > > 3) Traverser gets source-object's class and
> starts
> > > scanning process to find
> > > annotations and whatever
> > >
> > > Now, if JBoss drops annotations during class
> loading,
> > > it's impossible for
> > > Simple to find them.
> > > Anyway we could reload the class with a custom
> classloader
> > > and make Simple
> > > use the loaded Class object
> > > as annotation scanning map. So my question is:
> > > Is it possible to tell Persister to do something
> like
> > > write(Object source,
> > > Class reloadedClass, OutputStream stream) ?
> > >
> > > Thanks in advance
> > >
> > > --
> > > Quirino Zagarese
> > >
> > > LaszloItalia Founder (www.laszloitalia.org)
> > > Software Development Manager - Galilaeus s.r.l.
> > > (www.galilaeus.net
> >
> )-------------------------------------------------------------------------
> > > Sponsored by: SourceForge.net Community Choice
> Awards: VOTE
> > > NOW!
> > > Studies have shown that voting for your favorite
> open
> > > source project,
> > > along with a healthy diet, reduces your potential
> for
> > > chronic lameness
> > > and boredom. Vote Now at
> > >
> >
> http://www.sourceforge.net/community/cca08_______________________________________________
> > > Simple-support mailing list
> > > Sim...@li...
> > >
> https://lists.sourceforge.net/lists/listinfo/simple-support
> >
> >
> >
> >
>
>
> --
> Quirino Zagarese
>
> LaszloItalia Founder (www.laszloitalia.org)
> Software Development Manager - Galilaeus s.r.l.
> (www.galilaeus.net)
|