• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

requested servlet is not available

 
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

 
Marshal
Posts: 67448
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does this have to do with Applets?
 
Ranch Hand
Posts: 874
Android VI Editor Java
  • 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
Marshal
Posts: 67448
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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.
 
author and jackaroo
Posts: 12199
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • 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.
 
Here. Have a potato. I grew it in my armpit. And from my other armpit, this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic