Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Tomcat config question

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
It�s almost midnight, it�s Saturday, I should be out enjoying myself instead I�m a grown man on the verge of a nervous breakdown. At the moment I think Tomcat is the work of the devil, rant over now my question.
I need to have tomcat running locally as my final year project at college will use servlets. I�ve installed Tomcat and I can run all the jsp and servlet examples and I can also publish web pages but when I compile an HelloWWW.java and place the HelloWWW.class in C:\Java\Tomcat 4.1\webapps\ROOT\WEB-INF\classes, I get the following message
HTTP Status 404 - /servlet/HelloWWW
type Status report
message /servlet/HelloWWW
description The requested resource (/servlet/HelloWWW) is not available.
Apache Tomcat/4.1.17-LE-jdk14
I can�t even access any file in this directory. But I�ve tried placing the class file else where i.e. where the examples and that also doesn�t work.
I�m completely stuck I followed the instructions on this website
http://www.moreservlets.com/Using-Tomcat-4.html
successfully until �Compile and Test Some Simple Servlets�, from then on everything goes pear shaped.
Any help would be greatly appreciated.
I now going home to cry myself to sleep as this is ^%&ing sole destroying.
Thanks in advance for any help
Mal
 
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
You need to study how web.xml is used to configure servlets and relate urls to the actual servlet class. For one thing, you might as well bite the bullet and put your servlet class in a package. I know the examples servlets don't use packages, but that leads lots of people astray.
Look at the web.xml in the examples. You will see that they define servlets like this:

Thats why they can get away without a package. If Tomcat sees a reference to HelloWWW in a URL but doesn't find it in a web.xml, you get an error.
You could probably run your HelloWWW from the examples by adding an entry for it in web.xml.
You need to download the Servlet API from java.sun.com and study how web.xml is used to define servlets and the servlet environment.
Bill
 
reply
    Bookmark Topic Watch Topic
  • New Topic