aspose file tools*
The moose likes Tomcat and the fly likes Servlet Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Servlet Error " Watch "Servlet Error " New topic
Author

Servlet Error

Akhil Maharaj
Ranch Hand

Joined: Sep 29, 2007
Posts: 63
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

Joined: Dec 11, 2004
Posts: 13410

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?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

How did you set up the context for MYPROJECTS/FUN?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Akhil Maharaj
Ranch Hand

Joined: Sep 29, 2007
Posts: 63
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

Joined: Dec 11, 2004
Posts: 13410

What container (and version) are you using?
Akhil Maharaj
Ranch Hand

Joined: Sep 29, 2007
Posts: 63
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

Joined: Dec 11, 2004
Posts: 13410

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
 
subject: Servlet Error