Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why is my bean locked when i call methods on it  RSS feed

David Rocks
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a been that when i call this line in ejbActivate()
id = new Integer( (String)context.getPrimaryKey() ).intValue() ;
i get an exception, see below. i don't know how i could have locked the bean, container transaction probably. i would think it is a depoyment config thing but i am not to sure. has anybody seen this and know how to fix it?
thanks for any help.
[INFO,Default] UserEntityBean::ejbActivate()
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(
at org.jboss.ejb.BeanLockManager.removeLockRef(
at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(
at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(
at org.jboss.ejb.plugins.LogInterceptor.invoke(
at org.jboss.ejb.EntityContainer.invoke(
at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(
at org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy.invokeContainer(
at org.jboss.ejb.plugins.jrmp.interfaces.EntityProxy.invoke(
at $Proxy97.getId(Unknown Source)
at com.users.EJB.UserManagerSessionBean.isValidUser(
at java.lang.reflect.Method.invoke(Native Method)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(
Tim Holloway
Posts: 18662
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, from about 40,000 feet up, I'd say that you're probably trying to do something simple the hard way.
It would appear that the container has invoked ejbActivate() in response to a bean lookup request. That started a transaction context. Now you're attempting to invoke a bean method - which ITSELF starts a transaction context - while running within that context. Thereby violating the transaction rules you are configured for.
However, before you run off and try all sorts of hacking around on transactions to fix it, consider what you are trying to do. To me, it appears that you've simply trying to find out what your basic primary key value is, prepraratory to loading up the persisted values of a BMP EJB. I think you can find a shorter route than going through the context if you try - after all, the primary key (you appear to have a PK class rather than a wrapper-class object) is already part of the EJB object.
I don't have any samples handy at the moment, but you might want to chase one down and verify that.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!