Re: Question about bundle class loader lifecycle

2009-08-17 Thread Holger Hoffstätte
Todor, Richard - thank you for your responses. I understand how various GC schemes work - I guess I should have asked a more concise question like does the framework explicitly keep a reference to the classloader, and if so, when is that reference released. :) However in the meantime I found out

XStream and OSGi

2009-08-17 Thread Guido Spadotto
Hi all, in an OSGi-based project of mine I'm trying to use XStream to marshall/unmarshall data structures to/from XML. Saving data to XML is no big issue, but restoring it from XML throws a CannotResolveClass [1] exception. I've googled a bit and it seems that XStream requires some tampering

Re: XStream and OSGi

2009-08-17 Thread Charles Moulliard
Hi Guido, Why don't you use jaxb + camel. Please have a look here in the doc : http://camel.apache.org/jaxb.html Regards, Charles Moulliard Senior Enterprise Architect Apache Camel Committer * blog : http://cmoulliard.blogspot.com On Mon, Aug 17, 2009 at 2:57 PM,

Re: XStream and OSGi

2009-08-17 Thread Todor Boev
In the [3] link in your message the guy has tried this: xStream.setClassLoader(Thread.currentThread().getContextClassLoader()); Instead he should have tried this xStream.setClassLoader(getClass().getClassLoader()); The idea is to tell xStream to load classes from your own class loader, aka

Re: XStream and OSGi

2009-08-17 Thread Guido Spadotto
Todor Boev wrote: In the [3] link in your message the guy has tried this: xStream.setClassLoader(Thread.currentThread().getContextClassLoader()); Instead he should have tried this xStream.setClassLoader(getClass().getClassLoader()); The idea is to tell xStream to load classes from your own

Re: XStream and OSGi

2009-08-17 Thread Carsten Ziegeler
Guido Spadotto wrote Thanks Todor and Charles for your highly appreciated suggestions. I think that Todor spotted the technical issue with quite a remarkable conciseness, and you're not out of line. 'Captatio benevolentiae' apart ;) I of course am in the case of scattered among several

Re: XStream and OSGi

2009-08-17 Thread Reto Bachmann-Gmür
Carsten Ziegeler said the following on 08/17/2009 04:33 PM: ... http://svn.apache.org/repos/asf/sling/trunk/bundles/commons/classloader/ It provides the DynamicClassLoaderManager services which gives you a classloader that is able to load all publically available classes from all bundles,

Re: Question about bundle class loader lifecycle

2009-08-17 Thread Richard S. Hall
On 8/17/09 5:27, Holger Hoffstätte wrote: Todor, Richard - thank you for your responses. I understand how various GC schemes work - I guess I should have asked a more concise question like does the framework explicitly keep a reference to the classloader, and if so, when is that reference

Re: XStream and OSGi

2009-08-17 Thread Guido Spadotto
Carsten Ziegeler wrote: If your objects are scattered among several bundles you might want to give the Apache Sling dynamic classloader a try: http://svn.apache.org/repos/asf/sling/trunk/bundles/commons/classloader/ It provides the DynamicClassLoaderManager services which gives you a

Re: XStream and OSGi

2009-08-17 Thread Carsten Ziegeler
Guido Spadotto wrote: Thanks Carsten, I'm now injecting the DynamicClassLoader using SCR in my code: /** * The Sling Dynamic ClassLoader manager. * It is mandatory, so no need for null reference checking. * @scr.reference cardinality=1..1 bind=setDynCl *

Excluding optional imports with OBR?

2009-08-17 Thread Allen Lau
Hi, just wondering if there is an easy way to tell OBR not to check and deploy optional imports during deploy? Thanks, Allen

Re: XStream and OSGi

2009-08-17 Thread Todor Boev
Guido Spadotto wrote: Another guy claimed he solved this issue [1], but I won't believe until I see it running. ... [1]: http://archive.timeindexing.codehaus.org/lists/org.codehaus.xstream.user/msg/19183331.p...@talk.nabble.com On second though I think this wrapper function should work

Re: XStream and OSGi

2009-08-17 Thread Steve Lindsay
On Mon, Aug 17, 2009 at 10:57 PM, Guido Spadottogspado...@soluta.net wrote: Question 1: Were any of you able to use XStream within an OSGi container successfully? We have used xstream in an osgi app. To make it work we: - added the relevant jars to the bundle that was using xstream (we only

Re: XStream and OSGi

2009-08-17 Thread David Leangen
I am also using XStream successfully in OSGi. The problem is the classic deserialization issue. Since there is not yet any standardized solution to this (what seems to me to be a) common problem, I just made my own temporary solution. For any bundle that needs to provide class