File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "please help" Watch "please help" New topic

please help

Yuan Ye
Ranch Hand

Joined: Mar 05, 2003
Posts: 172
I was trying to run a servlet program in Tomcat. I placed the compiled a.class file in the directory of WEBAPP/ROOT/WEB-INF/classes, however when I try to run http://localhost/servlet/a, Tomcat can't find the file. How should I set up the Tomcat so that this will work.
Thanks in advance.
Juanjo Bazan
Ranch Hand

Joined: Feb 04, 2002
Posts: 231
Are you omitting the port?
Tomcat listen by default in the 8080.
If your Tomcat is running you could access it at http://localhost:8080/...
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5382
did you modify web.xml ??

"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
Nicolas Brasseur
Ranch Hand

Joined: Nov 09, 2001
Posts: 45
Since version 4.1 Tomcat doesn't support calling servlets using their fully qualified classname. So I think you'll be forced to modified the web.xml file located in the web-inf directory of your web application.
ex :

The url used to call you servlet should be something like
if the webapp where your servlet is deployed is the ROOT webapp of tomcat else the url will be
<a href="<i rel="nofollow">webappname</i>/Hello" target="_blank">
Hope it helps

<a href="" target="_blank" rel="nofollow">BlackBeltFactory Communtiy</a> founder - Building better developers<br /><b>Free</b> courses and mock exams
suresh guru
Ranch Hand

Joined: Sep 07, 2002
Posts: 38
yes I agree with Nicolas . But i think u have to put the classfile in the examples's web-inf directory & modify the web.xml there as said my Nicolas
Yuan Ye
Ranch Hand

Joined: Mar 05, 2003
Posts: 172
Thanks all. The problem is as stated by Nicolas, seems that Tomcat4 doesn't support class by calling its full name. I solved the problem by modifying web.xml. Thanks again.
I agree. Here's the link:
subject: please help
It's not a secret anymore!