• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat problem

 
dolly shah
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone. I have just started preparation for SCWCD certification. I have HFSJ book. I have already ran Tomcat on my machine.
I am doing chapter-1's Servlet's Demystified on page no:30. My class compiles fine. But when I type the given link in my browser I got "The requested resource (/ch1/Serv1) is not available." My class compiles fine & the xml file is also correct. I don't know what is the problem? Can anyone please help me?
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you test the sample applications with Tomcat to make sure Tomcat is working properly?

Also, if you post code here, we could help find any typos. The error message you are seeing simply tells us that something isn't right. Without more information, we can't help you in troubleshooting the problem.
 
dolly shah
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this problem related to Windows Vista?
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. It's related to something not being set up right.

It's often a result of the web.xml having a typo or being placed in the wrong folder. But it could be just about anything.

You can either post your code and xml here or give us other information. Otherwise, there's not much we can do to help.
 
dolly shah
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Marc thanks for your reply. Here I have given the web.xml file & java file respectively. Can anybody figure it out?


<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
web-app_2_4.xsd"
version="2.4">
<servlet>
<servlet-name>Chaper1 Servlet</servlet-name>
<servlet-class>Ch1Servlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Chapter1 Servlet</servlet-name>
<url-pattern>/Serv1</url-pattern>
</servlet-mapping>
</web-app>





 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
  • Even if the book didn't, you should put your servlet in a package
  • Does your directory structure looks like this : /webapps/ch1/WEB-INF/classes/Ch1Servlet.class ?
  • (Removed incorrect statement. Check Kedar's comment instead)
  • Check Tomcat's log, you might find interesting messages


  • [ November 06, 2007: Message edited by: Christophe Verre ]
    [ November 06, 2007: Message edited by: Christophe Verre ]
     
    Kedar Dixit
    Ranch Hand
    Posts: 43
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    One other small typo I see is here
    <servlet>
    <servlet-name>Chaper1 Servlet</servlet-name>
    <servlet-class>Ch1Servlet</servlet-class>
    </servlet>



    and then mapping is
    <servlet-mapping>
    <servlet-name>Chapter1 Servlet</servlet-name>
    <url-pattern>/Serv1</url-pattern>
    </servlet-mapping>
     
    dolly shah
    Ranch Hand
    Posts: 383
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks to all of you.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic