aspose file tools*
The moose likes Servlets and the fly likes Tomcat: The requested resource () is not available. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Tomcat: The requested resource () is not available." Watch "Tomcat: The requested resource () is not available." New topic
Author

Tomcat: The requested resource () is not available.

Diego Braga
Greenhorn

Joined: Nov 05, 2008
Posts: 6
Hi!! I'm looking for an answer to my problem, and I'm going to explain what I mean.

I've created a .jar named yuhuuTunnel.jar that has the following structure:

yuhuuTunnel.jar:
--> web (contains the servlets)
--> *.class
--> HelloWorldServlet.class
--> META-INF
--> MANIFEST.MF
--> SimpleClient.class

The code of HelloWorldServlet.java is this:



then, using a .war file (created with ANT), I've created into /../tomcat/webapps/ a directory call yuhuuTunnel that has this structure:


The content of web.xml is the following:



Tomcat works correctly ( http://localhost:8080 return me the page of tomcat ) but when I try to use the HelloWoldServlet typing http://localhost:8080/yuhuuTunnel/HelloWorld into a browser, this one returns me the HTTP Status 404 - The requested resource () is not available.

What is wrong? The address that I type into the browser or there's an error into web.xml?


[BPSouther: Added code tags]
[ November 05, 2008: Message edited by: Ben Souther ]
Diego Braga
Greenhorn

Joined: Nov 05, 2008
Posts: 6
For a better view, I've re-write the structures of the yuhuuTunnel.jar and the structur of my web application in tomcat


yuhuuTunnel.jar:



rakesh sugirtharaj
Ranch Hand

Joined: Dec 16, 2007
Posts: 151
Try doing a out.flush() and out.close() in your servlet.


Cheers!
RSR
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Try changing:


to




See section: SRV.11.2 in the servlet spec (link in my signature) if you are unsure about the syntax for servlet mapping url-patterns.
[ November 05, 2008: Message edited by: Ben Souther ]

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

Joined: Nov 05, 2008
Posts: 6
I've changed

<url-pattern>HelloWorld</url-pattern>

to:
<url-pattern>/HelloWorld</url-pattern>

Stopped and re-started Tomcat, but I still get the 404. Isn't a problem of flush or close!
Diego Braga
Greenhorn

Joined: Nov 05, 2008
Posts: 6
Something interesting: If I type

http://localhost:8080/yuhuuTunnel/HelloWorld

the message given back is: "The requested resource () is not available."

but if I type

http://localhost:8080/HelloWorld the message is different:

"The requested resource (/HelloWorld) is not available."
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I sounds like the application itself isn't being deployed.
Have you looked at any of the server logs to see if there are errors being logged at startup?
Diego Braga
Greenhorn

Joined: Nov 05, 2008
Posts: 6
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Hi Diego Braga,

The question was:
Have you looked at any of the server logs to see if there are errors being logged at startup?


I can see from reading it that there is an exception being thrown when Tomcat tries to parse something....
Can you see what that 'something' is?
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

My eyes caught this line

java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name SetutentiOnline


Now what is SetutentiOnline? And why is it present in your web.xml?


SCJP, SCWCD.
|Asking Good Questions|
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat: The requested resource () is not available.