• 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Tomcat Error: Requested Resoure is not available

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am creating a web application using servlets and derby with tomcat 6.0.26.

Till now, I have created only 2 forms and one servlet.

I had done it in NetBeans and unfortunately my system broke down midway.

I have the project source code and am now trying to do it on a very old system using the non-IDE way.

The 2 pages are login.jsp and response.jsp and the response page just says a Hi, <username> when the user enters his name, after checking it in the database.

I have deployed the application correctly (not completely i think).

I get this error after entering a user name and password at the login page.


"HTTP Status 404 - Servlet LoginValidationServlet is not available

type Status report

message Servlet LoginValidationServlet is not available

description The requested resource (Servlet LoginValidationServlet is not available) is not available."



The class file for the servlet is located at:
web-inf/classes/servlets/LoginServlet.class

as the servlet is in the "servlets" package.


No errors in apache-root/logs/catalina <date here>.log and no other errors as of now.


Here is my web-xml file.


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


<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">


<display-name>
ARGS
</display-name>

<description>
ARGS Desc Here
Based on servlets and jsp.
</description>

<servlet>

<servlet-name>LoginValidationServlet</servlet-name>
<servlet-class>servlets.LoginServlet</servlet-class>

</servlet>
<servlet-mapping>
<servlet-name>LoginValidationServlet</servlet-name>
<url-pattern>/Login.do</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>15</session-timeout>
</session-config>
<welcome-file-list>

<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

</web-app>


Can you have a look..??
 
Ranch Hand
Posts: 820
IntelliJ IDE VI Editor Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does catalina.out say?

This web.xml looks correct.
 
Krish Iyer
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for replying Tim.

It has no error at all.
Server starts up normally.

I am expecting an error while connecting to the database (coz I ma still learning jdbc ), but not when I ma trying to display the index.jsp page, which is static.


 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE VI Editor Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is your web-inf directory really lower case? It has to be upper case (WEB-INF), though this should give a different error, I think.
 
Krish Iyer
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks again Tim.

My folder's named WEB-INF.

I accidentally typed it web-inf while posting the Q.
 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does LoginServlet has included in the servlet class file?
 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE VI Editor Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Krish Iyer wrote:Thanks for replying Tim.

It has no error at all.
Server starts up normally.

I am expecting an error while connecting to the database (coz I ma still learning jdbc ), but not when I ma trying to display the index.jsp page, which is static.




so what is the "action" of the login form?
 
Krish Iyer
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

shivendra tripathi wrote:Does LoginServlet has included in the servlet class file?



Yes.

 
Krish Iyer
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim McGuire wrote:
so what is the "action" of the login form?



<form action="Login.do" method="post">

Thats the code in the index.jsp.
 
Krish Iyer
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for all your suggestions..!!

I could not find out what the error was, so I scrapped everything and started afresh and I am able to pull up the index.jsp page now.

Now I am getting the error for database connectivity, that I was expecting.

Here's my new web.xml:




It pulls up the index.jsp page properly.
The index.jsp page accepts a username and password which is passed along to the servlet.

The problem is, if I uncomment the <resource-ref> . . . </resource-ref> tags in my web.xml, I get a very long and complex SEVERE error in the Tomcat console, which ends with a sentence that says my application [/args] has not been deployed.

And if I comment it, I receive an error in my browser that says:

"
description: The server encountered an internal error () that prevented it from fulfilling this request.

exception:
javax.servlet.ServletException: NamingException: Cannot retrieve java:comp/env/jdbc/ARGS_DB
servlets.LoginServlet.init(LoginServlet.java:247) . . . . (some more lines here)

root cause:
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
org.apache.naming.NamingContext.lookup(NamingContext.java:770) . . . . (some more lines here)
"

Here's some code from my LoginServlet.java:



I have included derby.jar and derbyclient.jar in [tomcat]\common\lib
The Derby database is located at [tomcat]\Databases\ARGS_DB.


Can someone please guide me as to what might be happening here.

Thanks in advance.
 
Krish Iyer
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
FYI, I used this as a tutorial:

Embedding Apache Derby in Tomcat and creating an iBATIS JPetStore Demo
 
Krish Iyer
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I could resolve the problem.
It was a very silly mistake on my part.




I uncommented the code in web.xml and replaced <resource-ref-name> with
<res-ref-name>...

That solved the issue...

Now I get the error:

Cannot create JDBC driver of class '' for connect URL 'null'

which is what I was expecting in the first place..

Will learn some more about this.

I ma closing this thread.

Thanks for all your help again.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic