Solved

servlet web application issue

Posted on 2014-02-19
7
718 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
servlet example 17 59
jmss example java 2 33
Problem to Alipay 10 71
Html split(text) 2 32
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

733 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