aspose file tools*
The moose likes Servlets and the fly likes HTTP Status 404 when trying to reach a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "HTTP Status 404 when trying to reach a servlet" Watch "HTTP Status 404 when trying to reach a servlet" New topic
Author

HTTP Status 404 when trying to reach a servlet

Anthony Smith
Ranch Hand

Joined: Sep 10, 2001
Posts: 285
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

Joined: Feb 05, 2001
Posts: 17259
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Anthony Smith
Ranch Hand

Joined: Sep 10, 2001
Posts: 285
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

Joined: Feb 05, 2001
Posts: 17259
    
    6


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

Joined: Sep 10, 2001
Posts: 285
That will be changed but right now they are in 2 different packages...
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
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
 
 
subject: HTTP Status 404 when trying to reach a servlet