Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

requested servlet is not available

 
dhanil das
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does this have to do with Applets?
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 11879
195
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic