This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Tomcat and the fly likes cannot invoke servlet in Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "cannot invoke servlet in Tomcat" Watch "cannot invoke servlet in Tomcat" New topic

cannot invoke servlet in Tomcat

Mickey Smith
Ranch Hand

Joined: Jun 26, 2006
Posts: 30
Hi all,

I have created one servlet MyServlet under webapps/myApp/WEB-INF/classes/com/myappln/ in Tomcat.

For invoking the servlet i give: http://localhost:8080/myApp/servlet/com.myappln.MyServlet

The web.xml is:


So with this config, i am unable to invoke my servlet and it gives a 404.

Have i missed out something, please do help.
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
try that

that where you define the url to trigger your servlet
ps i'm not sure about the first /
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42958
It should work with something like the following. Two hints: avoid "/servlet/" in URLS (read here why), and you use the url-pattern in the URL, not the servlet-class.

The URL is http://localhost:8080/myApp/MyServlet



[ July 11, 2006: Message edited by: Ulf Dittmer ]
I agree. Here's the link:
subject: cannot invoke servlet in Tomcat
It's not a secret anymore!