The method PublisherServiceImpl#applicationStarted starts a transaction without testing if a transaction is already active as it is commonly done with the following pattern
boolean started = TransactionHelper.isTransactionActive() == false && TransactionHelper.startTransaction(); try { // your code here } finally { if (started) { TransactionHelper.commitOrRollbackTransaction(); } }
This could cause a NotSupportedException indicating that nested transactions are not supported with this stacktrace:
ERROR [TransactionHelper] Unable to start transaction javax.transaction.NotSupportedException: Nested Transactions are not supported at org.apache.geronimo.transaction.manager.TransactionManagerImpl.begin(TransactionManagerImpl.java:157) at org.apache.geronimo.transaction.manager.TransactionManagerImpl.begin(TransactionManagerImpl.java:152) at org.nuxeo.runtime.jtajca.NuxeoContainer$UserTransactionImpl.begin(NuxeoContainer.java:525) at org.nuxeo.runtime.transaction.TransactionHelper.startTransaction(TransactionHelper.java:193) at org.nuxeo.ecm.platform.publisher.impl.service.PublisherServiceImpl.applicationStarted(PublisherServiceImpl.java:102) at org.nuxeo.runtime.model.impl.RegistrationInfoImpl.notifyApplicationStarted(RegistrationInfoImpl.java:325) at org.nuxeo.runtime.osgi.OSGiRuntimeService.notifyComponentsOnStarted(OSGiRuntimeService.java:482) at org.nuxeo.runtime.osgi.OSGiRuntimeService.fireApplicationStarted(OSGiRuntimeService.java:518) at org.nuxeo.runtime.api.ServicePassivator$Waiter.proceed(ServicePassivator.java:413) at org.nuxeo.runtime.api.ServicePassivator.proceed(ServicePassivator.java:81) at org.nuxeo.runtime.osgi.OSGiRuntimeService.frameworkEvent(OSGiRuntimeService.java:530) at org.nuxeo.osgi.OSGiAdapter.fireFrameworkEvent(OSGiAdapter.java:232) at org.nuxeo.runtime.test.NXRuntimeTestCase.fireFrameworkStarted(NXRuntimeTestCase.java:193)
The error is reproducible in a unit test where NXRuntimeTestCase.fireFrameworkStarted has already started a transaction, since NXP-19049
- depends on
-
NXP-19049 work manager shutdown should not suspend works
- Resolved