Hi ejb gurus,
I am wrote an Entity Bean (BMP). Its working fine when
only a single user
is connected. When multiple users are conncted its giving the error. Only
one user is succeding in getting results and remaining are getting the
following exception.
---------------------------Exception----------------------------------------
---
java.sql.SQLException: java.lang.NullPointerException:
at
weblogic.jdbc20.rmi.SerialConnection.createStatement(SerialConnection.java:4
4)
at igine.billing.Bill2Bean.updateCustPaymentRecord(Bill2Bean.java, Compiled
Code)
at
igine.billing.Bill2BeanEOImpl.updateCustPaymentRecord(Bill2BeanEOImpl.java:4
22)
at jsp_servlet._payresults._jspService(_payresults.java:103)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:105)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:123)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:742)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:686)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
Manager.java:247)
at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:361)
at
weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:261)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
Code)
----------------------------------------------------------------------------
------
In my bean code I have a singl public Connection object which is used by
all the methods. I am opening the connection in the create() itself and
closing it by calling a function called
closeall(). I am just unable to find the bug. Can some one hlep me in this
regard please. Help will be highly appreciated.
Thanx and regards,
Sriram
Bean code:
public class Bill2Bean implements EntityBean
{
final static private boolean VERBOSE = true;
protected EntityContext entityContext;
public String NAME;
Connection con=null;
String strSec=null;
String newLine = null;
double prepaidamt = 0.0;
public Bill2BeanPK ejbCreate()throws RemoteException, EJBException,
CreateException
{
if(con==null)
{
try
{
getConnection();
}
catch(SQLException ee)
{
System.out.println(ee.getMessage());
}
}
return new Bill2BeanPK();
}
public ResultSet getResultSet(int stmtnum)
{
return(rs);
}
public Vector getCoyID(int stmtnum)
{
return(v);
}
public ResultSet executeQuery(String stmt)throws SQLException
{
return(rs);
}
public void updateQuery(String stmt)throws SQLException
{
}
public String getID(String stmt)throws SQLException
{
return(rs.getString(1));
}
//Business Methods
public void function1()
{
}
public void function2()
{
}
public void getConnection() throws SQLException
{
InitialContext initCtx = null;
try {
initCtx = new InitialContext();
System.out.println("Attempting to lookup weblogic Database pool");
DataSource ds =
(javax.sql.DataSource)initCtx.lookup("java:comp/env/jdbc/oraclePool");
System.out.println("Found Connection Pool");
try
{
System.out.println("Attempting to get connection from weblogic Database
pool");
this.con=ds.getConnection();
} catch(SQLException e) { System.out.println("Error getting
connection"+e); }
}
public void closeAll() throws SQLException
{
try
{
if(con!=null)
{
con.close();
System.out.println("Connection closed");
}
}
catch(SQLException ee)
{
System.out.println(ee.getMessage());
}
}
}
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".