File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes url-pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "url-pattern" Watch "url-pattern" New topic


shuzo monsoon
Ranch Hand

Joined: Feb 11, 2004
Posts: 54
Hello everyone. I have tried to deploy a simple example servlet that I have used from a book, on the Tomcat server. The servlet compiles fine, is placed in the WEB-INF/classes folder under the directory as specified in the example - i.e. classes/com/wrox/servlets/ and is called ExampleServlet. I have also then specified this servlet in the web.xml file as the following -
This code I also used straight out of the book. However, when I try to run open the servlet in the browser, I get an error message stating - Error allocating a servlet instance and also an error saying No ClassDefFoundError.
Can anyone help??
shuzo monsoon
Ranch Hand

Joined: Feb 11, 2004
Posts: 54
One more thing I have just noticed is when I start Tomcat, the console window states - Illegal argument exception: Invalid <url-pattern> ExampleServlet in servlet mapping. Hope this can help identify the problem.
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
I can't see anything wrong with the snippet of code. I would suggest you verify that your Deployment Descriptor is valid(.i.e spelling) by checking that all elements have closing tags and are in the correct order.
Dragos Haiduc

Joined: Mar 05, 2004
Posts: 5
try using this as your url pattern:
danny liu
Ranch Hand

Joined: Jan 22, 2004
Posts: 185
After reading your code, I think it is correct.
I wonder if there is Example folder beneath your application folder.

I agree. Here's the link:
subject: url-pattern
jQuery in Action, 3rd edition