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

Requested resource is not available in Tomcat

Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
If you configure the servlet for URL "/Login", then trying to access it at "/Login/Login" is not going to work. Change the action attribute of the HTML form accordingly.

(Edit: looks like there is a bug in the forum software that lists this posts ahead of the others...)
charishma chitti
Greenhorn

Joined: Nov 06, 2011
Posts: 1
Hi

I have a simple servlet application where a HTML login form directs to my servlet. I have placed the Login app in webapps under Tomcat. Widin Login app , I have created login.html and WEB-INF dir wid web.xml & classes dir. Ihave placed the corresponding servlet class loginsvlt.class in classes directory.

web.xml:

<?xml version="1.0" encoding="UTF-8" ?>

<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 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<display-name>Login Application</display-name>
<description>
This is a simple web application with a source code organization
based on the recommendations of the Application Developer's Guide.
</description>

<servlet>
<servlet-name>LOGIN</servlet-name>
<servlet-class>loginsvlt</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>LOGIN</servlet-name>
<url-pattern>/Login</url-pattern>
</servlet-mapping>

</web-app>


As I dont have any package structure under classes, I have given the servlet-class as loginsvlt.

Started tomcat..http://localhost:8080/Login/login.html

Got 404 error ...Requested resource /Login/Login is not available.

Please help! Im a newbie to servlets. Im struck at this point since yesterday even after restarting tomcat several times.

PS: I have a simple Date application(first app deployed in tomcat) where I followed the same configuration and its working fine.


Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3051
    
  36

Welcome to JavaRanch.
charishma ps wrote:As I dont have any package structure under classes

You really need to have some packaging structure. Also, you better follow some naming conventions when naming a class - for instance, first letter of every word in the class name must be in upper case. Try packaging your servlet in something like com.pkg, and try using the fully qualified class name under servlet-class element.

<servlet-class>com.pkg.LoginServlet</servlet-class>

Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Requested resource is not available in Tomcat