After deploying WAR for Tomcat docker container always getting 404

I have a grails application that is already running and deploying to AWS through Elastic Beanstalk on Tomcat8 Jre8.

Now I'm trying to deploy it in a multi-docker environment, and I have rather strange behavior.

I use tomcat:8.0-jre8( https://hub.docker.com/r/library/tomcat/ ) as the image for the container, and deploying on this image is pretty simple by putting the war file in <tomcat_home>/webapps. In addition, I map the port 8080to the outside world. So, the related part of the docker layout looks like this:

api:
  image: tomcat:8.0-jre8
  container_name: api
  volumes:
    - ./deployment/api:/usr/local/tomcat/webapps
  external_links:
    - mysql:mysql
  ports:
    - "8080:8080"

Based on the logs, the application is being successfully deployed, and even migratory bases migrations are applied:

21-Nov-2016 07:11:03.671 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /usr/local/tomcat/webapps/priz-0.5.war
21-Nov-2016 07:12:12.496 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars 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.
2016-11-21T07:13:38.397268676Z 
Configuring Spring Security Core ...
... finished configuring Spring Security Core
2016-11-21T07:13:40.215275700Z 
2016-11-21T07:13:40.777432843Z 
Configuring Spring Security REST 2.0.0.M2...
... finished configuring Spring Security REST
2016-11-21T07:13:41.515464956Z 
INFO 11/21/16 7:14 AM: liquibase: Successfully acquired change log lock
INFO 11/21/16 7:14 AM: liquibase: Reading from priz.DATABASECHANGELOG
INFO 11/21/16 7:14 AM: liquibase: Successfully released change log lock
21-Nov-2016 07:15:09.019 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /usr/local/tomcat/webapps/priz-0.5.war has finished in 245,345 ms
21-Nov-2016 07:15:09.026 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-apr-8080"]
21-Nov-2016 07:15:09.036 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-apr-8009"]
21-Nov-2016 07:15:09.038 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 245425 ms

, , .

, , :

==> ./logs/localhost_access_log.2016-11-21.txt <==
172.17.0.1 - - [21/Nov/2016:07:15:09 +0000] "GET / HTTP/1.1" 404 -
172.17.0.1 - - [21/Nov/2016:07:15:09 +0000] "GET / HTTP/1.1" 404 -
172.17.0.1 - - [21/Nov/2016:07:16:45 +0000] "GET / HTTP/1.1" 404 -
172.17.0.1 - - [21/Nov/2016:07:17:01 +0000] "GET / HTTP/1.1" 404 -
172.17.0.1 - - [21/Nov/2016:07:17:07 +0000] "GET /index HTTP/1.1" 404 -
172.17.0.1 - - [21/Nov/2016:07:28:24 +0000] "GET /api/user/register HTTP/1.1" 404 -
172.17.0.1 - - [21/Nov/2016:07:28:46 +0000] "POST /api/user/register HTTP/1.1" 404 -

, ? ? .

, tomcat, , AWS EBS. , nginx, .

+4
1

priz-0.5.war. , priz-0.5. , , http://localhost:8080/priz-0.5

http://localhost:8080/, war-File ROOT.war

+2

Source: https://habr.com/ru/post/1661415/


All Articles