Getting a ClassNotFoundException when trying to configure a custom session manager in virgo tomcat

StackOverflow https://stackoverflow.com/questions/21171668

Question

I am using the eclipse virgo server with embedded tomcat. I want to use a custom session manager which I have created and it is present in an osgi bundle. I have configured the osgi bundle as a fragment with the catalina bundle being the fragment host. Also in my context.xml I have configured the session manager by specifying the fully qualified class name.

The problem is that on startup I get a ClassNotFoundException for my session manager.

I have tried adding my jar to the lib folder and modifying the config.ini to make my jar load up on startup but that did not help

In this scenario what should I do to ensure that my class is found on startup.

Was it helpful?

Solution 2

Enabling class loader debugging helped,

In configuration/config.ini add the following property

osgi.debug=configuration/equinox-debug.properties

In configuration/equinox-debug.properties add the following properties,

org.eclipse.osgi/debug=true
org.eclipse.osgi/debug/loader=true

Now when you restart the container it prints out the BundleClassLoader which is attempting to load your class. I wanted my bundle to a be added as a fragment to the bundle which was loading this class, so once I figured out which bundle was loading the class I simply used that as the fragment host.

OTHER TIPS

You can use the Virgo Shell Commands as described in this blog to analyze class loading issues. You can lists all bundles that can load a class for example. Have a look at the Virgo FAQ How to add imports to 3rd party bundles if need be.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top