Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

servlet web application issue

Posted on 2014-02-19
7
Medium Priority
?
737 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
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

636 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