• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

resource not available.

 
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I have created a chapter01 directory under
C:\jakarta-tomcat-4.1.18\webapps
Next, I created a WEB-INF directory under C:\jakarta-tomcat-4.1.18\webapps\chapter01
I developed a HelloWorldServlet, the code is as follows:

I compiled the servlet and copied it under C:\jakarta-tomcat-4.1.18\webapps\chapter01\WEB-INF\classes
The C:\jakarta-tomcat-4.1.18\webapps\chapter01\WEB-INF also has web.xml

I started the tomcat as follows:
C:\jakarta-tomcat-4.1.18\bin>startup
I opened the browser and typed the following url http://localhost:8080/chapter01/servlet/HelloWorldServlet
I got the following response:
description The requested resource (/chapter01/servlet/HelloWorldServlet) is not available.
What must be the reason?
Thanks
Ravi
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use <servlet-mapping> in the web.xml file it will work.
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/HelloWorld</url-pattern>
</servlet-mapping>
BY!
gurcharan
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gurucharan
What url must be used to invoke the servlet mapping?
I guess that url pattern modifies the root context.
Thanks
Ravi
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The <servlet-mapping> tag is required with Tomcat 4.1.18 - it wasn't previoulsy so it can cause some confusion since previous versions of Tomcat (4.0.x, etc.) did not require this tag.
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
The problem has been resolved after I used the servlet mapping.
Thanks
Ravi
 
gurcharan singh
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Put the below servlet mapping in web.xml and this will lead your all servlet to execute without doing servlet mapping individually
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
BY!
guru
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by janapareddy ravindra:
I got the following response:
description The requested resource (/chapter01/servlet/HelloWorldServlet) is not available.


I had the same problem with tomcat-4.1.24.
Uncommenting the code (gurcharan singh above refers to) in %CATALINA_HOME%\conf\web.xml solved the problem.
 
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out this link --->
http://www.fawcette.com/javapro/2002_11/online/servletsjsp_bkurniawan_11_08_02/page2.asp
[ May 08, 2003: Message edited by: varun Khanna ]
 
I think I'll just lie down here for a second. And ponder this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic