Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Retrieving a Bundle Classpath
Retrieving a Bundle Classpath [message #753470] Thu, 27 October 2011 12:14 Go to next message
Tony Day is currently offline Tony DayFriend
Messages: 9
Registered: October 2011
Junior Member
Hi,

Is there a way to retrieve the running bundles classpath? Or any straightforward way to find this out? I know that the ClassLoader is a KernelBundleClassLoader, but this does not seem to provide methods for accessing the classpath string/array.

The reason I ask is for diagnostic purposes. Virgo is telling me something could not be found on the classpath although it is being imported.

Thanks
Re: Retrieving a Bundle Classpath [message #753485 is a reply to message #753470] Thu, 27 October 2011 12:53 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
There is no simple representation of what you refer to as a class path in a bundle class loader. It's a combination of a local bundle class path and delegation routes, or "wires", to other bundle class loaders.

Have you tried the extremely useful class loading commands (clload, clhas, etc.) provided in the Virgo admin shell? See the user guide for details.
Re: Retrieving a Bundle Classpath [message #753486 is a reply to message #753485] Thu, 27 October 2011 12:53 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
See also the FAQ.
Re: Retrieving a Bundle Classpath [message #753489 is a reply to message #753486] Thu, 27 October 2011 13:15 Go to previous messageGo to next message
Tony Day is currently offline Tony DayFriend
Messages: 9
Registered: October 2011
Junior Member
Hi Glyn,

Thanks for your advice!

I have used these commands, they really are helpful. Hence why I'm stuck.

Basically I'm having an issue where my bundle cannot find CGLIB at runtime (although it is imported successfully) which is also shown using clload, clhas, clexport as expected. Although I'm still getting the following error:

AG0000E Application context creation failure for bundle 'com.acme.osgi.hibernate-session' version '1.0.0.SNAPSHOT'. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean#0': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dynamicConfiguration' defined in BeanDefinition defined in URL [bundleentry://153.fwk32113234/META-INF/spring/bundle-context.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces.


With the interesting part being:

org.springframework.aop.framework.AopConfigException: Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces.


My proxy is simply:

<bean id="dynamicConfiguration"
	class="com.notehive.osgi.hibernate_samples.session.DynamicConfiguration"
	depends-on="databaseLauncher">
	<!-- 
		Need to create a proxy because of, I guess, some mysterious circular
		dependency which requires this bean to exist before it can be initialized. 
	-->
	[b]<aop:scoped-proxy/>[/b]
	<property name="hibernateProperties" ref="hibernateProperties" />
</bean>


NOTE: I've been using code originally developed by Hans Loe, though added Hibernate 3.6.7 and other dependencies. OsgiHibernateSpringSpringDMSample This works fine in Equinox alone.

The following packages relevant to CGLIB 2.2.0 are being exported from one bundle, and imported into my current bundle (this resolves without problem):

org.objectweb.asm;version="3.1.0"
org.objectweb.asm.signature;version="3.1.0"
net.sf.cglib.core;version="2.2.0"
net.sf.cglib.reflect;version="2.2.0"
net.sf.cglib.proxy;version="2.2.0"


I hope you can shed a light on why my bundle cannot find CGLIB.

Thanks

[Updated on: Thu, 27 October 2011 13:19]

Report message to a moderator

Re: Retrieving a Bundle Classpath [message #753499 is a reply to message #753489] Thu, 27 October 2011 13:46 Go to previous messageGo to next message
Tony Day is currently offline Tony DayFriend
Messages: 9
Registered: October 2011
Junior Member
I've found a work-around.

Harald Wellman covers this in his blog:

Quote:

I had a very mysterious ClassNotFoundException when accessing some of my model classes. As it turned out, the reason was my usage of lazy loading, where Hibernate injects CGLIB proxy classes into my model classes. The exception was due to the fact that my model bundle did not have access to the CGLIB classes. Rather than declaring a dependency on CGLIB for each of my model bundles, I added the following header to my Hibernate manifest:

Require-Bundle: com.springsource.net.sf.cglib;visibility:=reexport


So I've now done this and gone on to my next error ("Resolver reported uses conflict").

Thanks for your help Glyn!
Re: Retrieving a Bundle Classpath [message #754010 is a reply to message #753470] Mon, 31 October 2011 12:57 Go to previous message
Tony Day is currently offline Tony DayFriend
Messages: 9
Registered: October 2011
Junior Member
Hi,

I'm still getting this CGLIB problem when trying to use Hibernate inside of Virgo.

I've tried everything that is suggested in the Virgo documentation - I'm importing the Hibernate bundles from the library provided by Spring Source Enterprise Bundles - Hibernate JPA (3.4.0.GA-A).

Any ideas why I am still getting this problem?
Previous Topic:Something Is Wrong Here
Next Topic:Precompiled JSPs full of ${...}
Goto Forum:
  


Current Time: Fri Apr 19 10:54:31 GMT 2024

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

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

Back to the top