Spring Boot部署为tomcat中的ROOT卡住部署

时间:2019-01-09 11:51:50

标签: java spring spring-boot tomcat

在Linux服务器中部署Spring Boot应用程序时遇到问题。

我将项目构建为war文件,并将其重命名为 ROOT.war

ROOT.war 放置在webapps文件夹中并启动tomcat服务后,它在此阶段卡住,没有任何反应。

09-Jan-2019 09:27:10.503 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/home/tomcat/webapps/ROOT.war]

我检查了网络上可能的解决方案,并添加了-Djava.security.egd=file:/dev/./urandom属性。

我从jstack中转储了。但是我不明白这里可能是什么问题。

这是我启动tomcat服务器后的输出

09-Jan-2019 09:26:51.998 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.5.35
09-Jan-2019 09:26:52.001 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Nov 3 2018 17:39:20 UTC
09-Jan-2019 09:26:52.002 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.5.35.0
09-Jan-2019 09:26:52.002 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
09-Jan-2019 09:26:52.003 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            3.10.0-862.11.6.el7.x86_64
09-Jan-2019 09:26:52.003 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
09-Jan-2019 09:26:52.003 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/java/jdk1.8.0_191-amd64/jre
09-Jan-2019 09:26:52.004 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_191-b12
09-Jan-2019 09:26:52.004 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
09-Jan-2019 09:26:52.004 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /home/tomcat
09-Jan-2019 09:26:52.004 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /home/tomcat
09-Jan-2019 09:26:52.005 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/home/tomcat/conf/logging.properties
09-Jan-2019 09:26:52.005 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
09-Jan-2019 09:26:52.007 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.awt.headless=true
09-Jan-2019 09:26:52.007 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.security.egd=file:/dev/./urandom
09-Jan-2019 09:26:52.008 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
09-Jan-2019 09:26:52.008 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.security.egd=file:/dev/./urandom
09-Jan-2019 09:26:52.008 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
09-Jan-2019 09:26:52.008 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
09-Jan-2019 09:26:52.008 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms512M
09-Jan-2019 09:26:52.009 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx1024M
09-Jan-2019 09:26:52.009 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+UseParallelGC
09-Jan-2019 09:26:52.009 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
09-Jan-2019 09:26:52.010 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/home/tomcat
09-Jan-2019 09:26:52.010 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/home/tomcat
09-Jan-2019 09:26:52.011 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/home/tomcat/temp
09-Jan-2019 09:26:52.011 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
09-Jan-2019 09:27:00.000 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-80"]
09-Jan-2019 09:27:00.595 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
09-Jan-2019 09:27:01.317 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
09-Jan-2019 09:27:01.576 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
09-Jan-2019 09:27:01.577 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 31920 ms
09-Jan-2019 09:27:06.322 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
09-Jan-2019 09:27:06.322 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.35
09-Jan-2019 09:27:10.503 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/home/tomcat/webapps/ROOT.war]

对于jstack日志,请在这里https://textuploader.com/1aoh0

更新

<build>来自pom.xml

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <executable>true</executable>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

1 个答案:

答案 0 :(得分:0)

我认为这与将war文件作为ROOT运行无关。您应该可以通过在catalina.sh中做一个小的更改来解决此问题。

  1. 在Tomcat的bin文件夹中打开catalina.sh文件。

  2. 搜索JAVA_OPTS并添加以下内容, -Djava.security.egd = file:/ dev /./ urandom

例如:,JAVA_OPTS =“ $ JAVA_OPTS -Djava.security.egd = file:/ dev /./ urandom”

  1. 保存catalina.sh并重新启动tomcat。

希望您现在不应该遇到相同的问题。