This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

please help  RSS feed

 
Yuan Ye
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5390
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you modify web.xml ??
 
Nicolas Brasseur
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
http://127.0.0.1:8080/Hello
if the webapp where your servlet is deployed is the ROOT webapp of tomcat else the url will be
<a href="http://127.0.0.1:8080/<i rel="nofollow">webappname</i>/Hello" target="_blank">http://127.0.0.1:8080/webappname/Hello
Hope it helps
Nicolas
 
suresh guru
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!