• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 754
  • Last Modified:

servlet web application issue


I am trying below examle on eclipse with tomcat

I copy pasted servlet code and web.xml

when i start the server and go to the url from IE

i am getting
404 error

HTTP Status 404 - /tomcat-demo/test


type Status report

message /tomcat-demo/test

description The requested resource is not available.

where to add below line

In Tomcat's server.xml file, I added a Context entry for 'tomcat-demo', the name of the test project.

<Context docBase="C:\projects\workspace\tomcat-demo\web" path="/tomcat-demo" reloadable="true"/>

Also how to create debug configuration

I created a Debug Configuration in EclipseSW for 'tomcat-demo', using the Bootstrap class (after adding the various TomcatSW jarW file libraries to the project's build path).

In the eclipse i right clicked on the project and Run Configuration i searched on tomcat.

I did not see the tomcat-demo

Please advise how to fix this.
 Any links resources ideas highly appreciated. Thanks in advance
  • 4
  • 2
2 Solutions
Amitkumar PSr. ConsultantCommented:
You will need to define context element in the host element.

Refer http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
gudii9Author Commented:
I am using tomcat 7. Can i do it from eclipse itself? how to do directly from eclipse. Is this example is running for you.

I wonder why they did as the java application instead of 'Dynamic web project' since it is servlet web application?

Please advise
If you are deploying application using eclipse in tomcat, there is no need to change server.xml.
Just check context root in properties (Right Click project - properties- web project setting.)
When you expand tomcat server in eclipse, is there your web project available?
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

gudii9Author Commented:
I tried with jboss server as attached there also i am seeing 404 error.

I went to
Right Click project - properties- web project setting
I see the project context
gudii9Author Commented:
Is this example running for you? please advise
gudii9Author Commented:
I tried one other example as below

This works perfect. Not sure why above servlet web application wont run?
Post your web.xml.
Also add classes folder in webinf. (in build path point it to classes folder)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now