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!
If this is what you did (which looks right) then
should work for you.
If you like, you can try some of my examples @
They're all war files so you only need to drop them in your webapps folder and they will run.
They all have proper mappings and directory structures.
[ February 27, 2005: Message edited by: Ben Souther ]
Yeah, I'm running my apps by loading http://localhost/helloworld/HelloWorld (Tomcat is set up to use port 80 instead of 8080)
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!
(Tomcat is set up to use port 80 instead of 8080)
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.
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.
I've got problem where "The requested resources is not avalaible"
Package : Report
Servlet : ReportOperation
Structure web.xml :
Could anybody help....realy needs ur help...
Welcome to JavaRanch!
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.
You can change it here
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.