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 using 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, 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(
	... 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(
	... other common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/codehaus/jackson/JsonProcessingException
	at com.mycompany.erp.salesforce.oauth2.AutomatedAccess.<init>(
	at com.mycompany.erp.salesforce.impl.Activator.tryAutomatedAccess(
	at com.mycompany.erp.salesforce.impl.Activator.start(
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$
	at Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(
	... 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(
	at java.lang.ClassLoader.loadClass(
	... 41 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.JsonProcessingException
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(
	at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(
	... 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 = \

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
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: Mon Jun 25 16:04:03 GMT 2018

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

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

Back to the top