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:
(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!
I've tried your SimpleServlet (thanks for the link) but that didn't work either. Does that suggest a Tomcat configuration problem to you? I'm going to post a plea on the Tomcat forum to see if anyone there has seen the problem, but if you think of anything servlet related I'd love to hear it here!
There's your problem. Look at TOMCAT_HOME/logs/catalina.out and you will probably see some "net bind exceptions".
Unix doesn't allow any processes to bind to ports < 1024 unless started by root.
Change the port back to 8080 until you have everything else running. There are some options for getting to Tomcat to run on port 80 as a user other than root but get through the basics servlet stuff first.
Joined: Dec 15, 2004
Port 80 seemed to be working fine (it brought up the test page etc (I couldnt find any net bind exceptions in catalina.out either)) but I changed it back to port 8080 anyway, but to no avail =( I'm still getting the same error whether I try to load one of my own servlets or one of your .war files.
I think I'l try to update Tomcat, or maybe try to set it up on a different machine.
Thanks for your help Ben and Brian, I'll post if I find a solution.
Joined: Dec 15, 2004
I decided to give up on getting my tomcat 5.5.4 install to work so I downloaded 5.5.7. It _still_ didn't work when I installed it, but on restarting the computer I found that I had tomcat set to start up in my /etc/rc5.d/ directory. Once I removed the start and kill links in there it worked fine!
We're pleased to have you here with us in the Servlets forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
Also, you've just brought up an old thread (raised a zombie). Since most of the participants of this thread have probably moved on and since, in the case of this thread, the problem had to do with permissions on ports, it would be better if you started a new thread with your question.