File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes The requested resource is not available Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "The requested resource is not available" Watch "The requested resource is not available" New topic
Author

The requested resource is not available

Darren Hall
Greenhorn

Joined: Jan 22, 2006
Posts: 12
Simple problem (hopefully) and I've been here before, but for some reason I can't find my way through this error.

Here's the scenario:

I've written a servlet which I'm deploying in Tomcat 5.5 using Apache 2.2 as the web server. The servlet is a controller for one domain I have on my server (lets call it the 'abc' domain.) The servlet is bundled into a war file and deploys into Tomcat with no errors. The servlet-mapping in the web.xml file defines the following:

<!-- Controller Servlet Configuration -->
<servlet>
<servlet-name>controller</servlet-name>
<servlet-class>com.abc.framework.controller.ControlServlet</servlet-class>
</servlet>

<!-- Controller Servlet Mapping -->
<servlet-mapping>
<servlet-name>controller</servlet-name>
<url-pattern>/abc</url-pattern>
</servlet-mapping>

I've configured my httpd-vhosts.conf file to do a proxy pass through as follows:

<VirtualHost www.abc.com>
DocumentRoot /work/abc/abc-app/deploy/var/www/htdocs/abc
ServerName www.abc.com
ServerPath /abc
ErrorLog logs/abc/www.abc.com-error_log
CustomLog logs/abc/www.abc.org-access_log common

ProxyRequests Off
ProxyPass / http://localhost:8080/abc
ProxyPassreverse / http://localhost:8080/abc
</VirtualHost>

When I point my browser at http://www.abc.com/, I get a Tomcat error "The requested resource (/abc) is not available."

This indicates to me that the proxy pass through is working properly in Apache, but that Tomcat is not handing off the request to my serlvet.

What have I done wrong?

Thanks for the help.

Darren Hall
[ July 18, 2006: Message edited by: Bear Bibeault ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

Moved to the Tomcat forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Darren Hall
Greenhorn

Joined: Jan 22, 2006
Posts: 12
One more thing I tried -

When I point my browser at http://localhost:8080/abc, I get the same Tomcat error "The requested resource (/abc) is not available.", so the Apache configuration is irrelevant.

Something is wrong with the way I have things set up in Tomcat.

Any ideas?

Thanks,

Darren
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Did you deploy your application as the default app within Tomcat?
By default, Tomcat ships with the ROOT app (found under the webapps directory) as it's default app.

If so, how did you configure abc to be the default app?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Darren Hall
Greenhorn

Joined: Jan 22, 2006
Posts: 12
Thanks for the reply Ben.

No, I didn't install the app as the default Tomcat app (at least I didn't mean to). This instance of Tomcat will eventually host 3 web apps for me, and I wanted each to be wholy and completely seperate. The ROOT app in Tomcat still exists, and when I point a browser to http://localhost:8080/ it displays the default Tomcat page (with links to the manager, examples, etc. in the left-hand menu).

I had wanted to manage things by URL so that if the URL pattern '/abc' came in, it would map to the web app I am trying to deploy.

Is this not correct? In the past I seem to remember having been able to do this, and I was able to get things configured properly. Unfortunately this was a few years ago, and I no longer remember how I did it.

Thanks,

Darren

[ July 19, 2006: Message edited by: Darren Hall ]
[ July 19, 2006: Message edited by: Darren Hall ]
Darren Hall
Greenhorn

Joined: Jan 22, 2006
Posts: 12
I've resolved the issue.

Essentially the war file was named 'foo.war' and was deploying to the webapps/foo/ directory, yet I was looking for the abc/ url mapping for my servlet.

By renaming my war to abc.war and having it deploy in the webapps/abc/ directory the mapping worked correctly and the servlet could be reached.

I'm not sure if this is the "correct" answer, but it does work, so I'll take it for now.
[ July 24, 2006: Message edited by: Darren Hall ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Glad you've resolved it.
Thank you for posting back with your solution.
Simpson Bart
Greenhorn

Joined: Mar 29, 2008
Posts: 1
Hi, I experienced the same problem. I've been executing some examples from the Java book. After two days of exploring, I discovered that the solution was very simple:

Appache server is sensitive to capital letters and therefore it makes the difference between "web.XML" and "web.xml". The file named "web.XML" is not recognized by the Apache as valid web.xml file. It must be "web.xml"!
Vaibhav Agrawal
Greenhorn

Joined: Jul 15, 2011
Posts: 4
Following is my web.xml file. I am building OMT.war and trying to deploy it on Tomcat server , following error comes:The requested resource (/OMT/) is not available.



Help me out.Stuck on this for a long time
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12676
    
    5
1. Exactly what is the URL you are trying?
2. Have you checked the log files for more information?

Bill

Java Resources at www.wbrogden.com
Vaibhav Agrawal
Greenhorn

Joined: Jul 15, 2011
Posts: 4
I am trying localhost:8080/OMT/ and I guess OMT.html should be displayed.
And yes I have seen the log files and it does not show any error message.Does my xml needs some correction?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12676
    
    5
I am guessing that for some reason, Tomcat does not recognize OMT as a valid web application.

Where did you place the OMT.war? Did Tomcat expand it to an OMT directory?

Bill
Vaibhav Agrawal
Greenhorn

Joined: Jul 15, 2011
Posts: 4
OMT.war is placed in project folder OMT/ and yes tomcat expands it to seperate OMT folder.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12676
    
    5
Checking your file with XML SPY - it identifies a problem at your second servlet element:

"Unexpected child element 'servlet'

If I remove that element XML SPY says its valid.

Right offhand I can't see what it doesn't like but that diagramServlet element is what it is objecting to.

Bill
Vaibhav Agrawal
Greenhorn

Joined: Jul 15, 2011
Posts: 4
Thank you for pointing out the error , i will look into that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The requested resource is not available
 
Similar Threads
trying to run hello world script but it is not
Problem with URL-PATTERN tag
straing servlet URL
servlet-mapping
Stuck on HelloWorldServlet