1

Please note, despite title being very similar to other posts, this is not a duplicate since I read all of them and none pertain to my particular situation:

The web app I implemented as a tutorial, works perfectly if I deploy it to full-fledged Tomcat install.

app under tomcat full install

However, if I attempt running it under embedded tomcat7-maven-plugin, I receive "HTTP Status 404 requested resource not available":

app under embedded tomcat7 maven plugin

Since this is the same exact .war file, I am assuming that I am missing some configuration or setting or environment required on the embedded tomcat plugin.

How do I troubleshoot a problem like this?

FWIW, when invoking the app (plus tomcat plugin), Eclipse's Console displays all logging benign, except for the following, which is in red:

[INFO] create webapp with contextPath: Aug 13, 2018 8:24:54 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Aug 13, 2018 8:24:54 AM org.apache.catalina.core.StandardService startInternal INFO: Starting service Tomcat Aug 13, 2018 8:24:54 AM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.47 Aug 13, 2018 8:24:56 AM org.apache.catalina.core.ApplicationContext log INFO: No Spring WebApplicationInitializer types detected on classpath Aug 13, 2018 8:24:56 AM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-8080"]

and this is how I added the tomcat maven plugin to my pom.xml:

  `<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
        <path>/</path>
    </configuration>
  </plugin>`

and this is my project tutorial layout:

project structure

WebViewer
  • 761
  • 7
  • 21
  • 1
    What happens when you change the address in the address bar to `http://localhost:8080/`? Given that you set the path to `/`, and that the documentation of the plugin says that path is "The webapp context path to use for the web application being run.", I would not expect it to be available in /spring-mvc-example". – JB Nizet Aug 13 '18 at 06:22
  • @JBNizet when I change the address in the address bar to `http://localhost:8080/` I receive the same exact 404 message in the browser. – WebViewer Aug 13 '18 at 06:30
  • 2
    Are you sure that Tomcat 7, and especially the embedded Tomcat server, which is quite old, is supported by your version of spring? Why don't you use the latest Spring Boot, which **by default** produces an executable jar starting an embedded Tomcat? – JB Nizet Aug 13 '18 at 06:32
  • @JBNizet Using Spring Boot is indeed my next step in my study process. However, I would like to understand what I was doing wrong so that I have a more solid understanding before I proceed to Spring Boot. I could have just stayed with the full fledged Tomcat install but that would be too easy. :) In the meanwhile I added a screenshot of my project layout. Perhaps that could give a hint about something not in place. – WebViewer Aug 13 '18 at 06:38
  • @WebViewer Could be a [log4j configuration issue](https://stackoverflow.com/a/33473074/1706924)? Note [this solution](https://stackoverflow.com/a/16817018/1706924): *"My log4j wasn't configured to capture my error output. I was throwing configuration errors in the background and once I fixed those I was good to go and my **request mappings** worked fine."* – Very Objective Aug 14 '18 at 05:21

0 Answers0