Report this

What is the reason for this report?

Why is 404 error when deploying war file?

Posted on February 21, 2021

I have a Spring mvc application. I use ubuntu 16.04 and did everything according to the instructions: I installed Tomcat9, Apache, mysql. Through FileZilla I uploaded the war file, but when deploying it gives a 404 error. When I only access my IP address I get the Ubuntu welcome page, but when I add requests from my application I get an error. What could be the problem?

I put the war file in the webapps directory. I turned off auto-deployment I tried to run it via sudo cp /home/ftp/my_app.war /opt/tomcat/webapps I restarted everything

logs:

20-Feb-2021 23:56:22.302 INFO [Catalina-utility-1] org.hibernate.annotations.common.reflection.java.JavaReflectionManager.<clinit> HCANN000001: Hibernate Commons Annotations {5.1.2.Final} 20-Feb-2021 23:56:23.723 INFO [Catalina-utility-1] org.hibernate.dialect.Dialect.<init> HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect 20-Feb-2021 23:56:25.093 INFO [Catalina-utility-1] org.hibernate.engine.transaction.jta.platform.internal.JtaPlatformInitiator.initiateService HHH000490: Using JtaPlatform implementation: [ 
org .hibernate, engine .transaction. j ta .platform. internal. NoJtaPlatform] 20-Feb-2021 23:56:26.428 INFO [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/opt/tomcat/webapps/my_app.war] has finished i n [12,247] ms 


[Sun Feb 21 00:28:13.958352 2021] [ssl:error] [pid 1763:tid 140522761787264] AH02604: Unable to configure certificate 178.128.255.198:443:0 for stapling [Sun Feb 21 00:28:14.032213 2021] [ssl:warn] [pid 1775:tid 140522761787264] AH01906: 178.128.255.198:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?) [Sun Feb 21 00:28:14.032350 2021] [ssl:error] [pid 1775:tid 140522761787264] AH02217: ssl stapling init cert: can't retrieve issuer certificate! [subject: emailAddress=lidiiamoor@gmail.com, N=178.128.255.198,O=LidiiaMoor,L=Amsterdam,ST=Amsterdam,C=NL / issuer: emailAddress=lidiiamoor@gmail.com,CN=178.128.255.198,0=LidiiaMoor,L=Amsterdam,ST=Amsterdam,C=NL / serial: ED8D3A46EFD 7482B / notbefore: Feb 20 15:18:41 2021 GMT / notafter: Feb 20 15:18:41 2022 GMT] [Sun Feb 21 00:28:14.032359 2021] [ssl:error] [pid 1775:tid 140522761787264] AH02604: Unable to configure certificate 178.128.255.198:443:0 for stapling [Sun Feb 21 00:28:14.033279 2021] [mpm event:notice] [pid 1775:tid 140522761787264] AH00489: Apache/2.4.18 (Ubuntu) mod jk/1.2.41 OpenSSL/1.0.2g configured -- resuming normal operations [Sun Feb 21 00:28:14.033309 2021] [core:notice] [pid 1775:tid 140522761787264] 


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

Based on the logs you provided, it seems that the deployment of your Spring MVC application has finished, but there might be an issue with your SSL configuration.

Here are some suggestions to help you troubleshoot the issue:

  • SSL Certificate Issue: The log shows some errors related to the SSL certificate configuration. Double-check your SSL certificate files and their configuration in your Apache VirtualHost configuration. Make sure you have the correct paths for your certificate files and that they are properly configured. If you have recently updated your SSL certificate, you might need to restart Apache for the changes to take effect.
  • Check Apache and Tomcat connection: Make sure your Apache and Tomcat are correctly connected using mod_jk or mod_proxy. Check the configuration in your Apache VirtualHost to ensure the proxy settings are correct. For example, using mod_proxy:
  1. ProxyPreserveHost On
  2. ProxyPass / http://localhost:8080/
  3. ProxyPassReverse / http://localhost:8080/
  • Replace 8080 with your Tomcat’s port number if it’s different.

  • Check your application’s context path: Ensure that you are using the correct context path when accessing your application. If your application’s context path is /my_app, you should access it using https://yourdomain.com/my_app. If the context path is /, access it using https://yourdomain.com/.|

  • Inspect Tomcat logs for further errors: Check the Tomcat logs (e.g., catalina.out, localhost.*.log) for any additional errors or warnings that might be related to your application. These logs can provide more information about issues with the deployment or the application itself.

  • Check application logs: Your application might have its own log files. Look for any application-specific log files in the webapps/my_app/WEB-INF/logs folder or any other folder where your application stores logs. These logs can provide more information about issues within the application.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.