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
Solved

How to run my servlets using tomcat 5.0

Posted on 2003-12-09
10
785 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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
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 100 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
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.
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 theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

808 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