Hi Friends
                Iam tring to use connection pooling in my servlet. For that
iam using a singleton class.
            The problem is when iam trying to call the static method of the
singleton class method,  getInstance() which returns a static object of that
class , iam getting an VerifyError. I had put the class in the same package
as that of the servlet.
The singleton class gets the database drivername , DSNname,username &
password from db.properties file. I put that file too in the same folder as
that of the servlets  .Iam getting Verify Error at the line super.init(sc).



I also tried  by putting singleton class in the classes directory of
JavaWebserver2.0. Then iam not getting any error in the servlet but the
singleton class is not able to load the db.properties file even though both
of them are in the same folder "classes"
The singleton class is accessing the db.properties in the following way
InputStream is = getClass().getResourceAsStream("/db.properties");

mycode is something like this
       package scart;
        import java.io.*;
       import java.servlet.*;
       import java.http.servlet.*;
       public class addItem extends HttpServlet
          {
              DBConnectionManager Dbcn;
             init(ServletConfig sc)throws ServletException
             {
                 super.init(sc); /* iam getting an error at this line*/
                Dbcn=DBConnectionManager.getInstance();
             }

              public void doPost(HttpServletRequest req,HttpServletResponse
res)

throws  ServletException IOException
               {

                         PrintWriter pw= res.getWriter();
                          Connection con=Dbcn.getConnection("UserDB");
/*userdb is the name of the pool
                                                               which
contains the database infornmation in db.properties file*/
                          Statement st=con.createStatement();
                      ...
                      ....
                      ....

                      ...
                      ....
                      ....

                       Dbcn.freeConnection("UserDB",con);
                }
                public void destroy()
                  {
                     Dbcn.release();
                  }
}
 Is this because of the classloader?
why the class is not able to read from the db.properties file or why iam
getting an VerifyError when i put Singleton class in the same package as
that of servlet.?
please help me

regards
raj

___________________________________________________________________________
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