File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes resource not available. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "resource not available." Watch "resource not available." New topic
Author

resource not available.

ravi janap
Ranch Hand

Joined: Nov 04, 2000
Posts: 389
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


SCJP, SCJD, SCWCD, SCBCD, SCEA
gurcharan singh
Greenhorn

Joined: Dec 21, 2002
Posts: 16
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

Joined: Nov 04, 2000
Posts: 389
Hi Gurucharan
What url must be used to invoke the servlet mapping?
I guess that url pattern modifies the root context.
Thanks
Ravi
Wayne Rousey
Greenhorn

Joined: Feb 09, 2003
Posts: 10
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

Joined: Nov 04, 2000
Posts: 389
Hi
The problem has been resolved after I used the servlet mapping.
Thanks
Ravi
gurcharan singh
Greenhorn

Joined: Dec 21, 2002
Posts: 16
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
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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.
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
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 ]

- Varun
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: resource not available.
 
Similar Threads
404 Error...need help
resource not available.
Setup servlet
About executing servlet class
HelloWorldServlet