Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to run my servlets using tomcat 5.0

Posted on 2003-12-09
10
Medium Priority
?
790 Views
Last Modified: 2013-11-24
Hi

How do I run my servlet programs in Tomcat 5.0. I have done the following as of now

1. I hace installed Tomcat 5.0 successfully. If i give 'http://localhost:8080/" in my browser i am getting the tomcat page and hence i can say tomcat is running

2. I installed j2sdk1.4.2_02 and I compiled my servlet successfully.

Now I have the class file of my servlet and I don't know how to run this servlet using tomcat 5.0.
I put this class file in webapps/ROOT/WEB-INF/classes and tried to run from the browser. But it didn't work.

Can any one help me on this



Chandu

0
Comment
Question by:malli143
10 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 9910071
Give an entry for this servlet in web.xml
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 9910075
or alternately (a bad way), use: http://localhost:8080/servlet/YourServletClassName - but it might not be allowed on all versions of Tomcat.
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9910090
have u setup the CLASSPATH variable.
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 24

Expert Comment

by:shivsa
ID: 9910097
You should add to your classpath the servlet.jar and the "." (current directory)
Ex: CLASSPATH=.;tomcat-install-dir/common/lib/servlet.jar
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9910103
Also you should uncomment the lines in the tomcat-install-dir/conf/web.xml that say: <servlet-mapping>
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 9910190
I guess Tomcat also comes with a setclasspath batch file - you can make use of that too, if its a class-path problem.
0
 
LVL 9

Expert Comment

by:Ovi
ID: 9911401
Look at the servlet examples in Tomcat and follow web.xml file there. Should work.
0
 

Author Comment

by:malli143
ID: 9911454
Also you should uncomment the lines in the tomcat-install-dir/conf/web.xml that say: <servlet-mapping>
 if I try to modify this , tomcat is not starting
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 9911561
Can you post the content from your web.xml file? The entire part from <servlet-mapping> to </servlet-mapping>, if commented, needs to be uncommented. And you need to add an entry for your Servlet in that file.

Alternatively (just for testing), you can use the second approach which I had suggested earlier.

Mayank.
0
 
LVL 30

Accepted Solution

by:
Mayank S earned 400 total points
ID: 9911579
Please visit:

http://www.experts-exchange.com/Programming/Q_20803831.html

Might be helpful. It has en entire detailed sequence of steps to be followed while deploying a servlet in Tomcat. Please go through the comments.

Mayank.

0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

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…
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…
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:
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

824 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