Choi
Choi

Reputation: 1

Apache-Tomcat Servlet-mapping through url-pattern fails (404-Error)

I have a problem with Apache-Tomcat Servlet-mapping through url-pattern. It has been working just fine till last year. Very recently I tried to login and all of sudden 404 Not Found error showed up. I still see all other pages fine. I don't know what has changed on server-side because I am borrowing a linux-server from vultr. Since I haven't touched anything in my coding and everything looks fine to me, I have no clue. It seems easy to solve for experts. Can anyone help me with this?

- Error Message

Not Found
The requested URL /login.do was not found on this server.
Apache/2.4.12 (Ubuntu) Server at xx.xx.xx.xx Port 80

Here xx is the ip address of my server

- tomcat/conf/server.xml

...
<Context path="" docBase="/.../tomcat/webapps/.../WebContent" reloadable="true"></Context>
...

- tomcat/conf/web.xml

...
    <servlet>
        <servlet-name>default</servlet-name>
        <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
        <init-param>
            <param-name>debug</param-name>
            <param-value>0</param-value>
        </init-param>
        <init-param>
            <param-name>listings</param-name>
            <param-value>false</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
...
    <servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
...

- myapp/WEB-INF/web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>myapp</display-name>
...
    <servlet>
        <servlet-name>URIController</servlet-name>
        <servlet-class>myapp.mvc.control.URIController</servlet-class>
        <init-param>
            <param-name>config</param-name>
            <param-value>
                /WEB-INF/commandHandler.properties
            </param-value>
        </init-param>
    </servlet>
    
    <servlet-mapping>
        <servlet-name>URIController</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>
...

- myapp/WEB-INF/commandHandler.properties

/login.do=myapp.mvc.command.Login

When I try to login, it says "The requested URL /login.do was not found on this server." It has been working fine like this: when hitting "login" button, it passes the content in commandHandler.properties to the control class (myapp.mvc.control.URIController) and this class get the name of the login class (myapp.mvc.command.Login) in order to dispatch the request to the login class.

If this problem has something to do with Apache, I have no idea (no idea even what to show here) because it was done by a paid expert like 5 years ago.

Thanks a lot in advance !!

Upvotes: 0

Views: 677

Answers (1)

Mark Thomas
Mark Thomas

Reputation: 16615

That is an httpd error message, not an Apache Tomcat one. It looks like something (can't tell what from the information provided) has broken the reverse proxy from httpd to Tomcat. You need to talk to whoever set up the reverse proxy for you.

Upvotes: 0

Related Questions