• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat problem

 
Chris Skinner
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Scott Duncan
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post a shot of the web.xml file?
 
Chris Skinner
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, that was very helpful.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and call the correct URL which is /servlet/hi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic