After deploying the webapp to a remote server all servlets return HTTP Status 404 but index.jsp works fine. All servlets work on localhost, running the same version of tomcat. Logs are:
catalina.out
10-Feb-2023 04:19:42.728 INFO [ajp-nio-127.0.0.1-8009-exec-86] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/bitnami/tomcat/webapps/test-api.war]
10-Feb-2023 04:19:43.296 INFO [ajp-nio-127.0.0.1-8009-exec-86] 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.
10-Feb-2023 04:19:43.306 INFO [ajp-nio-127.0.0.1-8009-exec-86] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/bitnami/tomcat/webapps/test-api.war] has finished in [577] ms
localhost_access_log
- [10/Feb/2023:04:08:03 +0000] "GET /test-api/test HTTP/1.1" 404 778
- [10/Feb/2023:04:19:54 +0000] "GET /test-api/test-two HTTP/1.1" 404 772
web.xml
type he<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>Test API</display-name>
<context-param>
<param-name>contextPath</param-name>
<param-value>/test-api</param-value>
</context-param>
<servlet>
<servlet-name>TestServlet</servlet-name>
<servlet-class>com.example.servlets.TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>/test</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>TestServlet</servlet-name>
<servlet-class>com.example.servlets.TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestServletTwo</servlet-name>
<url-pattern>/test-two</url-pattern>
</servlet-mapping>
</web-app>
TestServlet.java
package com.fourdcontrols.servlets;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/test")
public class TestServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.getWriter().write("Testing?");
}
}