Hi.

 

I have used the following code with struts 1.2x and it works just fine. Now
I have upgraded to Struts 1.3.10.

 

Now I get the following error when I try to login to my Struts app.

 

Can anybody point me in the right direction.

 

Soren, DK

 

The Code:

 

package nc.persistence;

 

import java.sql.Connection;

import java.sql.SQLException;

import javax.servlet.http.HttpServlet;

import java.sql.DriverManager;

 

public class PersistenceFacade {

 

  //----------- fields ---------//

 

                      public static final String CONNECTION_DRIVER =
"org.gjt.mm.mysql.Driver";

                      public static final String CONNECTION_USER   =
"username";

                      public static final String CONNECTION_PASS   =
"password";

                      public static final String CONNECTION_URL    = "url";

 

                      static {

    try {

      Class.forName(CONNECTION_DRIVER);

    } catch (ClassNotFoundException ex) {

 
ex.printStackTrace();

    }

                      }

 

                      private String connectionUrl  = null;

                      private String connectionUser = null;

                      private String connectionPass = null;

 

 

 

                      //------------ constructors -----------//

 

                      //public PersistenceFacade() {}

 

                      public PersistenceFacade(HttpServlet servlet) {

                                            connectionUser =
servlet.getInitParameter(CONNECTION_USER);

                                            connectionPass =
servlet.getInitParameter(CONNECTION_PASS);

                                            connectionUrl  =
servlet.getInitParameter(CONNECTION_URL);

                      }

 

                      //------------- public methods -----------//

 

                      public Connection getConnection() throws SQLException
{

                                            if(connectionUser == null) {

                                                                 throw new
SQLException("Missing parameter "+CONNECTION_USER);

                                            } else if(connectionPass ==
null) {

                                                                 throw new
SQLException("Missing parameter "+CONNECTION_PASS);

                                            } else if(connectionUrl == null)
{

                                                                 throw new
SQLException("Missing parameter "+CONNECTION_URL);

                                            }

                                            return
DriverManager.getConnection(

 
connectionUrl,

 
connectionUser,

 
connectionPass

                                            );

                      }

 

                      public void closeConnection(Connection conn) {

    try {

      if(!conn.isClosed()) {

        conn.close();

      }

    } catch (SQLException ex) {

 
ex.printStackTrace();

    }

                      }

 

                      //------------ private methods ----------//

}

Reply via email to