简体   繁体   English

尝试在virgo tomcat中配置自定义会话管理器时获取ClassNotFoundException

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

I am using the eclipse virgo server with embedded tomcat. 我正在使用嵌入式tomcat的eclipse处女座服务器。 I want to use a custom session manager which I have created and it is present in an osgi bundle. 我想使用我创建的自定义会话管理器,它存在于osgi包中。 I have configured the osgi bundle as a fragment with the catalina bundle being the fragment host. 我已经将osgi包配置为片段,其中catalina包是片段主机。 Also in my context.xml I have configured the session manager by specifying the fully qualified class name. 同样在我的context.xml中,我通过指定完全限定的类名来配置会话管理器。

The problem is that on startup I get a ClassNotFoundException for my session manager. 问题是在启动时我得到了会话管理器的ClassNotFoundException。

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 我已经尝试将我的jar添加到lib文件夹并修改config.ini以使我的jar在启动时加载,但这没有帮助

In this scenario what should I do to ensure that my class is found on startup. 在这种情况下,我应该怎么做才能确保在启动时找到我的类。

You can use the Virgo Shell Commands as described in this blog to analyze class loading issues. 您可以使用本博客中描述的Virgo Shell命令来分析类加载问题。 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. 看一下Virgo FAQ如果需要,如何将导入添加到第三方软件包。

Enabling class loader debugging helped, 启用类加载器调试有帮助,

In configuration/config.ini add the following property 在configuration / config.ini中添加以下属性

osgi.debug=configuration/equinox-debug.properties

In configuration/equinox-debug.properties add the following properties, 在configuration / equinox-debug.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. 现在,当您重新启动容器时,它会打印出试图加载您的类的BundleClassLoader。 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. 我希望我的bundle能够作为一个片段添加到正在加载这个类的bundle中,所以一旦我弄清楚哪个bundle正在加载该类,我只是将它用作片段主机。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM