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 Tomcat problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Tomcat problem" Watch "Tomcat problem" New topic
Author

Tomcat problem

Chris Skinner
Greenhorn

Joined: Jan 23, 2002
Posts: 23
Hello All,

I hope this doesn't seem like too simple of a question but I'm working through Jason Hunters book learning servlets on Tomcat and I'm having a problem getting started. I've put the compiled version of the HelloWorld servlet in the C:\Tomcat 5.0\webapps\ROOT\WEB-INF\classes directory but when I attempt to access it using
http://localhost:8080/servlet/Hello

Tomcat returns a 404 page saying:

type Status report

message /servlet/Hello

description The requested resource (/servlet/Hello) is not available.

I think I may need to set the home directory, perhaps in an environmental variable but I'm not sure exactly what needs to be done.

Suggestions ?

Thanks


Christopher Skinner<br />SCJP2 1.4<br />SCWCD (in training)
Scott Duncan
Ranch Hand

Joined: Nov 01, 2002
Posts: 363
Can you post a shot of the web.xml file?


No more rhymes! I mean it!<br /> <br />Does anybody want a peanut?
Chris Skinner
Greenhorn

Joined: Jan 23, 2002
Posts: 23
I understand what is supposed to be happening I think but nothing under /classes seems to be visible.



Here's the web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
<servlet>
<servlet-name>
hi
</servlet-name>
<servlet-class>
HelloWorld
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>
hi
</servlet-name>
<url-pattern>
/hello.html
</url-pattern>
</servlet-mapping>
</web-app>
[ July 01, 2004: Message edited by: Chris Skinner ]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12806
    
    5
Description The requested resource (/servlet/Hello) is not available.
Once again, this is the "invoker" servlet problem -earlier versions of Tomcat had the invoker turned on by default, in Tomcat 4 it is off by default. See the Ranch FAQ on the invoker.
Bill
PS put your servlet class in a package and avoid all sorts of mysterious bugs.

[ July 01, 2004: Message edited by: William Brogden ]
[ July 01, 2004: Message edited by: William Brogden ]
Chris Skinner
Greenhorn

Joined: Jan 23, 2002
Posts: 23
Thanks, that was very helpful.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
and call the correct URL which is /servlet/hi


42
 
 
subject: Tomcat problem