我在开放班次更新了一场java战争,在更新后,应用程序不会启动。当我查看jbossews日志文件时,我发现了问题,但我无法在OpenShift之外复制它。它在当地的tomcat上做得很好。
在应用程序用尽堆空间之前,我收到一系列处理错误:
May 22, 2015 12:04:16 AM org.apache.catalina.startup.ContextConfig processAnnotationsJar
SEVERE: Unable to process Jar entry [javassist/ByteArrayClassPath.class] from Jar [jar:jndi:/localhost/cope/WEB-INF/lib/javassist-3.19.0-GA.jar!/] for annotations
java.io.EOFException
at java.io.DataInputStream.readUnsignedShort(DataInputStream.java:340)
at org.apache.tomcat.util.bcel.classfile.Utility.swallowMethodParameters(Utility.java:797)
at org.apache.tomcat.util.bcel.classfile.Attribute.readAttribute(Attribute.java:171)
at org.apache.tomcat.util.bcel.classfile.FieldOrMethod.<init>(FieldOrMethod.java:57)
at org.apache.tomcat.util.bcel.classfile.Method.<init>(Method.java:71)
at org.apache.tomcat.util.bcel.classfile.ClassParser.readMethods(ClassParser.java:267)
at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:127)
at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2058)
at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1934)
at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1900)
at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1885)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1317)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:876)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:374)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5355)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1880)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
直到以下情况:
May 22, 2015 12:04:17 AM org.apache.catalina.startup.HostConfig deployWARs
SEVERE: Error waiting for multi-thread deployment of WAR files to complete
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:818)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1614)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:330)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:347)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1140)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:799)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.OutOfMemoryError: Java heap space
我在这里缺少什么?
答案 0 :(得分:6)
所以,回答我自己的问题,问题似乎是最新版本的javassist。我们更新到最新版本,作为上次更新3.19.0的一部分,看起来它与OpenShift上的Tomcat不兼容。一旦我降级回3.17.1,一切正常。
正如对任何OpenShift员工的说明一样,如果可以在OpenShift支持页面上突出显示此类问题,那将非常有用。 Javassist 3.19.0在maven上已经存在了5个月,我无法想象我们是第一个遇到这个问题的人。
答案 1 :(得分:4)
此问题已在the Tomcat 7.0.56 changelog中得到确认。
有关详细信息,请参阅此问题:Tomcat 7 Annotation scanner and JDK 8 with -parameters compiler flag exceptions
Javassist 3.19.0 使用java8编译器参数-parameters
答案 2 :(得分:1)
通过查看此消息&#34; jar:jndi:/localhost/cope/WEB-INF/lib/javassist-3.19.0-GA.jar!/
&#34;
您的类路径似乎存在问题。使用相对路径而不是绝对路径。对于例如/lib/javassist-3.19.0-GA.jar
答案 3 :(得分:1)
对于我的项目,我通过排除修复了这个问题:
它可能对你有帮助。
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.1.0.Final</version>
<exclusions>
<exclusion>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</exclusion>
</exclusions>
</dependency>
答案 4 :(得分:0)
查找需要org.javassist
mvn dependency:tree
显示(例如,spring-boot-starter-thymeleaf)
[INFO] \- org.springframework.boot:spring-boot-starter-thymeleaf:jar:1.4.1.RELEASE:compile
[INFO] +- org.thymeleaf:thymeleaf-spring4:jar:2.1.5.RELEASE:compile
[INFO] | +- org.thymeleaf:thymeleaf:jar:2.1.5.RELEASE:compile
[INFO] | | +- ognl:ognl:jar:3.0.8:compile
[INFO] | | +- org.javassist:javassist:jar:3.20.0-GA:compile (version managed from 3.16.1-GA)
[INFO] | | \- org.unbescape:unbescape:jar:1.1.0.RELEASE:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.21:compile
[INFO] \- nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:jar:1.4.0:compile
[INFO] \- org.codehaus.groovy:groovy:jar:2.4.7:compile (version managed from 2.4.3)
依赖关系来自spring-boot-starter-thymeleaf
,将其排除并添加依赖于您环境支持的版本
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<exclusions>
<exclusion>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.17.1-GA</version>
</dependency>
使用降级版本测试它是否正常工作。
答案 5 :(得分:0)
您可以将跳过的jar添加到扫描中。只需进入文件&#34; catalina.properties&#34;在您的存储库的路径nameRepository / .openshift / config /中。然后搜索tomcat.util.scan.DefaultJarScanner.jarsToSkip
在本节的最后,添加jar的名称,例如javassist-*.jar