• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Weird Problem!

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi folks,
i created a servlet and deployed in tomcat. when i do like this:
http://localhost:8080/myproject/servlet/Try, gives me the following error

i have a directory structure like this

i also checked a server.xml file and delcared myproject as servletcontext in that file in conf folder.
if i put Try.class in exmpales folder that's created when tomcat is installed, access like this
http://localhost:8080/examples/servlet/Try, works fine.
but why does not work while putting it in myproject? can someone explain me.
thanks.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Seems like we get this one every couple of days.
You need to put your servlet in a package and create an entry for it in the web.xml for the myproject application. You can download the servlet API from java.sun.com which goes into great length about what goes where in the directorie and web.xml. Take a look at the web.xml files that Tomcat uses in examples and other places - there are lots of embedded comments.
Bill
 
Always look on the bright side of life. At least this ad is really tiny:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic