This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Tomcat and the fly likes servlet not loading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "servlet not loading" Watch "servlet not loading" New topic
Author

servlet not loading

Sivaraman Lakshmanan
Ranch Hand

Joined: Aug 02, 2003
Posts: 231
Hai all,
I am developing a web page which uses servlets and JSP. I am using Tomcat server. when I load all my JSP pages are working fine but when i call a servlet i get a error saying that the page u r requesting is unavailable.
How to solve this problem.
I have given all details in web.xml file also.
siva.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12760
    
    5
What is the syntax you are using for calling the servlet?
If you are using "../servlet/myservlet" than it sounds like the ever-popular "invoker" servlet problem.
Bill
Sivaraman Lakshmanan
Ranch Hand

Joined: Aug 02, 2003
Posts: 231
yes I am using the same to invoke the servlet. Then what is the soln for the problem
siva
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

You say : I have given all details in web.xml file also.

What are those details? Does this mean you've supplied a <servlet>, <servlet-mapping> couplet for each servlet you're deploying?
Sivaraman Lakshmanan
Ranch Hand

Joined: Aug 02, 2003
Posts: 231
yes, I have given servlet-name,servlet-class,servlet-mapping etc in the web.xml file.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12760
    
    5
The "invoker" servlet is a convenience thing that (In my opinion) is a disaster. You can read about it in the ../conf/web.xml file.
You should not use the invoker, instead, use web.xml to create a servlet mapping from a URL to your servlet name.
Bill
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Sivaraman,

If you've got the proper mappings, then you shouldn't be putting /servlet into the call to the servlet.

If it's there, take it out.

You don't tell us "how" you call your servlets, so I can only assume you're doing something like:

form action="/servlet/url-mapping"

take out the /servlet part
Sarath Mohan
Ranch Hand

Joined: Mar 17, 2001
Posts: 213
I still have the problem....
Could you please give me the code in web.xml and form action tag for a simple HelloServelt


Sarath Mohan
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Here's a start ServletInvoker FAQ

Read 'The Middling Tale' for the mapping info.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: servlet not loading
 
Similar Threads
session.getAttribute give null when retreiving session Data in jsps
Urgent -RequestDispatcher.include and forward
Be the container. HSFJ pg 356
How to update the browser address with the displayed page
Problem retrieving session value in jsp pagess