• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet trouble..... PLEASE HELP

 
Alfonso Harding
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone please tell me why my servlets dont work outside the webapps/example directory? I follow all the necessary steps but for some reason the servlets are not recognized. When I place them in the examples/WEB-INF dir, they work just fine. Please help.......
 
Faisal Khan
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you tried searching the forum for this problems as I have personally seen the same question a number if times in the last few weeks alone.
 
Wayne L Johnson
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There could be several issues, but most likely it's a configuration issue. If you want to use a different directory, you need to define a "context", which at a basic level maps to a subdirectory within "<home>/webapps". You can define this either in the main configuration file (<home>/conf/server.xml), or in a separate file that is placed in the "<home>/webapps" directory. Note that "<home>" refers to wherever Tomcat is installed. Also note that I'm assuming you are running Tomcat, which is usally a pretty good assumption ;-).
If you look in the "<home>/conf/server.xml" file you will see a section defined as:

This defines a "context" so that URL requests to "../examples/.." will be resolved by looking in the "examples" subdirectory within webapps.
You will need to create another context, using the "examples" context as a model. The new sub-directory will have to be set up (with a "WEB-INF" subdirectory, with a "web.xml" file, etc.) as well. It's all there in the documentation, just play around a bit and you should get it running.
Good luck.
[ September 08, 2003: Message edited by: Wayne L Johnson ]
 
Alfonso Harding
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the help Wayne.... I'll try it out.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
/examples/ works because the web.xml for the examples defines the invoker servlet - like Faisal said, this comes up all the time.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic