• Post Reply 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Requested resource is not available in Tomcat

 
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...)
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


 
Sheriff
Posts: 7134
1360
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
reply
    Bookmark Topic Watch Topic
  • New Topic