Solved

servlet web application issue

Posted on 2014-02-19
7
715 Views
Last Modified: 2014-03-07
Hi,

I am trying below examle on eclipse with tomcat
http://www.avajava.com/tutorials/lessons/how-do-i-tell-what-browser-is-hitting-a-servlet.html?page=2


I copy pasted servlet code and web.xml

when i start the server and go to the url from IE
http://localhost:8080/tomcat-demo/test

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
0
Comment
Question by:gudii9
  • 4
  • 2
7 Comments
 
LVL 21

Accepted Solution

by:
Amitkumar Panchal earned 250 total points
ID: 39871073
You will need to define context element in the host element.

Refer http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
0
 
LVL 7

Author Comment

by:gudii9
ID: 39871265
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
0
 
LVL 11

Assisted Solution

by:Manish
Manish earned 250 total points
ID: 39875964
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?
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 7

Author Comment

by:gudii9
ID: 39880998
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
jboss1.jpg
jboss2.jpg
0
 
LVL 7

Author Comment

by:gudii9
ID: 39881000
Is this example running for you? please advise
0
 
LVL 7

Author Comment

by:gudii9
ID: 39881330
I tried one other example as below
http://www.journaldev.com/1854/java-web-application-tutorial-for-beginners

This works perfect. Not sure why above servlet web application wont run?
0
 
LVL 11

Expert Comment

by:Manish
ID: 39881692
Post your web.xml.
Also add classes folder in webinf. (in build path point it to classes folder)
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB Script to add site to Java Exception List 4 76
Java exception bubble up 2 18
type mismatch (Object[] to double[] 4 24
pagenation logic how it is working in my code 1 29
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to implement Singleton Design Pattern in Java.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question