ClassNotFoundException Tomcat 5.5和Tomcat 6.0中的错误 [英] ClassNotFoundException Error in Tomcat 5.5 and Tomcat 6.0

查看:233
本文介绍了ClassNotFoundException Tomcat 5.5和Tomcat 6.0中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到tomcat 5.5和tomcat 6.0服务器这个奇怪的问题。我有两个将在tomcat上安装的Web应用程序。当启动tomcat时,这两个Web应用程序也会同时启动,但有时一个Web应用程序无法初始化,因为一个应用程序中的init失败,另一个应用程序在运行时遇到classnotfoundexception错误。在tomcat 7.0中,即使其他应用程序无法初始化,应用程序也能正常运行。

I am having this strange issue with the tomcat 5.5 and tomcat 6.0 servers. I have two web applications which will be installed on tomcat.When tomcat is started these two web applications also get started simultaneously but sometimes one web application fails to initialize because of the init failure in one application another application is getting classnotfoundexception errors while running. In tomcat 7.0 the application is running fine even if the other application failed to initialize.

经过一些调试后,我发现有一个名为crystal.jar的jar在两个应用程序的web-inf / lib文件夹。我已经将jar移动到tomcat的common / lib文件夹,然后它开始正常工作。我想知道为什么它在tomcat 7.0中运行正常而不是tomcat 5.x和tomcat 6.x版本。这些版本之间的类加载架构是否有任何变化?

After some debugging i came to know there is one jar named crystal.jar which is in the web-inf/lib folder of both applications. I have moved the jar to common/lib folder of tomcat then it started working fine. I want to know why it is working fine in tomcat 7.0 not in tomcat 5.x and tomcat 6.x versions. Is there any change in classloading architecture between these versions ?

谢谢

EDIT1:库位于两个应用程序WEB-INF \lib目录的位置,它们与外部DLLS没有依赖关系。刚才我读到了tomcat 5.5 classloader架构,并且发现每个Web应用程序都有自己的类加载器。 WEB-INF\lib文件夹和classes文件夹中的库将加载到此类加载器中。存储在公共目录下的库将被放入共享的类加载器中。然后这个库应该单独加载到Web应用程序的单独的类加载器中。即使一个Web应用程序无法启动,其他Web应用程序也应该独立工作。这就是为什么我感到奇怪并需要调查更进一步。

The library was in the location of both the applications WEB-INF\lib directory and they have no dependency with the external DLLS. Just now i read about tomcat 5.5 classloader architecture and came to know that every web application have its own class loader. The libraries in WEB-INF\lib folder and classes folder will be loaded into this classloader. The libraries whichever stored under common directory will be placed into a shared classloader. Then this library should be loaded seperately in seperate class loader of web application. There by even if one web application fails to start other web application should work independently. That's why i felt strange and need to investigate furthur.

推荐答案

终于找到了这个问题的答案

Finally Found the answer for this problem

当库类
被系统类引用并因此超出其年龄时,存在已知类型的PermGen内存泄漏。一个
的例子是Java发现JDBC驱动程序或其他服务
并自动注册它。它在
系统中继续引用它,但是类本身属于Web应用程序,并且在应用程序停止时必须卸载
- 但由于
引用而不能。并非所有此类参考文献都易于理解。

There exist a known kind of PermGen memory leaks, when a library class is referenced by a system class and thus lives beyond its age. One example is when Java discovers a JDBC driver, or some other service and "automatically registers" it. It keeps reference to it in a system, but the class itself belongs to the web application and has to be unloaded when application stops - but cannot, because of that reference. Not all such references are easy to clear.

在这种情况下,一个典型的症状是依赖于此系统功能的第一个Web应用程序
将成功,但第二个和
其他那些将失败(因为在
系统中注册的服务属于第一个Web应用程序,并且无法从第二个应用程序的
类加载器中看到类,反之亦然)。

One typical symptom in such a case is that the first web application that relies on this system feature will succeed, but the second and other ones will fail (because the service that is registered in the system belongs to first web application and cannot see classes from classloader of the second application and vice versa).

Tomcat 7和最新版本的Tomcat 6在默认的
配置中对某些已知的PermGen内存泄漏有更好的保护

Tomcat 7 and recent versions of Tomcat 6 have better protection against certain known PermGen memory leaks in their default configuration.

Tomcat 5.5根本没有这样的保护。

Tomcat 5.5 does not have such protection at all.

编辑一些参考资料

http://people.apache .org / ~markt / presentations / 2010-08-05-Memory-Leaks-JavaOne-60mins.pdf
http:// pe ople.apache.org/~markt/presentations/2010-11-04-Memory-Leaks-60mins.pdf

http://eclipse.org/mat/

http://wiki.apache.org/tomcat/FAQ/Troubleshooting_and_Diagnostics
http://wiki.apache.org/tomcat/MemoryLeakProtection

这篇关于ClassNotFoundException Tomcat 5.5和Tomcat 6.0中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆