Solved

servlet web application issue

Posted on 2014-02-19
7
711 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 20

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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Unable to open debugger port in Intellij idea 6 88
endX challenge 2 50
parentbit challenge 3 52
Java DateChooser? 2 13
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now