Hello Sanjeev,

    Thank you very much for your response.

    Since the bean class code is big, I am pasting only the code for
ejbPostCreate()  and ejbcreate() here.

****************************************************************************
*******************

public class myebsbean implements EntityBean {

 protected EntityContext ctx;

 public Integer empno;
 public String name;
 public String dsgn;

 public Properties env;

 public myebsbean() { }

 public void ejbPostCreate(Integer no, String name, String dsgn) throws
CreateException, RemoteException { }

 public myebsPK ejbCreate(Integer no, String name, String dsgn) throws
CreateException, RemoteException {
  PreparedStatement pstmt = null;
  Connection conn = null;
  try {
   System.out.println("ejbCreate() called");
   System.out.println("trying to insert " + no + name + dsgn + "into db" );
   this.empno = no;
   this.name = name;
   this.dsgn = "";

  System.out.println("Trying to get the connection");
  conn = getConnection();
  System.out.println("Got the connection");

  pstmt = conn.prepareStatement("insert into EMPDATA (empno, name, dsgn)
values (?,?,?)");
  pstmt.setInt(1,no.intValue());
  pstmt.setString(2,name);
  pstmt.setString(3,dsgn);
  System.out.println("trying to insert " + empno + " " + name + " " + dsgn +
"into db" );

        if (pstmt.executeUpdate() != 1) {
         String error = "JDBC did not create any row";
         throw new CreateException (error);
       }
  System.out.println("Inserted statements into database from Create");
  return new myebsPK(no);
 }
 catch (Exception e) {
  System.out.println("New object not created");
  throw new CreateException(e.toString());
 }
 finally {
  try {
   pstmt.close();
  }
  catch(Exception e) {}
  try {
   conn.close();
  }
  catch(Exception e) {
   System.out.println("Exception in finally of ejbCreate()");
  }
 }
     } // end of ejbCreate
} // end of myebsbean class
****************************************************************************
*******************

Best Regards,
Amit.

----- Original Message -----
From: "Sanjeev Verma" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 09, 2001 4:53 PM
Subject: Re: Exception in EJB Client


> Hi Amit
>
> You would do well to post the code for your bean class, because it is a
> bean specific problem
>
> Regards
>
> Sanjeev
>
> -----Original Message-----
> From: Amit L Kanaskar [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, November 07, 2001 6:35 PM
> To: [EMAIL PROTECTED]
> Subject: Exception in EJB Client
>
> Hello Everybody,
>
>   I am new to EJB.
>   While trying to implement a simple ENTITY Bean (on Weblogic 5.1.0), I
> am
> facing the following problem.
>   I am able to package and deploy the bean correctly and even add a new
> record to the database. However the ** "Client application gives a
>   exception before the home.create(...) function returns to the Client
> code"
> **
>
>   I am creating a record with all the values correctly filled (i.e. no
> field
> contains NULL value).
>
>  Here is some part of the exception thrown
> ************************************************************************
> ****
> **
> Connected successfully using http to amitk/37.0.0.15:7001
> Now looking up for the home object
> Found the home
> java.rmi.UnexpectedException: Unexpected exception in
> myebsbean.create():
> java.lang.NullPointerException:
>         at
> weblogic.ejb.internal.LockManagerImpl.unlock(LockManagerImpl.java,
> Compiled
> Code)
>         at
> weblogic.ejb.internal.StatefulEJBCache.unbind(StatefulEJBCache.java,
> Compiled Code)
>         at
> weblogic.ejb.internal.BaseEJBContext.afterCompletion(BaseEJBContext.java
> ,
> Compiled Code)
>         at
> weblogic.ejb.internal.EntityEJBContext.afterCompletion(EntityEJBContext.
> java
> , Compiled Code)
>         at
> weblogic.ejb.internal.StatefulEJBObject.postInvokeNoTx(StatefulEJBObject
> .jav
> a, Compiled Code)
>         at
> weblogic.ejb.internal.BaseEJBObject.postInvoke(BaseEJBObject.java,
> Compiled
> Code)
>         at myebsbeanEOImpl.create(myebsbeanEOImpl.java:68)
>         at myebsbeanHomeImpl.create(myebsbeanHomeImpl.java:32)
>         at
> myebsbeanHomeImpl_WLSkel.invoke(myebsbeanHomeImpl_WLSkel.java:102)
>         at
> weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerObjec
> tAda
> pter.java, Compiled Code)
>         at
> weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicRequestHa
> ndle
> r.java, Compiled Code)
>         at
> weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.ja
> va,
> Compiled Code)
>         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,
> Compiled
> Code);
>         nested exception is: java.lang.NullPointerException:
> ..
> ..
> ************************************************************************
> ****
> **
>
>  Also, please let me know if this is not the appropriate forum to ask
> such
> type of questions.
>
>  A promt reply would be GREATLY appreciated.
>
> Best Regards,
> Amit
>
> ========================================================================
> ===
> 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".
>
>
===========================================================================
> 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".
>
>

===========================================================================
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".

Reply via email to