aspose file tools*
The moose likes Servlets and the fly likes requested servlet is not available Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "requested servlet is not available" Watch "requested servlet is not available" New topic
Author

requested servlet is not available

dhanil das
Greenhorn

Joined: Sep 04, 2009
Posts: 7
sir I have got some error's when i run my first servlet program with Tomcat 6

Errors : HTTP Status 404 -
type Status report

message:

description: The requested resource () is not available.

my java code is :



XML code is :



class directory :C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\myApp\WEB-INF\classes\TestingServlet.class

I have run the servlet with url :http://localhost:8080/myApp/servlet/Testing

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61187
    
  66

What does this have to do with Applets?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874

Dhanil,

Welcome to Javaranch.Please choose correct forum before posting.

Two Mistakes
- Use package always to write your servlet programs. so <servlet-class> would change as com.dhanil.TestingServlet


- Use web-app that suits your container. Tomcat 6 i believe would support lower versions , 2.4 and higher as well.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61187
    
  66

Also, please be sure to take the time to compose descriptive subjects for your posts; read this for more information.

Using a title of "servlet" in a forum completely dedicated to questions on Servlets isn't very helpful.

I've changed the subject for you and moved this to the Servlets forum.
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11460
    
  94

dhanil das wrote:XML code is :
[snip]

I have run the servlet with url :http://localhost:8080/myApp/servlet/Testing

According to this, when you enter the URL of http://localhost:8080/myApp/servlet/Testing, Tomcat will look for a servlet-mapping with the url-pattern of /Testing - there is no such url-pattern in the web descriptor. I assume you really meant to enter http://localhost:8080/myApp/servlet/TestingServlet, for which there is a matching url-pattern.

When you enter http://localhost:8080/myApp/servlet/TestingServlet, it will find a servlet-mapping with that url-pattern, and then try to find a servlet with the servlet-name of TestingServlet. There is no such servlet - either the servlet-name in the servlet section needs to be updated, or the servlet-name in the servlet-mapping needs to be updated.

Balu Sadhasivam wrote:
Use package always to write your servlet programs. so <servlet-class> would change as com.dhanil.TestingServlet
...
Use web-app that suits your container. Tomcat 6 i believe would support lower versions , 2.4 and higher as well

Very good advise, however these will not solve the fundamental issues of the XML fragments being incorrect. Personally I would recommend you fix the XML and confirm that it is working, then go back to fix code style issues.

The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: requested servlet is not available