File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets 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
JavaRanch » Java Forums » Java » Servlets
Bookmark "The requested resource is not available." Watch "The requested resource is not available." New topic
Author

The requested resource is not available.

Lee Chi Ho
Greenhorn

Joined: Aug 17, 2011
Posts: 3
I have installed Eclipse and Tomcat as a server.

However the following error cannot be resolved.

I am wondering what the error is on my servlet.

Thanks for your kindly help~~~
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Welcome to JavaRanch!
Please, SeachFirst
lakshmana dhanimireddi
Greenhorn

Joined: Jul 05, 2011
Posts: 18

may be your deployment descriptor web.xml is wrong or not available in your directory structure. (for servlets in tomcat)(i don't know about elipse).
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

Without more details it's impossible to say. Most likely your URL does not match the mapping in the deployment descriptor, or perhaps you haven't mapped the servlet at all.

The use of the term "servlet" in the URL make me suspect the latter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Lee Chi Ho
Greenhorn

Joined: Aug 17, 2011
Posts: 3
Thanks for all your replies, and I am very delighted due to your kindly help

Actually, I am a newer of Java servlet and created a simple servlet called hello.

The following is the code



I have do all procedures (installing server according to the instruction proposed both on internet and my lab notes) lots of times. However the error still occurs. Indeed, I don't know how to match the mapping and I think the eclipse can do it internally.

Therefore what should I do next step?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

We need to know how the servlet is mapped to a URL in the deployment descriptor (web.xml).
Lee Chi Ho
Greenhorn

Joined: Aug 17, 2011
Posts: 3
There is one at my server and I have not created web file.

And the followings are some parts in the file (Other servlets and mappings are uncommented)

<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
- <init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
- <init-param>
<param-name>listings</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
- <init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
- <init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
- <!-- The mappings for the JSP servlet
-->
- <servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.jspx</url-pattern>
</servlet-mapping>

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

If your web app has no web.xml, you cannot call any servlets.

I think at this point you need to find a good tutorial on how to set up a web application.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The requested resource is not available.