this solution seems very basic.
but its better u look for some silly causes rather than looking for major
ones.
so let me ask u..
have u compiled the class ?
does ur class file resides in the class path that u have set ??



-----Original Message-----
From: Vivek Bhardwaj [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 19, 2002 4:50 PM
To: [EMAIL PROTECTED]
Subject: pls. help


hi!!
i've written the following servlet, in which i'm
trying to trap error by extending SQLException
class...but its giving internal servlet error.
the servlet and error message its generating on
browser is as:

SERVLET---------------------------------------------

import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;

class RecordException extends SQLException {

        RecordException(){}
        RecordException(String msg) {
                super(msg);
                }
        }

public class CheckPass extends HttpServlet {

        public void doPost(HttpServletRequest req,
HttpServletResponse res) throws ServletException,
IOException {

                Connection con=null;
                Statement stmt=null;
                ResultSet  rst=null;

                res.setContentType("text/html");
                PrintWriter out=res.getWriter();


                try{

                String name=req.getParameter("name");
                String pawd=req.getParameter("pwd");
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

                con=DriverManager.getConnection("jdbc:odbc:test");

                stmt=con.createStatement();

                rst=stmt.executeQuery("SELECT * FROM password where
name='"+ name + "' and password='" + pawd + "'");
                if (rst==null) throw new RecordException();

                rst.next();
                out.println(rst.getObject("name"));

                        }

                catch(ClassNotFoundException e) {
                out.println("Couldn't load the database driver");
                                                }

                catch(RecordException e) {
                                out.println("Please check your ID &
Password!!");
                                        }
                catch(SQLException e) {
                                out.println("SQL Exception caught!!");
                                        }
}

}

ERROR
MESSAGE------------------------------------------

<h1>Error: 500</h1>
<h2>Location:
/checkpass/servlet/CheckPass</h2><b>Internal Servlet
Error:</b><br>
<pre>
java.lang.NoClassDefFoundError: RecordException
        at java.lang.Class.newInstance0(Native Method)
        at java.lang.Class.newInstance(Unknown Source)
        at
org.apache.tomcat.core.ServletWrapper.initServlet(ServletWrapper.java:298)
        at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:445)
        at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:597)
        at
org.apache.tomcat.servlets.InvokerServlet.service(InvokerServlet.java:257)
        at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
        at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:160)
        at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
)
        at java.lang.Thread.run(Unknown Source)
</pre>



please help me out ...

regards
vivek


=====


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html


DISCLAIMER: Information contained and transmitted by this E-MAIL is
proprietary to MASCOT SYSTEMS LTD and is intended for use only by the
individual or entity to which it is addressed, and may contain information
that is privileged, confidential or exempt from disclosure under applicable
law. If this is a forwarded message, the content of this E-MAIL may not have
been sent with the authority of the Company. If you are not the intended
recipient, an agent of the intended recipient or a person responsible for
delivering the information to the named recipient, you are notified that any
use, distribution, transmission, printing, copying or dissemination of this
information in any way or in any manner is strictly prohibited. If you have
received this communication in error, please delete this mail & notify us
immediately at [EMAIL PROTECTED] Before opening attachments,
please scan for viruses

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to