call to super.init() seems to have NullPointerException and cannot get a connection.
Did anyone have this issue and know a work around?
package com.cmp.servlet;
import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.DataSource;
import javax.servlet.ServletException;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.util.GenericDataSource;
import com.cmp.db.IdentifyDatabase;
/**
* Make sure to identify the default database in use upon
* starting/initializing this context.
*
* @version 27 February 2002
*/
public class MowerPartsActionServlet extends ActionServlet{
public void init()
throws ServletException{
super.init();
DataSource dataSource = this.findDataSource(null);
try{
Connection conn = dataSource.getConnection();
IdentifyDatabase.setDB(conn);
conn.close();
System.out.println("Database detected: " + IdentifyDatabase.getDB());
} catch (SQLException e){
this.log("Error getting DB connection.", e);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]