aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Tomcat problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Tomcat problem" Watch "Tomcat problem" New topic
Author

Tomcat problem

dolly shah
Ranch Hand

Joined: Jun 18, 2007
Posts: 383
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?


SCJP-1.5<br />SCWCD-1.4
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

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.


A good workman is known by his tools.
dolly shah
Ranch Hand

Joined: Jun 18, 2007
Posts: 383
Is this problem related to Windows Vista?
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

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

Joined: Jun 18, 2007
Posts: 383
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

Joined: Nov 24, 2005
Posts: 14687
    
  16

  • 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 ]

    [My Blog]
    All roads lead to JavaRanch
    Kedar Dixit
    Ranch Hand

    Joined: Apr 22, 2003
    Posts: 43
    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>


    Sun Certified Programmer for Java 1.4<br />SCWCD 1.4 (in progress)<br /> <br />Life is a movie and you are the star. Give it a happy ending!
    dolly shah
    Ranch Hand

    Joined: Jun 18, 2007
    Posts: 383
    Thanks to all of you.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Tomcat problem