I'm having awful problems getting
servlets up and running on
Tomcat 5.5.4 (running under Linux Fedora Core). Every time I try to load a servlet I've written I get an error that says "HTTP Status 404 - /path/myServlet" (with a description further down saying "The requested resource (/path/myServlet) is not available").
The servlet itself is just a simple Hello World app without a package and in the ROOT directory of the Tomcat installation dir (I've tried putting it into a package and in the right directories under the install dir aswell). The web.xml file reads as follows:
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<servlet>
<servlet-name>Hello World</servlet-name>
<servlet-class>HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Hello World</servlet-name>
<url-pattern>/HelloWorld</url-pattern>
</servlet-mapping>
</web-app>
(I didn't copy/paste this file so there might be typos above!)
HTML and
JSP pages load fine if they are under the install_dir/ROOT/ folder but not if they are in a subfolderunder ROOT (!?) and all the Tomcat example servlets seem to work ok. I've tried putting servlets into the ROOT folder as well as under webapps/helloworld/WEB-INF/classes/HelloWorld.class with the web.xml file in the webapps/helloworld/WEB-INF folder.
Here's what I've tried so far based on info I found on the web:
-- I've enabled the invoker servlet in the main web.xml
-- I've enabled reloadable int the <Context> tag in the main context.xml
-- I've tried using the example servlets' web.xml file and added in my own details
-- I've set up my servlet as a .war in the webapps folder
-- I've gone through the tutorial at
http://www.coreservlets.com/Apache-Tomcat-Tutorial/ and tired to set up Tomcat as described there (Everything works up until I put a HTML or JSP in a subfolder under ROOT or I try the first servlet
test)
...but none of those have worked! =(
I'd be grateful if anyone could give me pointers on where to go from here to get a servlet working. Thanks for reading through all the detail!
~gar morley