wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Help. Tomcat installed - can't see servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Help. Tomcat installed - can Watch "Help. Tomcat installed - can New topic
Author

Help. Tomcat installed - can't see servlet

Ted Li
Greenhorn

Joined: Jan 16, 2003
Posts: 2
Hi,
I just bought Manning book and start studying and tinkering around with tomcat
I am running Windows XP Pro, j2sdk 4.1, tomcat 4.1
I followed the instructions in Appendix A of
manning book. Tomcat seems to be running fine since I can view he default index.jsp file at
ROOT by
http://localhost:8080
I copied chapter01 files to webapp and try to view it by
http://localhost:8080/chapter01/servlet/HelloWorldServlet
and I get an error from Apache Tomcat.
http status 404 - /chapter01/servlet/HelloWorldServlet.
type status report
message /chapter01/servlet/HelloWorldServlet
description the requested resource (/chapter01/servlet/HelloWorldServlet) is not available
I checked my CATALINA_HOME, JAVA_HOME, CLASSPATH. file structure. I think everything is fine.
Help please...I am running out of things to check
Sam Dalton
Author
Ranch Hand

Joined: Jul 26, 2001
Posts: 170
I suspect you should be able to access it at
http://localhost:8080/chapter01/HelloWorldServlet
If that does not work, check the web.xml file to find out which name HelloWorldServlet is mapped to.
Cheers
Sam


<a href="http://www.samjdalton.com" target="_blank" rel="nofollow">Sam Dalton</a>,<br />Co-author of [http://www.amazon.com/exec/obidos/tg/detail/-/1590592255/qid=1068633302//ref=sr_8_xs_ap_i0_xgl14/104-4904002-9274339?v=glance&s=books&n=507846]Professional JSP 2.0[/URL] (October 2003)<br />Co-author of <a href="http://www.amazon.com/exec/obidos/ASIN/1861007701/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional SCWCD Certification</a><br />Co-author of <a href="http://www.amazon.com/exec/obidos/ASIN/186100561X/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional Java Servlets 2.3</a>
Ted Li
Greenhorn

Joined: Jan 16, 2003
Posts: 2
I tried
http://localhost:8080/chapter01/HelloWorldServlet
and I get the same error. and I checked web.xml the <servlet-name> is the same "HelloWorldServlet"
Anybody has any other suggestions?
boyet silverio
Ranch Hand

Joined: Aug 28, 2002
Posts: 173
<quote>
I tried
http://localhost:8080/chapter01/HelloWorldServlet
</quote>
i think Sam's suggestion on seeing where '..HelloWorldServlet maps to.' is to look
for something like the following in your web.xml.
<servlet-mapping>
<servlet-name>HelloWorldServlet</servlet-name>
<url-pattern>/HelloWorldServlet</url-pattern>
</servlet-mapping>
if there isn't then try to append it after </servlet>, restart tomcat, and see how it works.
this associates the <url-pattern> with the <servlet-name> you defined in <servlet>...</servlet> so you can use the url you just tried.
hope this helps.
[ January 16, 2003: Message edited by: boyet silverio ]
wooddonkey Qian
Greenhorn

Joined: Jan 17, 2003
Posts: 1
add the following element to web.xml:
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
 
 
subject: Help. Tomcat installed - can't see servlet
 
Similar Threads
SCWCD Exam Study kit problem
problem running the HelloWorld ! servlet
Problem With Tomcat under Linux
Can not run a servlet class
unable to execute