• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Tomcat problem

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, that was very helpful.
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
and call the correct URL which is /servlet/hi
 
30 seconds to difuse a loaf of bread ... here, use this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic