Reputation: 1510
I'm trying to unmarshal with serialization method a bean that is not the current bundle but in a commons components bundle.
I get the following error when camel tries to unmarshal my bean :
22:43:11,865 | ERROR | nModule-thread-1 | DefaultErrorHandler | 89 - org.apache.camel.camel-core - 2.8.0.fuse-06-11 | Failed delivery for exchangeId: ID-ITEM-64684-49962-1354223882336-2-1. Exhausted after delivery attempt: 1 caught: java.lang.ClassNotFoundException: commons.InformationInput java.lang.ClassNotFoundException: commons.InformationInput at java.net.URLClassLoader$1.run(URLClassLoader.java:202)[:1.6.0_33] at java.security.AccessController.doPrivileged(Native Method)[:1.6.0_33] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)[:1.6.0_33] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)[:1.6.0_33]http://stackoverflow.com/questions/6749334/osgi-bundle-access-spring-context-file-from-another-bundle at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_33] at org.apache.felix.framework.ModuleImpl.doImplicitBootDelegation(ModuleImpl.java:1610) at org.apache.felix.framework.ModuleImpl.searchDynamicImports(ModuleImpl.java:1547)
My bundle containing the bean is correctly started and i've defined the commons package in the Export-Package of the bundle definition
Does anyone managed to such thing ?
Upvotes: 0
Views: 789
Reputation: 1510
I find a workaroud by enabling dynamicimport on camel-core bundle.
This can be done on karaf console : dev:dynamicimport <camel-core-bundle-id>
Upvotes: 0
Reputation: 8275
This sometimes occurs when the bundle that is serializing/deserializing classes does not know in advance what packages must be imported.
One workaround is to use DynamicImport-Package. For example:
DynamicImport-Package: *
This then means the bundle can import classes in any package, but beware of the costs (see the linked article).
Upvotes: 1
Reputation: 3502
This sounds similar to Hibernate issues an OSGi environment where it fails because of class loading issues. I would recommend something classed class buddy loading. in the Manifest of your commons bundle that contains the class add this
Eclipse-BuddyPolicy:registered
Then in your dependent buddy make sure you have it added as a dependent bundle and this to its manifest.
Eclipse-RegisterBuddy:com.nameofmycommonbundle
This should solve your problem.
Here is a reference to hibernate reference
Upvotes: 0