wood burning stoves
The moose likes Tomcat and the fly likes Problem with URL-PATTERN tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Problem with URL-PATTERN tag" Watch "Problem with URL-PATTERN tag" New topic
Author

Problem with URL-PATTERN tag

mithun gooty
Ranch Hand

Joined: Mar 14, 2006
Posts: 33
I have problem giving the url-pattern information in web.xml file. I have a created a servet ServletExample and the url-pattern entry for this servlet looks like this:

<servlet>
<servlet-name>ServletExample</servlet-name>
<servlet-class>ServletExample</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ServletExample</servlet-name>
<url-pattern>/ServletExample</url-pattern>
</servlet-mapping>

The servlet class is directly under the classes folder. When i try to run this servlet from Tomcat with http://localhost:8080/PostServlet URL, I get the following error:

The requested resource (/ServletExample) is not available.
Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42958
    
  73
The URL seems is missing the name of the web app; it should be something like http://localhost:8080/MyWebApp/PostServlet. Or are you modifying the ROOT context? I wouldn't recommend that.
 
Consider Paul's rocket mass heater.
 
subject: Problem with URL-PATTERN tag
 
It's not a secret anymore!