• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Eror 404 in accessing Servlet

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!!
Environment : Tomcat 3.3 , jdk 1.3
I have written one servlet "TestingServlet.java" and stored in the following directory structure
tomcat\webapps\myApp\WEB-Inf \classes\TestingServlet.java
When i try to access this servlet with url
http://localhost:8080/myApp/servlet/TestingServlet
I get message "404"
Please advise!!
Thanks,
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A servlet engine will NOT compile your servlet for you - it will only recognize a class file. The only compilation a servlet engine does automatically is for JSP files.
You will get better results if you put the TestingServlet in a package, in which case the location under WEB-INF/classes must reflect the package name. Study how the Tomcat examples are done.
Bill
 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
404 is the File Not Found Error
Your server is trying to find a .class file...if you store the .java of course it wont work...
But if what you want is to get the .java file (who knows) then you should ask the browser for TestingServlet.java , not only TestingServlet
 
Anil Jain
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi William and Juanjo!
Thanks for replying my question. You guys were correct, my compiler was not generating .class file in the folder for some reason. I corrected it and now I am getting .class file.
My problem is solved. Thanks for the specific remedy.
Thanks,
 
permaculture is largely about replacing oil with people. And one tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic