File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Error

 
Akhil Maharaj
Ranch Hand
Posts: 63
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

All the servlets deployed in ROOT are working
All the servlets deployed in BASICS ( directory created by me - wtih the same structure as ROOT) are working .

However all the servlets deployed in MYPROJECTS/FUN are not working . I keep getting the error message 404 ( not found )

http://localhost/servlet/HelloWorld
(OK , I could access ROOT/WEB-INF/CLASSES/HelloWorld.class )
http://localhost/BASICS/servlet/HelloWorld
(OK , I could access BASICS/WEB-INF/CLASSES/HelloWorld.class )


http://localhost/MYPROJECTS/FUN/servlet/HelloWorld
(Problem - NOT OK ,
I could not access MYPROJECTS/FUN/WEB-INF/CLASSES/HelloWorld.class )

Any ideas will be helpful
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some more information would be helpful.

Can you post, your servlet-mapping entries and the exact URLs being used to access these servlets?
Also, have you looked at your container's logs to see what, if anything, might be going wrong?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64185
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How did you set up the context for MYPROJECTS/FUN?
 
Akhil Maharaj
Ranch Hand
Posts: 63
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did not set up the CONTEXT for MYPROJECTS/FUN . How do I do that ?

I am reading all over . I can not find any where . The sevlet mappings for ROOT and BASICS are default ones .I have not added any servlet-mapping elements to web.xml .
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What container (and version) are you using?
 
Akhil Maharaj
Ranch Hand
Posts: 63
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Tomcat 6.0.14

When I try to add the following context to my server/conf.xml

<Context path="/MyProjectsFUN" docbase="/MyProjects/FUN" />

I get the error during server start up saying that /MyProjectsFUN does not exist . It is true that /MyProjectsFUN does not exist .

I tried something like ( "/MyProjects/FUN" this is present)

<Context path="/MyProjects/FUN" docbase="/MyProjects/FUN" /> . This time i got the error some thing like no contexts are allowed in trailing ....
[ November 19, 2007: Message edited by: Akhil Maharaj ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If some working examples would help (and I think they might), go to the servlets section of our codebarn.

All the examples there are packaged as war files.
This means that you can simply download them to your tomcat/webapps directory and Tomcat will deploy them.

You will then have a properly constructed web application with a well formed directory structure and a deployment descriptor (web.xml) that has servlet entries and servlet mappings.
You can compare these to what you currently have to find out where you might be going wrong.

I'd start with SimpleServlet.
[ November 19, 2007: Message edited by: Ben Souther ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic