• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

url-pattern

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 -
<servlet>
<servlet-name>ExampleServlet</servlet-name>
<servlet-class>com.wrox.servlets.ExampleServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ExampleServlet</servlet-name>
<url-pattern>/Example/*</url-pattern>
</servlet-mapping>
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??
Thans.
 
shuzo monsoon
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
Craig.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try using this as your url pattern:
<url-pattern>/Example</url-pattern>
 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After reading your code, I think it is correct.
I wonder if there is Example folder beneath your application folder.

Dan
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic