0 Replies Latest reply on Jun 20, 2002 8:44 AM by davidrocks

    Why Is my bean locked when i call methods

    davidrocks Newbie

      Hi,

      I have developed a bean for my system on JBoss 2.4.4. When i call find by primary key the bean is activated and i have a line of code that sets the pk from the context.

      id = new Integer( (String)context.getPrimaryKey()).intValue() ;

      when it is called i get an exception shown below saying that the bean is locked. I just don't know why this is happening. can anybody help me on this one. i have also got my descriptor as i suspect it is config based the problem.

      Cheers for any help at all

      david


      UserImpl
      <ejb-name>UserImpl</ejb-name>
      com.users.EJB.UserHome
      com.users.EJB.User
      <ejb-class>com.users.EJB.UserImpl</ejb-class>
      false
      <persistence-type>Bean</persistence-type>
      <prim-key-class>com.users.EJB.UserPK</prim-key-class>
      <transaction-type>Container</transaction-type>
      <resource-ref>
      Datasource for the Database
      <res-ref-name>java:/OracleDB</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>




      [INFO,Default] =================================
      [INFO,Default] UserEntityBean::ejbActivate()
      [ERROR,UserImpl] TRANSACTION ROLLBACK EXCEPTION:
      javax.transaction.TransactionRolledbackException: removing bean lock and it has tx set!; nested exception is:
      java.lang.IllegalStateException: removing bean lock and it has tx set!
      java.lang.IllegalStateException: removing bean lock and it has tx set!
      at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.removeRef(QueuedPessimisticEJBLock.java:441)
      at org.jboss.ejb.BeanLockManager.removeLockRef(BeanLockManager.java:78)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:142)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:138)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:602)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:100)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:170)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:428)
      at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:504)
      at org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy.invokeContainer(GenericProxy.java:335)
      at org.jboss.ejb.plugins.jrmp.interfaces.EntityProxy.invoke(EntityProxy.java:133)
      at $Proxy97.getId(Unknown Source)
      at com.users.EJB.UserManagerSessionBean.isValidUser(UserManagerSessionBean.java:81)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:542)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:82)