Looks like the inner class isn't on the classpath - something like CheckPass$RecordException.class (if I remember correctly).
--- Danny Ayers <stuff> http://www.isacat.net </stuff> >-----Original Message----- >From: A mailing list for discussion about Sun Microsystem's Java Servlet >API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Vivek >Bhardwaj >Sent: 19 February 2002 12:20 >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.processConnect >ion(HttpConnectionHandler.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 > ___________________________________________________________________________ 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
