Discussions

EJB programming & troubleshooting: Lease value error

  1. Lease value error (10 messages)

    Hi,
    This is exception we are facing with. This happens after 10 minutes of the client idle time start.
    Could anyone help in this.

    Exception in non-transactional EJB invoke:
    javax.ejb.CreateException: A bean primary key field may not be null after ejbCreate has been called
    at weblogic.ejb.internal.StatefulEJBObject.postCreate (StatefulEJBObject.java:227)
    at
    justarrive.backend.billing.PaymentDataBeanEOImpl.create (PaymentDataBeanEOImpl.java:60)
    at
    justarrive.backend.billing.PaymentDataBeanHomeImpl.create (PaymentDataBeanHomeImpl.java:32)
    at
    justarrive.backend.billing.PaymentDataBeanHomeImpl_ServiceStub.cr eate(PaymentDataBeanHomeImpl_ServiceStub.java:180)

    at justarrive.backend.ICSBillDataBean.ccAuthBill (ICSBillDataBean.java:206)
    at justarrive.backend.ICSBillDataBeanEOImpl.ccAuthBill (ICSBillDataBeanEOImpl.java:142)
    at justarrive.backend.ICSBillDataBeanEOImpl_WLSkel.invoke (ICSBillDataBeanEOImpl_WLSkel.java:79)
    at
    weblogic.rmi.extensions.BasicServerObjectAdapter.invoke (BasicServerObjectAdapter.java:338)
    at
    weblogic.rmi.extensions.BasicRequestHandler.handleRequest (BasicRequestHandler.java:69)
    at weblogic.rmi.internal.BasicExecuteRequest.execute (BasicExecuteRequest.java:15)
    at weblogic.kernel.ExecuteThread.run
    (ExecuteThread.java:120)

    Tue Aug 15 17:52:27 PDT 2000:<I> <DGCserver> tried to renew lease for 1 lost reference(s).
    Tue Aug 15 17:52:27 PDT 2000:<I> <DGCserver> tried to renew lease for 1 lost reference(s).
    Tue Aug 15 17:52:27 PDT 2000:<I> <DGCserver> tried to renew lease for 1 lost reference(s).
    Tue Aug 15 17:52:27 PDT 2000:<I> <DGCserver> tried to renew lease for 1 lost reference(s).
    Tue Aug 15 17:52:27 PDT 2000:<I> <DGCserver> tried to renew lease for 1 lost reference(s).
    Tue Aug 15 17:53:26 PDT 2000:<I> <DGCserver> tried to renew lease for 1 lost reference(s).
    Tue Aug 15 17:53:26 PDT 2000:<I> <DGCserver> tried to renew lease for 1 lost reference(s).
    Tue Aug 15 17:53:26 PDT 2000:<I> <DGCserver> tried to renew lease for 1 lost reference(s).
    Tue Aug 15 17:53:26 PDT 2000:<I> <DGCserver> tried to renew lease for 1 lost reference(s).


    Thanks,
    Nicklesh

    Threaded Messages (10)

  2. Lease value error[ Go to top ]

    Looks like the ejbCreate doesn't return a primary key properly.
    If you look at the error it says "A bean primary key field may not be null after ejbCreate has been called"

    During the ejbCreate the primary key has to be complete, and not contain any nullvalues

    Filip
  3. Lease value error[ Go to top ]

    Hi Philip,
    I have fixed that. Inspite of that it still returns the same error.
    Additions:
    the environment here is EJB, JSP and weblogic 5.1

    Thanks,
    N
  4. Lease value error[ Go to top ]

    what does your ejbCreate code look like?

    are you using CMP or BMP?

    Filip
  5. Lease value error[ Go to top ]

    Hi Filip,
    We have a stateful session bean which calls the entity bean based on different validations. This session bean basically keeps track of the users from the login to logout. The entity beans are called when the user makes any kind of transactions. One entity bean hold the user details and the other entity bean holds the transactional information.
    The error we are getting is when the user is idle for 10 minutes. He automatically loses connection with the server. The server keeps sending the message...
    <DGCserver> tried to renew lease for 1 lost reference(s).
    I hope this information is enough. If not let me know.
    Thanks,
    N
  6. Lease value error[ Go to top ]

    This is the ejbCreate method:

        public PaymentDataPK ejbCreate(Payment payment) throws CreateException, SQLException, RemoteException, EJBException {

    declarations;

            try{

    defining connection;
    PaymentDataPK primaryKey = new PaymentDataPK(paymentID);

                creating statement;

               if(ps.executeUpdate() != 1) {
                    throw new CreateException("Failed to add Payment to database.");
                }
                return primaryKey;
            }catch(Exception se) {
                se.printStackTrace();
            } finally {
                try{
                    if(result != null)
                        result.close();
                    if (ps != null)
                        ps.close();
                    if(conn != null)
                        conn.close();
                }catch (SQLException se) {
                    se.printStackTrace();
                }
            }
            return null;
        }
  7. Lease value error[ Go to top ]

    It looks like it throws an exception, catches it, and returns null:

    try{
    ...
      return pk;
    }catch(Exception se) {
      se.printStackTrace();
    } finally {
    ...
    }
    return null;
  8. Lease value error[ Go to top ]

    I tried as you have advised but this is what i get

    Tue Oct 24 19:22:20 PDT 2000:<I> <DGCserver> tried to renew lease for 1 lost reference(s).
    Tue Oct 24 19:22:20 PDT 2000:<I> <DGCserver> tried to renew lease for 1 lost reference(s).
    Tue Oct 24 19:22:20 PDT 2000:<I> <DGCserver> tried to renew lease for 1 lost reference(s).
    Tue Oct 24 19:22:20 PDT 2000:<I> <DGCserver> tried to renew lease for 1 lost reference(s).
    Tue Oct 24 19:22:20 PDT 2000:<I> <DGCserver> tried to renew lease for 1 lost reference(s).

    This is after fixing the primarykey problem
    Thanks,
    N
  9. Lease value error[ Go to top ]

    do you still return null in the ejbCreate method?
    The ejbCreate method should never return null, it should throw a CreateException.

    Please, post the complete code
    thanks
    Filip
  10. Lease value error[ Go to top ]

    Here is the actual code for ejbCreate():

        public PaymentDataPK ejbCreate(Payment pymt) throws CreateException, SQLException, RemoteException, EJBException {

            this.jID = pymt.getJID();
            this.pymtTpID = pymt.getPymtTpID();
            this.cCNo = pymt.getCCNo();
            this.expMnth = pymt.getExpMnth();

            Connection conn = null;
            PreparedStatement ps = null;
            ResultSet result = null;

            try{

               Class.forName("weblogic.jdbc.pool.Driver").newInstance();
               conn = DriverManager.getConnection("jdbc:weblogic:pool:oraclePool", null);

                ps = conn.prepareStatement("SELECT PYMT_ID_SEQ.NEXTVAL FROM DUAL");
                result = ps.executeQuery();
                if(!result.next()) {
                    throw new ObjectNotFoundException("Unable to get next PAYMENT_ID_SEQ"
                        +" value.");
                } else {
                    this.pymtID = result.getInt(1);
                }

               PaymentDataPK primaryKey = new PaymentDataPK(pymtID);

               ps = conn.prepareStatement("INSERT INTO pymt_trans (j_id, "
                    +"pymt_id, pymt_tp_id, c_c_no, exp_mnth) VALUES(?,?,?,?,?)");
                ps.setInt(1, jID);
                ps.setInt(2, pymtID);
                ps.setInt(3, pymtTpID);
                ps.setString(4, cCNo);
                ps.setString(5, expMnth);

               if(ps.executeUpdate() != 1) {
                    throw new CreateException("Failed to add Payment to database.");
                }
                return primaryKey;
            }catch(Exception se) {
                se.printStackTrace();
            } finally {
                try{
                    if(result != null)
                        result.close();
                    if (ps != null)
                        ps.close();
                    if(conn != null)
                        conn.close();
                }catch (SQLException se) {
                    se.printStackTrace();
                }
            }
            return null;
        }


    Thanks,
    Nicklesh
  11. Lease value error[ Go to top ]

    It definitely looks like your ejbCreate method returns null.