Solved

How to run my servlets using tomcat 5.0

Posted on 2003-12-09
10
787 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
[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
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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
add projects t working set in maven 2 68
jsp error 6 70
Does it make sense to split a controller into two file 6 18
Session in java desktop 5 37
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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

734 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