Tomcat 5.5:“在资源路径上处理 JAR 异常”导致 java.lang.OutOfMemoryError

Tomcat 5.5:“在资源路径上处理 JAR 异常”导致 java.lang.OutOfMemoryError

我们有一台运行 Tomcat 5.5 的旧服务器。

昨天我们部署了一个 war 文件,然后它开始崩溃。

查看 catalina.date.log 时,我发现了一些 java.util.zip.ZipException,然后是 java.lang.OutOfMemoryError。我认为这会导致内存泄漏,当没有更多内存可用时,Tomcat 会崩溃。

涉及3个文件:

  • /var/tomcat/tomcat-5.5.25/common/i18n/._tomcat-i18n-es.jar
  • /var/tomcat/tomcat-5.5.25/common/lib/._jasper-compiler-jdt.jar
  • /var/tomcat/tomcat-5.5.25/common/lib/._naming-factory-dbcp.jar

它们都各就各位,没有损坏。当然,._是导致错误的第一个嫌疑人。问题是这些文件在应用程序中没有被引用,更不用说 i18n-es 了,因为它没有 i18n 功能,也没有西班牙语配置,而且,ALAIK,在 Tomcat 中也没有。

将 Tomcat 升级到 7 是不可能的,并且在部署此应用程序之前它并没有崩溃,因此责怪服务器也不是一个可行的解决方案。

有人能告诉我这些文件可以用来做什么或者._在文件上添加什么吗?

下面是完整的跟踪日志,从部署到 Tomcat 重启。{AppName} 是 war 的名称。堆栈跟踪中根本没有任何对我们的包的引用,这一切都发生在 Tomcat 的代码中。

18/11/2013 11:06:24 org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive {AppName}.war
18/11/2013 11:06:24 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/i18n/._tomcat-i18n-es.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:127)
    at java.util.jar.JarFile.<init>(JarFile.java:135)
    at java.util.jar.JarFile.<init>(JarFile.java:99)
    at org.apache.catalina.startup.TldConfig.tldScanJar(TldConfig.java:457)
    at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:307)
    at org.apache.catalina.core.StandardContext.processTlds(StandardContext.java:4307)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4144)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:515)
    at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1220)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:458)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
    at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1394)
    at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:213)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
    at java.lang.Thread.run(Thread.java:662)
18/11/2013 11:06:24 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/lib/._jasper-compiler-jdt.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:06:24 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/i18n/._tomcat-i18n-ja.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:06:24 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/lib/._naming-factory-dbcp.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:06:24 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/lib/._jsp-api.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:06:24 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/i18n/._tomcat-i18n-en.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:06:24 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/i18n/._tomcat-i18n-fr.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:06:24 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/lib/._naming-resources.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:06:24 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/lib/._jasper-compiler.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:06:24 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/lib/._commons-el.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:06:24 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/lib/._naming-factory.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:06:24 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/lib/._servlet-api.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:06:24 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/lib/._jasper-runtime.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:07:21 org.apache.catalina.startup.HostConfig checkResources
INFO: Undeploying context [/{AppName}]
18/11/2013 11:12:02 org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive {AppName}.war
18/11/2013 11:12:02 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/i18n/._tomcat-i18n-es.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:12:02 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/lib/._jasper-compiler-jdt.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:12:02 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/i18n/._tomcat-i18n-ja.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:12:02 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/lib/._naming-factory-dbcp.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:12:02 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/lib/._jsp-api.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:12:02 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/i18n/._tomcat-i18n-en.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:12:02 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/i18n/._tomcat-i18n-fr.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:12:02 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/lib/._naming-resources.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:12:02 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/lib/._jasper-compiler.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:12:02 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/lib/._commons-el.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:12:02 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/lib/._naming-factory.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:12:02 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/lib/._servlet-api.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:12:02 org.apache.catalina.startup.TldConfig tldScanJar
GRAVE: Exception processing JAR at resource path /var/tomcat/tomcat-5.5.25/common/lib/._jasper-runtime.jar in context /{AppName}
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
...
18/11/2013 11:12:15 org.apache.tomcat.util.net.PoolTcpEndpoint processSocket
GRAVE: Unexpected error processing socket
java.lang.OutOfMemoryError: PermGen space
18/11/2013 11:17:41 org.apache.coyote.http11.Http11BaseProtocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8081
18/11/2013 11:17:42 org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
18/11/2013 11:18:46 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/amd64/server:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/amd64:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
18/11/2013 11:18:46 org.apache.coyote.http11.Http11BaseProtocol init

答案1

就我而言,我意外删除了 Tomcat 根目录下的“temp”目录,并出现了此错误消息。也许您可以检查 temp 是否存在。如果是,则检查启动 Tomcat 的帐户的所有权。

答案2

启动 tomcat 时,您可能需要增加共享内存设置。这可能是临时文件夹的问题(想想没有空间,没有权限,正如 Scott 所写的)

另外,这可能是由于您使用的内存太多:

增加你的 Xmx 和 Xms 值,你可能还想更新你的堆设置。

检查 SF 搜索“OOM tomcat”,您将找到需要学习的其余内容。

相关内容