javatomcatosgieclipse-virgo

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


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.


Solution

  • 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.