File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes strange 404 problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "strange 404 problem" Watch "strange 404 problem" New topic
Author

strange 404 problem

Sonu Shawnee
Greenhorn

Joined: Jul 10, 2002
Posts: 21
I am testing this very simple servlet,
http://calamity.giccs.georgetown.edu:8180/hungryminds/servlet/ch13.MySQLNamesTest
when I get this error,
Apache Tomcat/4.0.3 - HTTP Status 404 - /hungryminds/servlet/ch13.MySQLNamesTest
type Status report
message /hungryminds/servlet/ch13.MySQLNamesTest
description The requested resource (/hungryminds/servlet/ch13.MySQLNamesTest) is not available.
Now I am totally confused about this. I have the MySQLNamesTest.class under hungryminds/WEB-INF/classes/ch13.
I also tried putting comiling and putting the clas file directly under classes after commenting out app code in the java file and open it by,
http://calamity.giccs.georgetown.edu:8180/hungryminds/servlet/MySQLNamesTest
with similar results.
Please advise !!
Anthony Villanueva
Ranch Hand

Joined: Mar 22, 2002
Posts: 1055
Look in the tomcat log files. The stack trace will show up there. What does it say?
Sonu Shawnee
Greenhorn

Joined: Jul 10, 2002
Posts: 21
amazingly there has no log file ceated for that day!!
Sonu Shawnee
Greenhorn

Joined: Jul 10, 2002
Posts: 21
sorry there are some logs. I was looking at the wrong dates. Anyways I found this.
----- Root Cause -----
java.lang.ClassNotFoundException: ch13.MySQLNamesTest
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1394)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1243)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:865)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:653)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:396)
at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
at java.lang.Thread.run(Thread.java:536)
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
Look in the source for the servlet class. Does it have a package statement at the top? Does it say ch13? Usually when you have example code from a book (I'm assuming that's where you got the code), it is just left in the default package.


James Carman, President<br />Carman Consulting, Inc.
Sonu Shawnee
Greenhorn

Joined: Jul 10, 2002
Posts: 21
well there was a packge ch13 on top which I commented out compiled and put it unde WEB-INF/classes. But even then ....
Also before when I just left the pacakage statement, the class was under a directory called,
WEB-INF/classes/ch13 and so the URL was,
hungryminds/servlet/ch13.MySQLNamesTest and even then ....
This just beats me !!.
Graham Clark
Greenhorn

Joined: Jun 13, 2002
Posts: 17
I can't quite remember some of the details about tomcat, but the two things I'd try are making sure the class file is world-readable, and also making sure the servlet is registered properly with tomcat.
Graham.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

Current versions of Tomcat do not allow you to invoke a servlet just by typing its classname in the URL. That was considered to be a security exposure.
You need to define the servlet in your web.xml file in two places - the first to assign a URL to a servlet ID and the second to take that servlet ID and map it to a class name.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: strange 404 problem