• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP Status 404 when trying to reach a servlet

 
Anthony Smith
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am in Tomcat .1 and I got a really simple web app. However, I cannot get to my servlets.
In my web.xml in my WEB-INF folder under my reports webapp folder looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>GSE Monitor</display-name>
<description> Monitor Code
</description>

<servlet>
<servlet-name>ReportingServlet</servlet-name>
<servlet-class>com.gl.monitor.servlets.ReportingServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>MonitorServlet</servlet-name>
<servlet-class>com.gl.monitor.MonitorServlet</servlet-class>
</servlet>


<servlet-mapping>
<servlet-name>ReportingServlet</servlet-name>
<url-pattern>/ReportingServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>MonitorServlet</servlet-name>
<url-pattern>/MonitorServlet</url-pattern>
</servlet-mapping>
</web-app>
****************************
I have a jar file in my lib with these class files....
But when I try to go to: http://127.0.0.1/ReportingServlet
I get the 404 error. What in the world am I doing wrong?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Describe your directory structure. Which directory is your jar file in. Is it under webapps then a directory called reporting. If so, this could be the problem.
Have you looked in the console window for Tomcat to see that your Servlets got deployed?
Mark
 
Anthony Smith
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C:\Program Files\Apache Group\Tomcat 4.1\webapps\
My reports fodler is under webapps with the rest of my web applications that use servlets and work fine. I have a WEB-INF folder in reports that has a lib folder tha contains my jars. I can pull up the jsps fine.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

In these two servlet-class tags, they have two different package structures. In the MonitorServlet it is in com.gl.monitor package, yet the ReportingServlet is in the com.gl.monitor.servlets package.
Are they supposed to be in two different packages?
Mark
 
Anthony Smith
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That will be changed but right now they are in 2 different packages...
 
Craig Jackson
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once you get the packages straight, there is one more thing you might want to take a look at, but shouldn't your url contain the port number 8080 along with the name of the context for your web application. I believe you said it was "report". Also I believe(but not sure) Tomcat4 is configured such that invoker servlet must be apart of your url, this configuration was removed in Tomcat 5+. You can look at Tomcat's web.xml which should be located in the %tomcat_home%\conf or the %catalina_home%\conf folder and search for "invoker".
For example
or

I am new to the Tomcat platform, so I hope this explanation makes since.
Craig
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic