aspose file tools*
The moose likes JBoss/WildFly and the fly likes deadlock exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "deadlock exception" Watch "deadlock exception" New topic
Author

deadlock exception

dragon ji
Ranch Hand

Joined: Oct 31, 2002
Posts: 110
jboss3.2.3 sql server 2000

I have a timertask, run in background regularly. it will visit an entity bean, suppose A.

And also there are other places visit that bean.

all the methods are 'required' configuration. the isolation level is pessimistic

now I often met deadlock exception.

How do I resolve this problem?


scjp 1.4<br />challenge haven't limit!
dragon ji
Ranch Hand

Joined: Oct 31, 2002
Posts: 110
I change the lock to JDBCOptimisticLock by modify standardjboss.xml, the deadlock disappear. but new error happend. the exception is:
2005-01-12 10:44:49,147 ERROR [org.jboss.ejb.plugins.LogInterceptor] RuntimeException:
java.lang.reflect.UndeclaredThrowableException
at $Proxy189.getId(Unknown Source)
......
Caused by: java.lang.InterruptedException
at java.lang.Object.wait(Native Method)
at org.jboss.ejb.plugins.lock.NonReentrantLock.acquire(NonReentrantLock.java:81)
at org.jboss.ejb.plugins.lock.NonReentrantLock.attempt(NonReentrantLock.java:105)
at org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentranceInterceptor.java:82)
at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:163)
at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:89)
at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:54)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:489)
at org.jboss.ejb.Container.invoke(Container.java:700)
at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:375)
at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:38)
... 94 more
dragon ji
Ranch Hand

Joined: Oct 31, 2002
Posts: 110
I did some modification as following:

1: modify jboss.xml, add one container configuration as following:

<container-configurations>
<container-configuration extends="Instance Per Transaction CMP 2.x EntityBean">
<container-name>Optimistic CMP EntityBean</container-name>
<locking-policy>org.jboss.ejb.plugins.lock.JDBCOptimisticLock</locking-policy>
<commit-option>B</commit-option>
</container-configuration>
</container-configurations>

then shift the special bean to this configuration.

2: configure locking policy for the special bean in jbosscmp-jdbc.xml.

<load-groups>
<load-group>
<load-group-name>wo</load-group-name>
<field-name>statusDicId</field-name>
<field-name>plannedStartDateTime</field-name>
</load-group>
</load-groups>

<optimistic-locking>
<group-name>wo</group-name>
</optimistic-locking>
</entity>

3: add synchronize in some places which shouldn't be concurrent invoking.

then my system passed the test of loadrunner.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: deadlock exception