Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » KernelBundleClassLoader - Wiring problem?(Spring-web classpath vs. my bundle classpath)
KernelBundleClassLoader - Wiring problem? [message #1160108] Tue, 29 October 2013 00:49 Go to next message
Douglas Beattie is currently offline Douglas BeattieFriend
Messages: 6
Registered: October 2013
Junior Member
I'm doing direct OAuth2 authentication to Salesforce.com using org.springframework.security.oauth2.client.OAuth2RestTemplate. Since the content type of retrieved data is JSON, I have to manually add an 'org.springframework.http.converter.json.MappingJacksonHttpMessageConverter', as
restTemplate.getMessageConverters().add(new MappingJacksonHttpMessageConverter());

While my bundle 'erp.salesforce' directly declares imports for 'org.codehaus.jackson' and org.codehaus.jackson.map, the bundle will fail to start even when I deliberately start both jackson-core-asl-1.9.9.jar and jackson-mapper-asl-1.9.9.jar (which are of course valid OSGi bundles) before starting my application bundle.

Here is what the log output looks like (slightly trimmed for "other common frames"):

[2013-10-28 15:39:42.965] fs-watcher    <HD0002E> Hot deploy failed for file 'erp.salesforce-1.0.0-SNAPSHOT.jar'. org.eclipse.virgo.nano.deployer.api.core.DeploymentException: BundleException
	at org.eclipse.virgo.kernel.install.artifact.internal.bundle.StandardBundleDriver.startBundle(StandardBundleDriver.java:199)
	... other common frames omitted
Caused by: org.osgi.framework.BundleException: Exception in com.mycompany.erp.salesforce.impl.Activator.start() of bundle com.mycompany.erp.salesforce.
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:734)
	... other common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/codehaus/jackson/JsonProcessingException
	at com.mycompany.erp.salesforce.oauth2.AutomatedAccess.<init>(AutomatedAccess.java:66)
	at com.mycompany.erp.salesforce.impl.Activator.tryAutomatedAccess(Activator.java:46)
	at com.mycompany.erp.salesforce.impl.Activator.start(Activator.java:31)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
	... 35 common frames omitted
Caused by: org.eclipse.virgo.kernel.osgi.framework.ExtendedClassNotFoundException: org.codehaus.jackson.JsonProcessingException in KernelBundleClassLoader: [bundle=org.springframework.web_3.1.0.RELEASE]
	at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:150)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	... 41 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.JsonProcessingException
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:146)
	... 42 common frames omitted


Note in particular this piece of information:
ExtendedClassNotFoundException: org.codehaus.jackson.JsonProcessingException in KernelBundleClassLoader: [bundle=org.springframework.web_3.1.0.RELEASE]

Now, I was able to overcome this by modifying the ./configuration/java6-server.profile
by adding a couple lines, to declare these as "system" packages in the parent classloader.
  org.osgi.framework.system.packages = \
   org.codehaus.jackson,\
   org.codehaus.jackson.map,\

and, the whole thing works beautifully -- but I think there must be a (probably simple) programmatic way to extend the classpath during Bundle activation. (I was a little surprised that the Virgo and Gemini wouldn't do this as-is.) Is this a fairly common problem, that injecting something into a Spring module requires classes outside the scope of its default wiring within the OSGi environment?


. . .
Douglas Beattie
www.linkedin.com/in/beattidp
Re: KernelBundleClassLoader - Wiring problem? [message #1177105 is a reply to message #1160108] Fri, 08 November 2013 19:33 Go to previous message
Eduardo Frazão is currently offline Eduardo FrazãoFriend
Messages: 123
Registered: January 2012
Senior Member
I don't know if the classpath can be extended programatically, but, in this case, I think that would be better to add an fragment attached to this spring bundle. This fragment can control the imports, if some is missing, like in this case. Do you have tried that?
Previous Topic:greenpages sample getting errors on junit test
Next Topic:Service configuration error
Goto Forum:
  


Current Time: Fri Apr 26 06:08:55 GMT 2024

Powered by FUDForum. Page generated in 0.03305 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top