*
The moose likes Tomcat and the fly likes This is my problem.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "This is my problem...." Watch "This is my problem...." New topic
Author

This is my problem....

Ravikumar Jambunathan
Ranch Hand

Joined: Aug 25, 2003
Posts: 66
hi all,
i am using tomcat4.1.18.
i have put my simple servlet class in "c:\tomcat\webapps\MyServlets\WEB-INF\classes.
and my web.xml in "c:\tomcat\webapps\MyServlets\WEB-INF, here is my code of descriptor,
<servlet>
<servlet-name>FirstServlet</servlet-name>
<serlvet-class>FirstServlet</serlvet-class>
</servlet>
<serlvet-mapping>
<servlet-name>FirstServlet</servlet-name>
<url-pattern>/FirstServlet</url-pattern>
</servlet-mapping>
i have tried "/FirstServlet/* and "/" in the place of <url-pattern> as well, but it does not work. Server could not find the resource.
The same pattern works with tomcat4.0 in XP environment. I am using WIN2000. With tomcat default directory "examples", it works fine.
Can anybody help me out? thanks.
--------------------
Ravi.
Sun Certified Programmer.
Yogesh Kodgule
Greenhorn

Joined: Oct 02, 2003
Posts: 29
hi there!
please try configuring tomcat\conf\server.xml.
set the proper ContextPath over there.
regards,
yogesh


"Thinking of doing something is also doing something ...so don't just stop thinking!"
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
which url did you requested ??
Normally it should be:
http://hostname ort/webapplication/FirstServlet
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
We really need a FAQ for this one it is the most common problem for new servlet programmers.
Your servlet worked in examples because the examples web application has the invoker servlet turned on in its web.xml
Although you can make servlets that are not in a package work, you will save yourself a lot of pain in the long run by putting ALL classes that have anything to do with servlets or JSP in packages.
Bill
Ravikumar Jambunathan
Ranch Hand

Joined: Aug 25, 2003
Posts: 66
thanks for your replies friends,
for your info, i have already configured context path in server.xml using my applicaiton directory "MyServlets".
Requested url is http://localhost:8080/MyServlets/servlet/FirstServlet.
-------------------
Ravi
Sun Certified Programmer.
Ravikumar Jambunathan
Ranch Hand

Joined: Aug 25, 2003
Posts: 66
sorry to bother you again with the same problem dears,
after i entered the URL, my browser asking me "Work Offline" or "Try again".
If i select "Work Offline" my browser doesn't show up anything, it simply remains blank. if i select the "Try again" button it displays that the resource is not available.Is there anything related with the browser settings?.
I am using IE5.0 and i do not have internet connection in that system.
Expecting your advice please.
with regards.
----------------
Ravi
Sun Certified Programmer.
Sainudheen Mydeen
Ranch Hand

Joined: Aug 18, 2003
Posts: 218
RaviKumar
Have you tried

http://localhost:8080/MyServlets/FirstServlet
-------------
Sainudheen
Ravikumar Jambunathan
Ranch Hand

Joined: Aug 25, 2003
Posts: 66
no mydeen, but i doubt how we access a servlet without mentioning '/servlet'.
however, i will try out and let you know. thanks.
Dave Jochim
Ranch Hand

Joined: Jan 08, 2003
Posts: 31
I have not worked with Tomcat offline but I saw this (http://www.coderanch.com/t/81585/Tomcat/tomcat-startup) in this forum before.
Good luck.
Ravikumar Jambunathan
Ranch Hand

Joined: Aug 25, 2003
Posts: 66
thanks dave,
the discussion you indicated really gained me some useful technical stuff. As described in that discussion, i installed Microsoft Loopback Adapter, but my problem is not resolved, the browser still remains blank.
however, the most surprising thing is, my application went fine with tomcat4.0. After i upgraded to tomcat4.1.18, it has put me in mess.
still i am trying to resolve...
-----------------
Ravi
Sun Certified Programmer.
Ravikumar Jambunathan
Ranch Hand

Joined: Aug 25, 2003
Posts: 66
it WORKS...., woooph. thanks you dears for your valid suggestions, and special thanks to dave.
All the best.
----------------
Ravi
Sun Certified Programmer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: This is my problem....
 
Similar Threads
Servlet delivery in Tomcat
First Servlet in Tomcat
Prblem while running Servlet program
Tomcat 4.0.1 - Servlet not found
help me deploy my webapp