1

I wrote a spring boot app. When I put it as a WAR into the webapps folder of a local test Tomcat 7.0.57 (XAMPP) it gets deployed and starts right away. When I do the same on a dedicated test server with the same Tomcat version the server deploys the application but does not start it. When I try to reach the application via browser I get a 404 in response.

Someone got an idea what could hinder the server from starting the application?

catalina.out Log:

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
Neonchen
  • 141
  • 1
  • 6
  • Have you looked in the Tomcat logs? – Stephen C Jul 23 '15 at 12:39
  • 2
    go in tomcat folder with your file management software, go in logs folder and there would be a file called catalina.out .. Copy its contents, edit your main post, and paste the entire catalina.out there, select that text with mouse, press ctrl+k and save the edit. Then we will be able to see whats the problem. – We are Borg Jul 23 '15 at 12:50
  • Thx for the help. Here you go :) – Neonchen Jul 23 '15 at 13:21
  • So, now your will just have to upgrade Java. – Patouche Jul 23 '15 at 13:29
  • Indeed, update your java. Java 8 is also more secure. Absolutely recommended. – We are Borg Jul 23 '15 at 13:34
  • I totally agree but can't upgrade just like that. You think that's what is causing the problem? What's even more interesting is that Java 7 is in use and Tomcat seems to think that it is using Java 6. Really strange. – Neonchen Jul 23 '15 at 13:54
  • possible duplicate of [Spring Boot War file gets 404 on ec2](http://stackoverflow.com/questions/30929098/spring-boot-war-file-gets-404-on-ec2) – ci_ Jul 23 '15 at 20:54

2 Answers2

2

The problem was that my Tomcat 7 was using Java 6.

Hint was the following line of the catalina.out log:

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.

I switched the Java version just for this Tomcat by creating a setenv.sh in tomcat-7/bin which is read by default on startup by catalina.sh to set environment variables.

setenv.sh:

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

Thx @We are Borg and @Patouche

Neonchen
  • 141
  • 1
  • 6
0

In your web initiliazr class (the one extending SpringBootServletInitializer) did you override the method configure(SpringApplicationBuilder application) like the following one :

@SpringBootApplication
public class Application extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }

    public static void main(String[] args) throws Exception {
        SpringApplication.run(Application.class, args);
    }

}

You will find more information on this page : http://docs.spring.io/spring-boot/docs/current/reference/html/howto-traditional-deployment.html

Patouche
  • 149
  • 1
  • 5
  • Yes, I did. The application would not start on the test Tomcat if the war would not be ok I guess. But I can not see any differences between the configurations of the two Tomcats. – Neonchen Jul 23 '15 at 13:08