?
Solved

servlet web application issue

Posted on 2014-02-19
7
Medium Priority
?
727 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 1000 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 1000 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
Technology Partners: 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

TCP/IP Network Protocol Cheat Sheet

TCP/IP is a set of network protocols which is best known for connecting the machines that make up the Internet. The truth is that TCP/IP is one of the oldest network protocols and its survival is mainly based on its simplicity and universality.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses
Course of the Month10 days, 6 hours left to enroll

764 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