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:

HTTP Status 404 servlet error ("The requested resource is not available")

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator


<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>

webapps/helloworld/WEB-INF/classes/HelloWorld.class



If this is what you did (which looks right) then
http://localhos:8080/helloworld/HelloWorld
should work for you.


If you like, you can try some of my examples @
http://simple.souther.us
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 ]
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I just got tomcat 5.5.7 setup and just did my testing servlet. The path to access the servlet is:

http://localhos:8080/servlet/HelloWorld
 
Gar Morley
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Thanks for your reply.

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!

Thanks, ~gar
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

(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.
 
Gar Morley
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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.
 
Gar Morley
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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!
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hello...
I've got problem where "The requested resources is not avalaible"

Package : Report

Servlet : ReportOperation

My Mapping:
<servlet>

<servlet-name>ReportOperation</servlet-name>

<display-name>ReportOperation</display-name>

<servlet-class>ReportOperation</servlet-class>

</servlet>



<servlet-mapping>

<servlet-name>ReportOperation</servlet-name>

<url-pattern>/Report</url-pattern>

</servlet-mapping>



Structure web.xml :

C:\jakarta-tomcat-5.0.19\webapps\ROOT\WEB-INF\web.xml

Structure servlet:

C:\jakarta-tomcat-5.0.19\webapps\ROOT\WEB-INF\classes\Report\ReportOperation

Could anybody help....realy needs ur help...
TQ all.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
iman
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.

Good-Luck
 
Aaaaaand ... we're on the march. Stylin. Get with it tiny ad.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
    Bookmark Topic Watch Topic
  • New Topic