user1044220
user1044220

Reputation: 371

Tomcat servlet not running - error 404

I have an application that is distributed with tomcat, I wanted to simply take the webapp from the webapps folder and put it into the webapps folder of a tomcat server, however when I do this and restart it etc whenever a servlet is referenced (such as /controller) it returns a 404 as if the servlets or the mapping aren't working. I'd provide more information but I am so at a loss I don't even know where to start debugging this (very new to tomcat) can someone point me in the right direction? Why would it work locally but not on this server.

Here is my web.xml file

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>
BeergameProject</display-name>
<servlet>
    <description>
    </description>
    <display-name>
    PlayerController</display-name>
    <servlet-name>PlayerController</servlet-name>
    <servlet-class>
    beergame.controller.PlayerController</servlet-class>
</servlet>
<servlet>
    <description>
    </description>
    <display-name>
    AdminController</display-name>
    <servlet-name>AdminController</servlet-name>
    <servlet-class>
    beergame.controller.AdminController</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>PlayerController</servlet-name>
    <url-pattern>/PlayerController</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>AdminController</servlet-name>
    <url-pattern>/AdminController</url-pattern>
</servlet-mapping>
<welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>

Upvotes: 1

Views: 192

Answers (1)

Alireza Fattahi
Alireza Fattahi

Reputation: 45663

in the web.xml you have /PlayerController and /AdminController in the serlet mapping.

So you should call

localhost:8080/beergame/PlayerController or localhost:8080/beergame/AdminController

Where beergame is the name of the folder which you have copied you

Upvotes: 0

Related Questions