Sridhar Sridhar - 1 year ago 103
reST (reStructuredText) Question

REST call to spring boot RestController results 404 in tomcat but works in embedded tomcat

I am new to spring boot. I have knowledge on Spring mvc. I have developed small application with one @RestController as mentioned in Update below. This is working fine when I execute using

mvn spring-boot:run
(ie. embedded tomcat)

  1. The same REST call results in
    404 not found
    when I deploy as packaged war to tomcat. Target url
    http://localhost:8086/myapp/demo gives 404.

  2. I have the
    created and when I execute with embedded tomcat it creates the expected log file, but with the external tomcat deployment it does not create the log file too and I do not find any logs in any of the tomcat logs under

What am I missing here ?


The spring boot entry point class:

public class App extends SpringBootServletInitializer {
public static void main(String[] args) {, args);

protected SpringApplicationBuilder configure(
SpringApplicationBuilder application) {
return application.sources(App.class);

public String demo() {
return "Helloo.. !!";

Spring boot version => v1.3.2.RELEASE

The logs when I deploy to tcServer

INFO: Deploying web application archive C:\Users\a\vfabric-tc-server\vm1\webapps\myapp.war
Sep 12, 2016 5:07:23 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\a\vfabric-tc-server\vm1\webapps\myapp\WEB-INF\lib\tomcat-embed-el-8.0.30.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
Sep 12, 2016 5:07:24 PM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Sep 12, 2016 5:07:24 PM org.apache.catalina.core.ApplicationContext log
INFO: Spring WebApplicationInitializers detected on classpath: [org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$JerseyWebApplicationInitializer@47b35d]
Sep 12, 2016 5:07:24 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive C:\Users\a\vfabric-tc-server\vm1\webapps\myapp.war has finished in 1,913 ms

I removed Angular, kept only spring boot @restcontroller. Problem still exists.

Answer Source

This was the problem with the target external Tomcat server that was pointing to JDK6, but my application was build using jdk7. Problem resolved once I point the external Tomcat to jdk7.