• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

please help

 
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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/...
 
Ranch Hand
Posts: 5399
1
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
did you modify web.xml ??
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic