This week's giveaway is in the Threads forum.
We're giving away four copies of Java Concurrency Live Lessons and have Doug Schmidt on-line!
See this thread for details.
Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Requested resource is not available in Tomcat  RSS feed

 
Tim Moores
Saloon Keeper
Posts: 3512
77
  • Mark post as helpful
  • send pies
  • 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...)
 
charishma chitti
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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.


 
Devaka Cooray
Marshal
Posts: 5326
575
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • 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>
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!