Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Tomcat problem

 
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this problem related to Windows Vista?
 
Marc Peabody
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>





 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
     
    Ranch Hand
    Posts: 43
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks to all of you.
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    reply
      Bookmark Topic Watch Topic
    • New Topic