• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tomcat servlet not found

 
Jo Lee
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my form action is "myPackage.thisPackage.thatPackage.servlet"
when I run the jsp page in tomcat 4.0.4, I get a error message says:"The requested resource(/MySite/myPackage.thisPackage.thatPackage.servlet) is not available.
My file structures are:
WebApps
--MySite
--WEB-INF
-----classes
-------myPackage
----------thisPackage
-------------thatPackage
-----------------servlet
What is wrong?
Jo
 
Jo Lee
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I find out that the uri for the servlet is:
/servlet/myPackage.thisPackage.thatPackage.Servlet
so I change the form action="/servlet/myPackage.thisPackage.thatPackage.Servlet"
I tried also the following:
form action="servlet/myPackage.thisPackage.thatPackage.Servlet"
both give me the same problem: the requested resource is not available.
Please help
Jo
 
Praveen K Pippiri
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make the Form action as
/MySite/servlet/myPackage.thisPackage.thatPackage.Servlet
You have to include the web application name also as far as I know.
 
Avais Aziz
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jo!
Change your form action as below.
action='myPackage.thisPackage.thatPackage.Servlet'
Cheers
Avais
 
Jo Lee
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, instead of writing a response, I wrote a new topic by mistake.
I have tried all the suggestions, and it still says that servlet not found.
Is there any trick about tomcat install? May be my tomcat server is not configured right? I am using tomcat-4.0.4
Jo
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17989
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, Tomcat doesn't do any tricky stuff finding servlets - it's strictly per spec. Tomcat has its own forum here on the JavaRanch, BTW, but you'd be having the same problem with WebSphere or WebLogic.
Nowhere did you mention what you set up in the web.xml file, so I'll wager you didn't set it up.
web.xml is where you map the URL to a servlet ID and the servlet ID to its associated class. Older servlet programmers are used to not having to do this explicitly, but that was a major security hole and most modern-day appservers won't find a servlet unless web.xml tells them about it.
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Double-check your installation with this
 
Jo Lee
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks for the information. I did not do the modification on server.xml . Now I have done it and tried the sample servlet from the instruction, it worked beautifully.
Thanks again.
Jo
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved from Servlets -> Apache/Tomcat
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic