Entity bean (CMP) can not remove itself
---------------------------------------
Key: GERONIMO-2166
URL: http://issues.apache.org/jira/browse/GERONIMO-2166
Project: Geronimo
Type: Bug
Security: public (Regular issues)
Versions: 1.0
Environment: Geronimo 1.0 Jetty version, Sun SDK 1.4.2_12, running on Windows
20003
(not yet tested with 1.1)
Reporter: Markus Hanecke
Priority: Critical
It's not possible for an entity bean (CMP) to remove itself.
In a demo case the entity bean implements the TimedObject interface and get's a
callback to ejbTimeout(Timer timer).
At the end of the callback function the bean tries to remove itself calling
ejbRemove() as described in a tutorial from Sun:
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JMSJ2EEex3.html
(see for a sample use case, too)
The result is, that nothing will happen and the bean won't be removed.
If the bean tries to remove itself calling remove() from the bean's home or
remote interface (during the ejbTimeout callback), it leads to an exception.
Looking at the stack trace it seems that there is a problem with the
transaction
rollback of the remove() and/or ejbTimeout() call. The overall result of
calling remove() insteads of ejbRemove() is, that the server will no longer
startup normally. There will alwaye be a GBean Destroyed exception during
startup.
In a third try I let the entity bean call a stateless session bean during
ejbTimeout(). The stateless session bean should then try to remove the entity
bean (=the calling entity bean). The result was an exception compareable to the
second try (calling directly remove()).
Searching the internet I found out, that other J2EE servers had this problem
too, but it seems to be already fixed there.
Stack trace of thrid try:
16:25:35,748 WARN [GeronimoConnectionEventListener] connectionErrorOccurred
called with null
SQL Exception: No current connection.
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.noCurrentConnection(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.setupContextStack(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedConnection.commit(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.setAutoCommit(Unknown
Source)
at org.apache.derby.iapi.jdbc.BrokeredConnection.setAutoCommit(Unknown
Source)
at
org.tranql.connector.jdbc.ManagedXAConnection.localTransactionStart(ManagedXAConnection.java:89)
at
org.tranql.connector.AbstractManagedConnection$LocalTransactionImpl.begin(AbstractManagedConnection.java:188)
at
org.tranql.connector.jdbc.ConnectionHandle.setAutoCommit(ConnectionHandle.java:161)
at
org.activemq.store.jdbc.JDBCPersistenceAdapter.beginTransaction(JDBCPersistenceAdapter.java:126)
at
org.activemq.store.jdbc.JDBCPersistenceAdapterGBean.beginTransaction(JDBCPersistenceAdapterGBean.java:76)
at
org.activemq.store.jdbc.JDBCPersistenceAdapterGBean$$FastClassByCGLIB$$8be8a0a0.invoke(<generated>)
at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
at
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
at
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:118)
at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:800)
at
org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
at
org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:36)
at
org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96)
at
org.activemq.store.PersistenceAdapter$$EnhancerByCGLIB$$1e3c3181.beginTransaction(<generated>)
at
org.activemq.store.journal.JournalPersistenceAdapter.beginTransaction(JournalPersistenceAdapter.java:158)
at
org.activemq.util.TransactionTemplate.run(TransactionTemplate.java:38)
at
org.activemq.store.journal.JournalMessageStore.checkpoint(JournalMessageStore.java:227)
at
org.activemq.store.journal.JournalPersistenceAdapter$3.run(JournalPersistenceAdapter.java:357)
at EDU.oswego.cs.dl.util.concurrent.QueuedExecutor$RunLoop.run(Unknown
Source)
at java.lang.Thread.run(Thread.java:534)
16:25:35,763 ERROR [JournalPersistenceAdapter] Failed to checkpoint a message
store: javax.jms.JMSException: Failed to create transaction: SQL Exception: No
current connection.
javax.jms.JMSException: Failed to create transaction: SQL Exception: No current
connection.
at
org.activemq.util.JMSExceptionHelper.newJMSException(JMSExceptionHelper.java:49)
at
org.activemq.store.jdbc.JDBCPersistenceAdapter.beginTransaction(JDBCPersistenceAdapter.java:130)
at
org.activemq.store.jdbc.JDBCPersistenceAdapterGBean.beginTransaction(JDBCPersistenceAdapterGBean.java:76)
at
org.activemq.store.jdbc.JDBCPersistenceAdapterGBean$$FastClassByCGLIB$$8be8a0a0.invoke(<generated>)
at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
at
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
at
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:118)
at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:800)
at
org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
at
org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:36)
at
org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96)
at
org.activemq.store.PersistenceAdapter$$EnhancerByCGLIB$$1e3c3181.beginTransaction(<generated>)
at
org.activemq.store.journal.JournalPersistenceAdapter.beginTransaction(JournalPersistenceAdapter.java:158)
at
org.activemq.util.TransactionTemplate.run(TransactionTemplate.java:38)
at
org.activemq.store.journal.JournalMessageStore.checkpoint(JournalMessageStore.java:227)
at
org.activemq.store.journal.JournalPersistenceAdapter$3.run(JournalPersistenceAdapter.java:357)
at EDU.oswego.cs.dl.util.concurrent.QueuedExecutor$RunLoop.run(Unknown
Source)
at java.lang.Thread.run(Thread.java:534)
Caused by: SQL Exception: No current connection.
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.noCurrentConnection(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.setupContextStack(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedConnection.commit(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.setAutoCommit(Unknown
Source)
at org.apache.derby.iapi.jdbc.BrokeredConnection.setAutoCommit(Unknown
Source)
at
org.tranql.connector.jdbc.ManagedXAConnection.localTransactionStart(ManagedXAConnection.java:89)
at
org.tranql.connector.AbstractManagedConnection$LocalTransactionImpl.begin(AbstractManagedConnection.java:188)
at
org.tranql.connector.jdbc.ConnectionHandle.setAutoCommit(ConnectionHandle.java:161)
at
org.activemq.store.jdbc.JDBCPersistenceAdapter.beginTransaction(JDBCPersistenceAdapter.java:126)
... 16 more
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira