0
votes

I have made a project on spring tool suit. This project is running fine in local embaded tomcat server. But when I deployed the war file to the external tomcat servers webapps folder I cannot run the project from the tomcat manager. When I click start it shows two errors: FAIL - Application at context path [/payemntmodule] could not be started FAIL - Encountered exception [org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/paymentmodule]]]

Here are the details of my project:

java version

java --version
openjdk 11.0.11 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)

tomcat.service

[Service]
Type=forking

Environment=JAVA_HOME= /usr/lib/jvm/java-1.11.0-openjdk-amd64
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment=CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC
Environment=JAVA_OPTS= -Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh

User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target

[![/opt/tomcat/webapps][1]][1]

[![Deployed war file to the tomcat manager][2]][2]

[![File permissions of webapps][3]][3]

Errors:

FAIL - Application at context path [/paymentmodule] could not be started
FAIL - Encountered exception [org.apache.catalina.LifecycleException: Failed to start 
component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/paymentmodule]]]

[![Tomcat Manager with error][4]][4]

Logs:

[![tomcat.log][5]][5]

manager.log

[![manager.log][6]][6]

[![manager.log][7]][7]

[![manager.log][8]][8]

1
The details of the error can be found in the log files, please add them to your question. - Piotr P. Karwasz
Can you please tell me how can I check the log files in the tomcat server? @PiotrP.Karwasz - travel
The logs are in the /opt/tomcat/logs directory. A deployment error should be in localhost.<date>.log, but check also catalina.<date>.log and manager.<date>.log. - Piotr P. Karwasz
I have added the logs in my question. Can you please help me by looking at the logs? @PiotrP.Karwasz - travel
Please don't add logs and other text information as images! Add them as text (copy/paste). The images you posted lack cut the end of the error messages (the real cause is at the end) and are not searchable. - Piotr P. Karwasz

1 Answers

0
votes

This is because your app does not knows that it is invoked by external tomcat. Need to change scope to provided,add this in pom and check

<dependency>
<groupId>org.springframework.boot</groupId>  
<artifactId>spring-boot-starter-tomcat</artifactId>  
<scope>provided</scope>
</dependency>