我有一台 Azure 机器,上面有几个 tomcat 应用程序。我一直在配置它们并重新启动它们,直到 tomcat with jasper 突然在部署时停止了。没有错误,最后一句是
Jun 18 16:49:10 RE1 catalina.sh: 18-Jun-2020 16:49:10.273 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.23
Jun 18 16:49:10 RE1 catalina.sh: 18-Jun-2020 16:49:10.281 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/app/jasper/apache-tomcat-8.0.23/webapps/jasperserver
我发现这可能是由于缺少熵造成的,所以我修改了JAVA_OPTS:
export JAVA_OPTS="-Xmx2048m -Djava.security.egd=file:/dev/./urandom"
嗯,这没用。这是线程转储的一部分。有办法解决这个问题吗?
Jun 18 16:52:19 RE1 catalina.sh: Full thread dump OpenJDK 64-Bit Server VM (25.252-b09 mixed mode):
Jun 18 16:52:19 RE1 catalina.sh: "localhost-startStop-1" #15 daemon prio=5 os_prio=0 tid=0x00007f59a0002000 nid=0x121cb runnable [0x00007f59ea1a9000]
Jun 18 16:52:19 RE1 catalina.sh: java.lang.Thread.State: RUNNABLE
Jun 18 16:52:19 RE1 catalina.sh: at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)
Jun 18 16:52:19 RE1 catalina.sh: at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:242)
Jun 18 16:52:19 RE1 catalina.sh: at java.io.File.isDirectory(File.java:849)
Jun 18 16:52:19 RE1 catalina.sh: at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1983)
Jun 18 16:52:19 RE1 catalina.sh: at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
Jun 18 16:52:19 RE1 catalina.sh: at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1988)
Jun 18 16:52:19 RE1 catalina.sh: at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:771)
Jun 18 16:52:19 RE1 catalina.sh: - locked <0x00000000830ccfe8> (a org.apache.catalina.startup.ContextConfig)
Jun 18 16:52:19 RE1 catalina.sh: at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:305)
Jun 18 16:52:19 RE1 catalina.sh: at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
Jun 18 16:52:19 RE1 catalina.sh: at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
Jun 18 16:52:19 RE1 catalina.sh: at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5066)
Jun 18 16:52:19 RE1 catalina.sh: - locked <0x00000000830ccda8> (a org.apache.catalina.core.StandardContext)
Jun 18 16:52:19 RE1 catalina.sh: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
Jun 18 16:52:19 RE1 catalina.sh: - locked <0x00000000830ccda8> (a org.apache.catalina.core.StandardContext)
Jun 18 16:52:19 RE1 catalina.sh: at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
Jun 18 16:52:19 RE1 catalina.sh: at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
Jun 18 16:52:20 RE1 catalina.sh: at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
Jun 18 16:52:20 RE1 catalina.sh: at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1101)
Jun 18 16:52:20 RE1 catalina.sh: "Catalina-startStop-1" #14 daemon prio=5 os_prio=0 tid=0x00007f5a086ad800 nid=0x121ca waiting on condition [0x00007f59ea2ae000]
Jun 18 16:52:20 RE1 catalina.sh: java.lang.Thread.State: WAITING (parking)
Jun 18 16:52:20 RE1 catalina.sh: at sun.misc.Unsafe.park(Native Method)
Jun 18 16:52:20 RE1 catalina.sh: - parking to wait for <0x00000000830db920> (a java.util.concurrent.FutureTask)
Jun 18 16:52:20 RE1 catalina.sh: at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
Jun 18 16:52:20 RE1 catalina.sh: at java.util.concurrent.FutureTask.awaitDone(FutureTask.java:429)
Jun 18 16:52:20 RE1 catalina.sh: at java.util.concurrent.FutureTask.get(FutureTask.java:191)
Jun 18 16:52:20 RE1 catalina.sh: at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1016)
Jun 18 16:52:20 RE1 catalina.sh: "NioBlockingSelector.BlockPoller-1" #13 daemon prio=5 os_prio=0 tid=0x00007f5a0869f800 nid=0x121c8 runnable [0x00007f59ea3af000]
Jun 18 16:52:20 RE1 catalina.sh: java.lang.Thread.State: RUNNABLE
Jun 18 16:52:20 RE1 catalina.sh: at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
Jun 18 16:52:20 RE1 catalina.sh: at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
Jun 18 16:52:20 RE1 catalina.sh: "Service Thread" #8 daemon prio=9 os_prio=0 tid=0x00007f5a08135000 nid=0x121c4 runnable [0x0000000000000000]
Jun 18 16:52:20 RE1 catalina.sh: java.lang.Thread.State: RUNNABLE
Jun 18 16:52:20 RE1 catalina.sh: "C1 CompilerThread2" #7 daemon prio=9 os_prio=0 tid=0x00007f5a08122000 nid=0x121c3 waiting on condition [0x0000000000000000]
Jun 18 16:52:20 RE1 catalina.sh: "Reference Handler" #2 daemon prio=10 os_prio=0 tid=0x00007f5a080e0000 nid=0x121be in Object.wait() [0x00007f59ebdfc000]
Jun 18 16:52:20 RE1 catalina.sh: java.lang.Thread.State: WAITING (on object monitor)
Jun 18 16:52:20 RE1 catalina.sh: at java.lang.Object.wait(Native Method)
Jun 18 16:52:20 RE1 catalina.sh: - waiting on <0x00000000831fc2d8> (a java.lang.ref.Reference$Lock)
Jun 18 16:52:20 RE1 catalina.sh: at java.lang.Object.wait(Object.java:502)
Jun 18 16:52:20 RE1 catalina.sh: at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
Jun 18 16:52:20 RE1 catalina.sh: - locked <0x00000000831fc2d8> (a java.lang.ref.Reference$Lock)
Jun 18 16:52:20 RE1 catalina.sh: at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)
Jun 18 16:52:20 RE1 catalina.sh: "main" #1 prio=5 os_prio=0 tid=0x00007f5a0804c000 nid=0x121b8 waiting on condition [0x00007f5a10cc5000]
Jun 18 16:52:20 RE1 catalina.sh: java.lang.Thread.State: WAITING (parking)
Jun 18 16:52:20 RE1 catalina.sh: at sun.misc.Unsafe.park(Native Method)
Jun 18 16:52:20 RE1 catalina.sh: - parking to wait for <0x0000000082d0f1e8> (a java.util.concurrent.FutureTask)
Jun 18 16:52:20 RE1 catalina.sh: at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
Jun 18 16:52:20 RE1 catalina.sh: at java.util.concurrent.FutureTask.awaitDone(FutureTask.java:429)
Jun 18 16:52:20 RE1 catalina.sh: at java.util.concurrent.FutureTask.get(FutureTask.java:191)
Jun 18 16:52:20 RE1 catalina.sh: at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:917)
答案1
好的,问题出在类路径上。Tomcat 不喜欢以冒号开头。
前:
Using CLASSPATH: :/opt/app/jasper/apache-tomcat-8.0.23/extra_cp/phoenix-shaded-4.4.0-HBase-1.1-1.jar:/opt/app/jasper/default/bin/bootstrap.jar:/opt/app/jasper/default/bin/tomcat-juli.jar
后:
Using CLASSPATH: /opt/app/jasper/apache-tomcat-8.0.23/extra_cp/phoenix-shaded-4.4.0-HBase-1.1-1.jar:/opt/app/jasper/default/bin/bootstrap.jar:/opt/app/jasper/default/bin/tomcat-juli.jar