I'm trying to dockerize my Spring Boot Application.
Here my docker-compose file
version: '3.8'
services:
mysql:
image: mysql:latest
ports:
- 3306:3306
hostname: mysql
environment:
MYSQL_DATABASE: ######
MYSQL_ROOT_PASSWORD: ######
MYSQL_USER: ######
MYSQL_PASSWORD: ######
volumes:
- ./mysqldata:/var/lib/mysql
backend:
build:
context: .
dockerfile: dockerfile
ports:
- 8080:8080
depends_on:
- mysql
My dockerfile
FROM maven:3.8.4-eclipse-temurin-17-alpine AS maven
RUN mkdir -p /build
COPY pom.xml /build
COPY src /build/src
WORKDIR /build
RUN mvn -B dependency:resolve dependency:resolve-plugins
RUN mvn -DskipTests clean package
FROM tomcat:jdk8-corretto
EXPOSE 8080
RUN rm -rf /usr/local/tomcat/webapps/ROOT
COPY --from=maven /build/target/promogen.war /usr/local/tomcat/webapps/ROOT.war
CMD ["catalina.sh","run"]
Inspecting backend I can see that my war is deployed. In logs I can see
2021 15:10:57.180 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/usr/local/tomcat/webapps/ROOT.war]
Inside /usr/local/tomcat/webapps dir I can see that ROOT.war and ROOT folder exists.
I'm starting docker with the following command:
docker-compose up --build
When I access localhost:8080 Tomcat says Http Status 404 - Not Found.
Here logs after executing docker-compose up:
➜ PromogenServer git:(master) ✗ docker-compose up --build
Building backend
[+] Building 3.3s (16/16) FINISHED
=> [internal] load build definition from dockerfile 0.4s
=> => transferring dockerfile: 37B 0.0s
=> [internal] load .dockerignore 0.4s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/tomcat:jdk8-corretto 1.8s
=> [internal] load metadata for docker.io/library/maven:3.8.4-eclipse-temurin-17-alpine 1.7s
=> [stage-1 1/3] FROM docker.io/library/tomcat:jdk8-corretto#sha256:e78680bd172c7388fb9ed123423f671c2815560412ad2df8cc73f79b7922890e 0.0s
=> [internal] load build context 0.3s
=> => transferring context: 37.39kB 0.0s
=> [maven 1/7] FROM docker.io/library/maven:3.8.4-eclipse-temurin-17-alpine#sha256:d7d5ef47f898d0ef33fb472dc63fcc67face715e337efd1728107fc9e195388d 0.0s
=> CACHED [stage-1 2/3] RUN rm -rf /usr/local/tomcat/webapps/ROOT 0.0s
=> CACHED [maven 2/7] RUN mkdir -p /build 0.0s
=> CACHED [maven 3/7] COPY pom.xml /build 0.0s
=> CACHED [maven 4/7] COPY src /build/src 0.0s
=> CACHED [maven 5/7] WORKDIR /build 0.0s
=> CACHED [maven 6/7] RUN mvn -B dependency:resolve dependency:resolve-plugins 0.0s
=> CACHED [maven 7/7] RUN mvn -DskipTests clean package 0.0s
=> CACHED [stage-1 3/3] COPY --from=maven /build/target/promogen.war /usr/local/tomcat/webapps/ROOT.war 0.0s
=> exporting to image 0.3s
=> => exporting layers 0.0s
=> => writing image sha256:6a591e6448a22aefbd44a2c5b62940acdb46b581005de8e5fe940113c6de7acf 0.1s
=> => naming to docker.io/library/promogenserver_backend 0.0s
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
Starting promogenserver_mysql_1 ... done
Starting promogenserver_backend_1 ... done
Attaching to promogenserver_mysql_1, promogenserver_backend_1
mysql_1 | 2021-12-20 15:19:38+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started.
mysql_1 | 2021-12-20 15:19:39+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
mysql_1 | 2021-12-20 15:19:39+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started.
mysql_1 | 2021-12-20T15:19:40.133565Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.27) starting as process 1
mysql_1 | 2021-12-20T15:19:40.158480Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
mysql_1 | 2021-12-20T15:19:40.214360Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
backend_1 | 20-Dec-2021 15:19:42.185 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/10.0.14
backend_1 | 20-Dec-2021 15:19:42.192 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Dec 2 2021 22:01:36 UTC
backend_1 | 20-Dec-2021 15:19:42.193 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 10.0.14.0
backend_1 | 20-Dec-2021 15:19:42.193 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
backend_1 | 20-Dec-2021 15:19:42.193 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 5.10.47-linuxkit
backend_1 | 20-Dec-2021 15:19:42.194 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
backend_1 | 20-Dec-2021 15:19:42.194 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/lib/jvm/java-1.8.0-amazon-corretto/jre
backend_1 | 20-Dec-2021 15:19:42.195 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_312-b07
backend_1 | 20-Dec-2021 15:19:42.195 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Amazon.com Inc.
backend_1 | 20-Dec-2021 15:19:42.196 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/local/tomcat
backend_1 | 20-Dec-2021 15:19:42.196 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/local/tomcat
backend_1 | 20-Dec-2021 15:19:42.209 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
backend_1 | 20-Dec-2021 15:19:42.210 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
backend_1 | 20-Dec-2021 15:19:42.211 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
backend_1 | 20-Dec-2021 15:19:42.211 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
backend_1 | 20-Dec-2021 15:19:42.212 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
backend_1 | 20-Dec-2021 15:19:42.212 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
backend_1 | 20-Dec-2021 15:19:42.213 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat
backend_1 | 20-Dec-2021 15:19:42.213 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat
backend_1 | 20-Dec-2021 15:19:42.213 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
backend_1 | 20-Dec-2021 15:19:42.234 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded Apache Tomcat Native library [1.2.31] using APR version [1.7.0].
backend_1 | 20-Dec-2021 15:19:42.234 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true], UDS [true].
backend_1 | 20-Dec-2021 15:19:42.248 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.1g FIPS 21 Apr 2020]
backend_1 | 20-Dec-2021 15:19:43.623 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
backend_1 | 20-Dec-2021 15:19:43.690 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [2225] milliseconds
backend_1 | 20-Dec-2021 15:19:43.791 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
backend_1 | 20-Dec-2021 15:19:43.791 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/10.0.14]
backend_1 | 20-Dec-2021 15:19:43.873 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/usr/local/tomcat/webapps/ROOT.war]
mysql_1 | 2021-12-20T15:19:45.785479Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
mysql_1 | 2021-12-20T15:19:47.572660Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...
mysql_1 | 2021-12-20T15:19:47.610076Z 0 [System] [MY-010232] [Server] XA crash recovery finished.
mysql_1 | 2021-12-20T15:19:48.760762Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
mysql_1 | 2021-12-20T15:19:48.760872Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
mysql_1 | 2021-12-20T15:19:48.778784Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
mysql_1 | 2021-12-20T15:19:48.779013Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
mysql_1 | 2021-12-20T15:19:48.843650Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
mysql_1 | 2021-12-20T15:19:49.192746Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
mysql_1 | 2021-12-20T15:19:49.193439Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.27' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
backend_1 | 20-Dec-2021 15:19:51.902 INFO [main] 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.
backend_1 | 20-Dec-2021 15:19:52.042 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/usr/local/tomcat/webapps/ROOT.war] has finished in [8,166] ms
backend_1 | 20-Dec-2021 15:19:52.054 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
backend_1 | 20-Dec-2021 15:19:52.081 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [8390] milliseconds
EDIT 1:
I changed tomcat image to
tomcat:8.5-jdk17-corretto
And now Spring application starts but complains about mysql connection:
Caused by: java.net.ConnectException: Connection refused
EDIT 2:
I solved it. I changed my application.properties from
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/promogen
to
spring.datasource.url=jdbc:mysql://mysql:3306/promogen
Where mysql is the String I used in services in docker-compose.yml file
Finally I Solved it.
Look edits.
Related
Spring boot not running on external tomcat
I have previously worked with Spring Boot on Java 1.8 and Tomcat 8.
I recently started a new project where I upgraded to Java 17, Tomcat 10.
I'm trying to deploy as a war to run in an external tomcat, but it doesn't work.
I ran and deployed the project without any problems in the existing Java 1.8 and Tomcat 8 in the actual production environment.
I think you know how to deploy spring boot as war.
I have read the Spring Boot official documentation at the link below.
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto.traditional-deployment.war
My project's pom.xml has the settings below applied.
<packaging>war</packaging>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
And
<configuration>
<mainClass>mypackage.SpringBootCoreApplication</mainClass>
</configuration>
And SpringBootApplication is also configured.
#SpringBootApplication
public class SpringBootCoreApplication extends SpringBootServletInitializer {
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SpringBootCoreApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(SpringBootCoreApplication.class, args);
}
}
Now, I ran Tomcat to deploy as war, and the following log came out.
31-Oct-2022 19:52:47.382 INFO [main] 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.
31-Oct-2022 19:52:43.818 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/usr/local/tomcat/webapps/ROOT.war]
31-Oct-2022 19:52:43.780 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/10.1.1]
31-Oct-2022 19:52:43.779 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
31-Oct-2022 19:52:43.686 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [961] milliseconds
31-Oct-2022 19:52:43.618 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
31-Oct-2022 19:52:43.069 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 3.0.2 15 Mar 2022]
31-Oct-2022 19:52:43.063 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded Apache Tomcat Native library [2.0.1] using APR version [1.7.0].
31-Oct-2022 19:52:43.059 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
31-Oct-2022 19:52:43.059 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat
31-Oct-2022 19:52:43.059 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat
31-Oct-2022 19:52:43.058 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
31-Oct-2022 19:52:43.058 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
31-Oct-2022 19:52:43.058 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
31-Oct-2022 19:52:43.058 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
31-Oct-2022 19:52:43.058 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
31-Oct-2022 19:52:43.058 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
31-Oct-2022 19:52:43.058 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.util.concurrent=ALL-UNNAMED
31-Oct-2022 19:52:43.057 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.util=ALL-UNNAMED
31-Oct-2022 19:52:43.057 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
31-Oct-2022 19:52:43.057 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
31-Oct-2022 19:52:43.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/local/tomcat
31-Oct-2022 19:52:43.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/local/tomcat
31-Oct-2022 19:52:43.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Eclipse Adoptium
31-Oct-2022 19:52:43.032 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 17.0.4.1+1
31-Oct-2022 19:52:43.032 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /opt/java/openjdk
31-Oct-2022 19:52:43.031 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
31-Oct-2022 19:52:43.031 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 4.4.180+
31-Oct-2022 19:52:43.031 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
31-Oct-2022 19:52:43.030 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 10.1.1.0
31-Oct-2022 19:52:43.030 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Oct 3 2022 12:42:14 UTC
31-Oct-2022 19:52:43.017 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/10.1.1
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
Using CATALINA_OPTS:
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using JRE_HOME: /opt/java/openjdk
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_BASE: /usr/local/tomcat
31-Oct-2022 19:52:41.636 INFO [Thread-1] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8080"]
31-Oct-2022 19:52:41.627 INFO [Thread-1] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8080"]
31-Oct-2022 19:52:41.612 INFO [Thread-1] org.apache.catalina.core.StandardService.stopInternal Stopping service [Catalina]
31-Oct-2022 19:52:41.608 INFO [Thread-1] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8080"]
31-Oct-2022 19:48:16.236 INFO [Catalina-utility-2] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/usr/local/tomcat/webapps/ROOT.war] has finished in [4,098] ms
Spring Boot as I remember it doesn't end up with logs like this. The project is running but spring boot doesn't seem to be running.
The log shows that it was successful, but it doesn't actually connect.
I read the official Spring Boot documentation, many questions/answers, and blog posts, but I couldn't solve it.
I don't know what I have configured wrong. please help me
I found the reason.
I am writing this for those of you who are struggling for the same reason.
Upgrading to Tomcat 10 was a problem.
Tomcat10 is an implementation of the JakartaEE specification that is not currently supported.
Spring (and Spring Boot) currently only supports JavaEE, not JakartaEE.
Jakarta EE support is planned for Spring6 and SpringBoot3 expected later this year.
There are two options.
Deploy the war to the webapps-javaee directory instead of the webapps directory. Tomcat uses a conversion tool to convert automatically. I solved the same problem with this.
Using Tomcat 9 with Java EE support
Deploying the war to the webapps-javaee directory instead of the webapps directory worked for me.
Deploying the war to the webapps-javaee directory instead of the webapps directory worked. Therefore the problem with deplyment on Tomcat 10 worked!!!
Hey folks I have a problem: I need to deploy a Spring Boot App with docker compose but after docker has deployed the contents of the Folder Spring Boot does not start to boot.
The thing is this has worked before but now it won't so I think it has something to do with my docker configuration. I can't really read something out of the log, please help me.
Here are the outputs of docker-compose logs:
root#h2916245:/home/carta# docker-compose up
Creating network "carta_default" with the default driver
Creating carta_cartadb_1 ... done
Creating carta_frontend_1 ... done
Attaching to carta_cartadb_1, carta_frontend_1
cartadb_1 | ********************************************************************************
cartadb_1 | WARNING: POSTGRES_HOST_AUTH_METHOD has been set to "trust". This will allow
cartadb_1 | anyone with access to the Postgres port to access your database without
cartadb_1 | a password, even if POSTGRES_PASSWORD is set. See PostgreSQL
cartadb_1 | documentation about "trust":
cartadb_1 | https://www.postgresql.org/docs/current/auth-trust.html
cartadb_1 | In Docker's default configuration, this is effectively any other
cartadb_1 | container on the same system.
cartadb_1 |
cartadb_1 | It is not recommended to use POSTGRES_HOST_AUTH_METHOD=trust. Replace
cartadb_1 | it with "-e POSTGRES_PASSWORD=password" instead to set a password in
cartadb_1 | "docker run".
cartadb_1 | ********************************************************************************
cartadb_1 | The files belonging to this database system will be owned by user "postgres".
cartadb_1 | This user must also own the server process.
cartadb_1 |
cartadb_1 | The database cluster will be initialized with locale "en_US.utf8".
cartadb_1 | The default database encoding has accordingly been set to "UTF8".
cartadb_1 | The default text search configuration will be set to "english".
cartadb_1 |
cartadb_1 | Data page checksums are disabled.
cartadb_1 |
cartadb_1 | fixing permissions on existing directory /var/lib/postgresql/data ... ok
cartadb_1 | creating subdirectories ... ok
cartadb_1 | selecting dynamic shared memory implementation ... posix
cartadb_1 | selecting default max_connections ... 100
cartadb_1 | selecting default shared_buffers ... 128MB
cartadb_1 | selecting default time zone ... Etc/UTC
cartadb_1 | creating configuration files ... ok
cartadb_1 | running bootstrap script ... ok
frontend_1 | NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
cartadb_1 | performing post-bootstrap initialization ... ok
cartadb_1 | syncing data to disk ... initdb: warning: enabling "trust" authentication for local connections
cartadb_1 | You can change this by editing pg_hba.conf or using the option -A, or
cartadb_1 | --auth-local and --auth-host, the next time you run initdb.
cartadb_1 | ok
cartadb_1 |
cartadb_1 |
cartadb_1 | Success. You can now start the database server using:
cartadb_1 |
cartadb_1 | pg_ctl -D /var/lib/postgresql/data -l logfile start
cartadb_1 |
cartadb_1 | waiting for server to start....2021-10-06 18:18:23.390 UTC [50] LOG: starting PostgreSQL 14.0 (Debian 14.0-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
cartadb_1 | 2021-10-06 18:18:23.390 UTC [50] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
cartadb_1 | 2021-10-06 18:18:23.394 UTC [51] LOG: database system was shut down at 2021-10-06 18:18:23 UTC
cartadb_1 | 2021-10-06 18:18:23.401 UTC [50] LOG: database system is ready to accept connections
cartadb_1 | done
cartadb_1 | server started
cartadb_1 | CREATE DATABASE
cartadb_1 |
cartadb_1 |
cartadb_1 | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
cartadb_1 |
cartadb_1 | 2021-10-06 18:18:23.735 UTC [50] LOG: received fast shutdown request
cartadb_1 | 2021-10-06 18:18:23.735 UTC [50] LOG: aborting any active transactions
cartadb_1 | waiting for server to shut down....2021-10-06 18:18:23.740 UTC [50] LOG: background worker "logical replication launcher" (PID 57) exited with exit code 1
cartadb_1 | 2021-10-06 18:18:23.740 UTC [52] LOG: shutting down
cartadb_1 | 2021-10-06 18:18:23.756 UTC [50] LOG: database system is shut down
cartadb_1 | done
cartadb_1 | server stopped
cartadb_1 |
cartadb_1 | PostgreSQL init process complete; ready for start up.
cartadb_1 |
frontend_1 | 06-Oct-2021 20:18:23.846 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/10.0.11
cartadb_1 | 2021-10-06 18:18:23.886 UTC [1] LOG: starting PostgreSQL 14.0 (Debian 14.0-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
cartadb_1 | 2021-10-06 18:18:23.887 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
cartadb_1 | 2021-10-06 18:18:23.888 UTC [1] LOG: listening on IPv6 address "::", port 5432
cartadb_1 | 2021-10-06 18:18:23.888 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
cartadb_1 | 2021-10-06 18:18:23.891 UTC [64] LOG: database system was shut down at 2021-10-06 18:18:23 UTC
frontend_1 | 06-Oct-2021 20:18:23.890 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Sep 6 2021 16:22:12 UTC
frontend_1 | 06-Oct-2021 20:18:23.891 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 10.0.11.0
frontend_1 | 06-Oct-2021 20:18:23.891 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
frontend_1 | 06-Oct-2021 20:18:23.891 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 5.4.0
frontend_1 | 06-Oct-2021 20:18:23.891 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
frontend_1 | 06-Oct-2021 20:18:23.892 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/local/openjdk-11
frontend_1 | 06-Oct-2021 20:18:23.892 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 11.0.12+7
frontend_1 | 06-Oct-2021 20:18:23.892 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
frontend_1 | 06-Oct-2021 20:18:23.893 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/local/tomcat
frontend_1 | 06-Oct-2021 20:18:23.893 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/local/tomcat
cartadb_1 | 2021-10-06 18:18:23.899 UTC [1] LOG: database system is ready to accept connections
frontend_1 | 06-Oct-2021 20:18:23.915 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
frontend_1 | 06-Oct-2021 20:18:23.921 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
frontend_1 | 06-Oct-2021 20:18:23.921 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.util=ALL-UNNAMED
frontend_1 | 06-Oct-2021 20:18:23.922 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.util.concurrent=ALL-UNNAMED
frontend_1 | 06-Oct-2021 20:18:23.922 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
frontend_1 | 06-Oct-2021 20:18:23.922 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
frontend_1 | 06-Oct-2021 20:18:23.923 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
frontend_1 | 06-Oct-2021 20:18:23.923 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
frontend_1 | 06-Oct-2021 20:18:23.923 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
frontend_1 | 06-Oct-2021 20:18:23.924 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
frontend_1 | 06-Oct-2021 20:18:23.930 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
frontend_1 | 06-Oct-2021 20:18:23.930 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat
frontend_1 | 06-Oct-2021 20:18:23.930 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat
frontend_1 | 06-Oct-2021 20:18:23.931 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
frontend_1 | 06-Oct-2021 20:18:23.942 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded Apache Tomcat Native library [1.2.31] using APR version [1.7.0].
frontend_1 | 06-Oct-2021 20:18:23.943 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true], UDS [true].
frontend_1 | 06-Oct-2021 20:18:23.956 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.1k 25 Mar 2021]
frontend_1 | 06-Oct-2021 20:18:24.736 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
frontend_1 | 06-Oct-2021 20:18:24.812 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [1629] milliseconds
frontend_1 | 06-Oct-2021 20:18:24.949 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
frontend_1 | 06-Oct-2021 20:18:24.950 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/10.0.11]
frontend_1 | 06-Oct-2021 20:18:24.963 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/carta-1.3.war]
frontend_1 | 06-Oct-2021 20:18:25.555 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/carta-1.3.war] has finished in [591] ms
frontend_1 | 06-Oct-2021 20:18:25.560 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
frontend_1 | 06-Oct-2021 20:18:25.587 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [765] milliseconds
Here is my docker-compose file:
version: '3'
services:
cartadb:
image: postgres
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=carta
- POSTGRES_HOST_AUTH_METHOD=trust
ports:
- "5432:5432"
frontend:
depends_on:
- cartadb
image: tomcat
ports:
- "80:8080"
volumes:
- ./carta-1.3.war:/usr/local/tomcat/webapps/carta-1.3.war
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=carta
- POSTGRES_HOST_AUTH_METHOD=trust
and here is my Main Class:
#SpringBootApplication
public class CartaApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(CartaApplication.class, args);
}
}
I use an image of tomcat-9 for adoptopenjdk. The docker-compose file config is:
tomcat-server:
image: tomcat:9.0.45-jdk11-adoptopenjdk-hotspot
ports:
- "8081:8080"
volumes:
- /webapp/target/app.war:/usr/local/tomcat/webapps/app.war
environment:
- EUREKA.CLIENT.SERVICEURL.DEFAULTZONE=http://naming-server:8761/eureka
- SPRING.REDIS.HOST=redis-cache-server
When I start the tomcat using docker-compse file, the logs shows that it wont start with the port mentioned 8081. It is still started on 8080. See the logs for details.
tomcat-server_1 | NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/9.0.45
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log Server built: Mar 30 2021 10:29:04 UTC
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log Server version number: 9.0.45.0
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log OS Version: 5.4.72-microsoft-standard-WSL2
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log Java Home: /opt/java/openjdk
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 11.0.10+9
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: AdoptOpenJDK
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/local/tomcat
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/local/tomcat
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.util=ALL-UNNAMED
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.util.concurrent=ALL-UNNAMED
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat
tomcat-server_1 | org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
tomcat-server_1 | org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded Apache Tomcat Native library [1.2.27] using APR version [1.6.5].
tomcat-server_1 | org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
tomcat-server_1 | org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
tomcat-server_1 | org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.1f 31 Mar 2020]
tomcat-server_1 | org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
tomcat-server_1 | org.apache.catalina.startup.Catalina.load Server initialization in [745] milliseconds
tomcat-server_1 | org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
tomcat-server_1 | org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.45]
tomcat-server_1 | org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/app.war]
tomcat-server_1 | org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/app.war] has finished in [361] ms
tomcat-server_1 | org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
tomcat-server_1 | org.apache.catalina.startup.Catalina.start Server startup in [463] milliseconds
I tried few things but not having any success.
Am I missing something?
Thanks,
Atul
I am able to solve the issue. Solution is to create a separate docker file to create a tomcat image and used it in docker composer file.
The problem is, even the war is copied to webapps folder of tomcat it wont deploy. See the logs for reference:
tomcat-server_1 | org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/app.war]
tomcat-server_1 | org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/app.war] has finished in [361] ms
tomcat-server_1 | org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
As image tomcat:9.0.45-jdk11-adoptopenjdk-hotspot contains the command ['catalina.sh', 'run'], as soon as the docker-compose command executes, the tomcat started and at the end of the starting process it copied war file to the tomcat location. So it wont deploy the war file.
This is the reason what I have found. (Please clear me if I am wrong ot I missed anything).
So final solution is like this(which worked for me):
Create a docker file. (e.g.- Dockerfile_web)
#Take the Tomcat-9 image which supports AdoptOpenJDK
FROM tomcat:9.0.45-jdk11-adoptopenjdk-hotspot
#Copy the WAR file to tomcat
ADD ./webapp/target/attest.war /usr/local/tomcat/webapps/attest.war
#Allow execution (Not required, just added)
CMD chmod +x /usr/local/tomcat/bin/catalina.sh
Next is to add this file reference in docker-compose file.
web-app:
build:
context: .
dockerfile: Dockerfile_Web
ports:
- "8081:8080"
networks:
- app-network
command: ['catalina.sh', 'run']
environment:
- EUREKA.CLIENT.SERVICEURL.DEFAULTZONE=http://naming-server:8761/eureka
- SPRING.REDIS.HOST=redis-cache-server
Once I run this with docker-compose up it started and working as expexcted.
PROBLEM
Stop->Start of tomcat 8 via windows services fails as tomcat shutdown somehow keeps listening on port 8080 in an "invisible" state and tomcat fails to startup as it cannot bind to port 8080
BACKGROUND
One of our build scripts, which restarts tomcat windows service, started to fail a few weeks back. Coming back from holidays I am now trying to resolve the issue. As far as I can see no changes has been done to the tomcat configuration.
REPRODUCING THE PROBLEM
Tomcat shuts down clean (via windows service stop) without errors:
10-Aug-2018 19:30:56.860 INFO [Thread-4] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-apr-8080"]
10-Aug-2018 19:30:56.860 INFO [Thread-4] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-apr-8009"]
10-Aug-2018 19:30:56.923 INFO [Thread-4] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina
10-Aug-2018 19:30:56.985 INFO [Thread-4] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-apr-8009"]
All tomcat ports are free:
C:\Windows\system32>netstat -abno | find "80"
TCP 0.0.0.0:49160 0.0.0.0:0 LISTENING 1180
TCP [::]:49160 [::]:0 LISTENING 1180
UDP 0.0.0.0:123 *:* 980
UDP [::]:123 *:* 980
As we can see the default tomcat port 8080 is free (not present in list)
windows report the "apache tomcat" service to be stopped.
Task manager has no process for "tomcat8w.exe"
I start the tomcat by starting the windows service and get the following in catalina log:
10-Aug-2018 19:36:50.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.32
10-Aug-2018 19:36:50.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Feb 2 2016 19:34:53 UTC
10-Aug-2018 19:36:50.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.32.0
10-Aug-2018 19:36:50.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows Server 2012 R2
10-Aug-2018 19:36:50.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 6.3
10-Aug-2018 19:36:50.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
10-Aug-2018 19:36:50.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: d:\ng\jre
10-Aug-2018 19:36:50.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_73-b02
10-Aug-2018 19:36:50.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
10-Aug-2018 19:36:50.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: D:\ng\tomcat
10-Aug-2018 19:36:50.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: D:\ng\tomcat
10-Aug-2018 19:36:50.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=D:\ng\tomcat
10-Aug-2018 19:36:50.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=D:\ng\tomcat
10-Aug-2018 19:36:50.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=D:\ng\tomcat\endorsed
10-Aug-2018 19:36:50.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=D:\ng\tomcat\temp
10-Aug-2018 19:36:50.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManage
10-Aug-2018 19:36:50.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=D:\ng\tomcat\conf\logging.proper
10-Aug-2018 19:36:50.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: exit
10-Aug-2018 19:36:50.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms1024m
10-Aug-2018 19:36:50.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx6144m
10-Aug-2018 19:36:50.033 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library 1.2.4 using APR version 1.5.1.
10-Aug-2018 19:36:50.033 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [
10-Aug-2018 19:36:50.549 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized (OpenSSL 1.0.2e 3 Dec 2015)
10-Aug-2018 19:36:50.674 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-apr-8080"]
10-Aug-2018 19:36:50.674 SEVERE [main] org.apache.coyote.AbstractProtocol.init Failed to initialize end point associated with ProtocolHandler ["http-apr-8080"]
java.lang.Exception: Socket bind failed: [730048] Only one usage of each socket address (protocol/network address/port) is normally permitted.
at org.apache.tomcat.util.net.AprEndpoint.bind(AprEndpoint.java:471)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:742)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:458)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:960)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:568)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:851)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.startup.Catalina.load(Catalina.java:580)
at org.apache.catalina.startup.Catalina.load(Catalina.java:603)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:310)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:484)
10-Aug-2018 19:36:50.689 SEVERE [main] org.apache.catalina.core.StandardService.initInternal Failed to initialize connector [Connector[HTTP/1.1-8080]]
org.apache.catalina.LifecycleException: Failed to initialize component [Connector[HTTP/1.1-8080]]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:568)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:851)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.startup.Catalina.load(Catalina.java:580)
at org.apache.catalina.startup.Catalina.load(Catalina.java:603)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:310)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:484)
Caused by: org.apache.catalina.LifecycleException: Protocol handler initialization failed
at org.apache.catalina.connector.Connector.initInternal(Connector.java:962)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
... 12 more
Caused by: java.lang.Exception: Socket bind failed: [730048] Only one usage of each socket address (protocol/network address/port) is normally permitted.
at org.apache.tomcat.util.net.AprEndpoint.bind(AprEndpoint.java:471)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:742)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:458)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:960)
... 13 more
10-Aug-2018 19:36:50.689 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-apr-8009"]
10-Aug-2018 19:36:50.689 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 971 ms
after which it starts to deploy the applications. After startup I run:
C:\Windows\system32>netstat -abno | find "80"
TCP 0.0.0.0:8009 0.0.0.0:0 LISTENING 5040
TCP 0.0.0.0:49160 0.0.0.0:0 LISTENING 1180
TCP 127.0.0.1:8005 0.0.0.0:0 LISTENING 5040
TCP 127.0.0.1:55979 127.0.0.1:55980 ESTABLISHED 5040
TCP 127.0.0.1:55980 127.0.0.1:55979 ESTABLISHED 5040
TCP 172.17.104.53:56029 172.17.10.154:8014 CLOSE_WAIT 1488
TCP [::]:49160 [::]:0 LISTENING 1180
UDP 0.0.0.0:123 *:* 980
UDP [::]:123 *:* 980
I can see port 8009 is bound to PID 5040 which in taskmanager is "tomcat8.exe" but as you can see the port 8080 was free, but is not bound due to error:
10-Aug-2018 19:36:50.674 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-apr-8080"]
10-Aug-2018 19:36:50.674 SEVERE [main] org.apache.coyote.AbstractProtocol.init Failed to initialize end point associated with ProtocolHandler ["http-apr-8080"]
java.lang.Exception: Socket bind failed: [730048] Only one usage of each socket address (protocol/network address/port) is normally permitted.
So at this point the build script has executed successfully, windows is reporting the apache tomcat service to be running, but tomcat has not been bound to port 8080 and thus is not receiving any new requests.
WORKAROUND
If I restart Windows (the server), then tomcat service will startup without problems and tomcat will listen on port 8080.
NEXT STEP
What is the reason that tomcat cannot bind to a free port 8080 ?
Or what could stop windows displaying who/what is blocking port 8080 ?
How can a previous tomcat instance block port 8080, but windows does not show any running tomcat instances?
I have deployed my .war file of a spring mvc project in tomcat server but I'm getting an error 404 saying that the resource is not available
All the other example applications on tomcat server is running except for mine. I have seen the other similar questions here and I've followed everyone of them and still getting error.
I have mapped the project as /advocatoree/dashboard
Can someone please help me with it?
This is my log:
10-Jan-2015 19:07:54.909 SEVERE [main] org.apache.catalina.startup.Catalina.stopServer Could not contact localhost:8005. Tomcat may not be running.
10-Jan-2015 19:08:00.140 SEVERE [main] org.apache.catalina.startup.Catalina.stopServer Could not contact localhost:8005. Tomcat may not be running.
10-Jan-2015 19:08:41.520 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.15
10-Jan-2015 19:08:41.521 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Nov 2 2014 19:25:20 UTC
10-Jan-2015 19:08:41.522 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.15.0
10-Jan-2015 19:08:41.522 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 7
10-Jan-2015 19:08:41.522 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 6.1
10-Jan-2015 19:08:41.523 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: x86
10-Jan-2015 19:08:41.523 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JAVA_HOME: C:\Program Files\Java\jdk1.7.0_25\jre
10-Jan-2015 19:08:41.523 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.7.0_25-b17
10-Jan-2015 19:08:41.523 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
10-Jan-2015 19:08:41.524 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\tomcat
10-Jan-2015 19:08:41.524 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: C:\tomcat
10-Jan-2015 19:08:41.525 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\tomcat\conf\logging.properties
10-Jan-2015 19:08:41.525 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
10-Jan-2015 19:08:41.526 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=C:\tomcat\endorsed
10-Jan-2015 19:08:41.526 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\tomcat
10-Jan-2015 19:08:41.527 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:\tomcat
10-Jan-2015 19:08:41.527 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\tomcat\temp
10-Jan-2015 19:08:41.528 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library 1.1.32 using APR version 1.5.1.
10-Jan-2015 19:08:41.529 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
10-Jan-2015 19:08:42.631 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized (OpenSSL 1.0.1j 15 Oct 2014)
10-Jan-2015 19:08:43.038 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-apr-8080"]
10-Jan-2015 19:08:43.066 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-apr-8009"]
10-Jan-2015 19:08:43.083 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 2295 ms
10-Jan-2015 19:08:43.136 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
10-Jan-2015 19:08:43.137 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.15
10-Jan-2015 19:08:43.161 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\tomcat\webapps\docs
10-Jan-2015 19:08:43.626 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\tomcat\webapps\docs has finished in 464 ms
10-Jan-2015 19:08:43.626 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\tomcat\webapps\examples
10-Jan-2015 19:08:44.935 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\tomcat\webapps\examples has finished in 1,309 ms
10-Jan-2015 19:08:44.936 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\tomcat\webapps\host-manager
10-Jan-2015 19:08:44.984 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\tomcat\webapps\host-manager has finished in 48 ms
10-Jan-2015 19:08:44.985 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\tomcat\webapps\manager
10-Jan-2015 19:08:45.066 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\tomcat\webapps\manager has finished in 81 ms
10-Jan-2015 19:08:45.066 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\tomcat\webapps\ROOT
10-Jan-2015 19:08:45.161 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\tomcat\webapps\ROOT has finished in 94 ms
10-Jan-2015 19:08:45.168 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-apr-8080"]
10-Jan-2015 19:08:45.177 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-apr-8009"]
10-Jan-2015 19:08:45.179 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 2095 ms
10-Jan-2015 19:11:26.206 INFO [main] org.apache.catalina.core.StandardServer.await A valid shutdown command was received via the shutdown port. Stopping the Server instance.
10-Jan-2015 19:11:26.208 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-apr-8080"]
10-Jan-2015 19:11:26.266 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-apr-8009"]
10-Jan-2015 19:11:26.319 INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina
10-Jan-2015 19:11:26.368 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-apr-8080"]
10-Jan-2015 19:11:26.421 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-apr-8009"]
10-Jan-2015 19:11:26.471 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-apr-8080"]
10-Jan-2015 19:11:26.472 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-apr-8009"]
10-Jan-2015 19:11:29.674 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.15
10-Jan-2015 19:11:29.675 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Nov 2 2014 19:25:20 UTC
10-Jan-2015 19:11:29.676 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.15.0
10-Jan-2015 19:11:29.676 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 7
10-Jan-2015 19:11:29.676 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 6.1
10-Jan-2015 19:11:29.677 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: x86
10-Jan-2015 19:11:29.677 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JAVA_HOME: C:\Program Files\Java\jdk1.7.0_25\jre
10-Jan-2015 19:11:29.677 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.7.0_25-b17
10-Jan-2015 19:11:29.677 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
10-Jan-2015 19:11:29.678 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\tomcat
10-Jan-2015 19:11:29.678 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: C:\tomcat
10-Jan-2015 19:11:29.678 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\tomcat\conf\logging.properties
10-Jan-2015 19:11:29.679 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
10-Jan-2015 19:11:29.680 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=C:\tomcat\endorsed
10-Jan-2015 19:11:29.682 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\tomcat
10-Jan-2015 19:11:29.682 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:\tomcat
10-Jan-2015 19:11:29.683 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\tomcat\temp
10-Jan-2015 19:11:29.684 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library 1.1.32 using APR version 1.5.1.
10-Jan-2015 19:11:29.684 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
10-Jan-2015 19:11:30.776 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized (OpenSSL 1.0.1j 15 Oct 2014)
10-Jan-2015 19:11:30.943 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-apr-8080"]
10-Jan-2015 19:11:30.968 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-apr-8009"]
10-Jan-2015 19:11:30.984 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1783 ms
10-Jan-2015 19:11:31.018 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
10-Jan-2015 19:11:31.018 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.15
10-Jan-2015 19:11:31.033 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\tomcat\webapps\docs
10-Jan-2015 19:11:31.394 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\tomcat\webapps\docs has finished in 361 ms
10-Jan-2015 19:11:31.395 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\tomcat\webapps\examples
10-Jan-2015 19:11:32.041 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\tomcat\webapps\examples has finished in 645 ms
10-Jan-2015 19:11:32.042 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\tomcat\webapps\host-manager
10-Jan-2015 19:11:32.082 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\tomcat\webapps\host-manager has finished in 40 ms
10-Jan-2015 19:11:32.083 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\tomcat\webapps\manager
10-Jan-2015 19:11:32.150 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\tomcat\webapps\manager has finished in 67 ms
10-Jan-2015 19:11:32.151 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\tomcat\webapps\ROOT
10-Jan-2015 19:11:32.224 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\tomcat\webapps\ROOT has finished in 73 ms
10-Jan-2015 19:11:32.230 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-apr-8080"]
10-Jan-2015 19:11:32.240 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-apr-8009"]
10-Jan-2015 19:11:32.241 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 1256 ms
10-Jan-2015 19:12:18.361 INFO [http-apr-8080-exec-3] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive C:\tomcat\webapps\Advocatoree.war
10-Jan-2015 19:12:29.550 INFO [http-apr-8080-exec-3] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive C:\tomcat\webapps\Advocatoree.war has finished in 11,190 ms
10-Jan-2015 19:21:12.336 WARNING [http-apr-8080-exec-8] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [Advocatoree] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
10-Jan-2015 19:21:12.337 WARNING [http-apr-8080-exec-8] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [Advocatoree] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:40)
10-Jan-2015 19:21:13.042 INFO [http-apr-8080-exec-8] org.apache.catalina.startup.HostConfig.undeploy Undeploying context [/Advocatoree]
10-Jan-2015 19:21:35.779 INFO [http-apr-8080-exec-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive C:\tomcat\webapps\Advocatoree.war
10-Jan-2015 19:21:46.674 INFO [http-apr-8080-exec-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive C:\tomcat\webapps\Advocatoree.war has finished in 10,895 ms
i notice that the application context is "/Advocatoree" from the last lines in your attached log not "/advocatoree" try to change a to capital A
I'm using tomcat 8 and it had a file called context.xml in tomcat's conf. I added the line
path="" docBase="NameOfWar" debug="0" reloadable="true"
in that file inside the <Context></Context> tag and it worked.