我写了一个Spring Boot应用程序。当我将它作为WAR放入本地测试Tomcat 7.0.57(XAMPP)的webapps文件夹中时,它将立即部署并启动。当我在具有相同Tomcat版本的专用测试服务器上执行相同操作时,服务器将部署该应用程序,但不会启动它。当我尝试通过浏览器访问该应用程序时,我得到404响应。

有人知道什么会阻止服务器启动应用程序?

catalina.out日志:

Jul 23, 2015 3:16:12 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.30 using APR version 1.3.9.
Jul 23, 2015 3:16:12 PM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Jul 23, 2015 3:16:12 PM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized (OpenSSL 1.0.1e 11 Feb 2013)
Jul 23, 2015 3:16:12 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-apr-5009"]
Jul 23, 2015 3:16:12 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 809 ms
Jul 23, 2015 3:16:12 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jul 23, 2015 3:16:12 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.56
Jul 23, 2015 3:16:12 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /opt/tomcat-7/webapps/testapp.war
Jul 23, 2015 3:16:15 PM org.apache.tomcat.websocket.server.WsSci onStartup
INFO: JSR 356 WebSocket (Java WebSocket 1.0) support is not available when running on Java 6. To suppress this message, run Tomcat on Java 7, remove the WebSocket JARs from $CATALINA_HOME/lib or add the WebSocket JARs to the tomcat.util.scan.DefaultJarScanner.jarsToSkip property in $CATALINA_BASE/conf/catalina.properties. Note that the deprecated Tomcat 7 WebSocket API will be available.
Jul 23, 2015 3:16:15 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /opt/tomcat-7/webapps/testapp.war has finished in 2,683 ms
Jul 23, 2015 3:16:15 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-apr-5009"]
Jul 23, 2015 3:16:15 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2752 ms

最佳答案

问题是我的Tomcat 7使用的是Java 6。

提示是catalina.out日志的以下行:

INFO: JSR 356 WebSocket (Java WebSocket 1.0) support is not available when running on Java 6. To suppress this message, run Tomcat on Java 7, remove the WebSocket JARs from $CATALINA_HOME/lib or add the WebSocket JARs to the tomcat.util.scan.DefaultJarScanner.jarsToSkip property in $CATALINA_BASE/conf/catalina.properties. Note that the deprecated Tomcat 7 WebSocket API will be available.


我通过在tomcat-7 / bin中创建setenv.sh来仅为此Tomcat切换了Java版本,默认情况下,catalina.sh在启动时会读取它以设置环境变量。

setenv.sh:

export JAVA_HOME=/usr/java/jdk1.7.0_09


Thx @我们是Borg和@Patouche

10-05 21:11
查看更多