Closed cseppan closed 1 year ago
java.lang.IllegalStateException: Transaction already active at org.hibernate.engine.transaction.internal.TransactionImpl.begin(TransactionImpl.java:74) at org.hibernate.internal.AbstractSharedSessionContract.beginTransaction(AbstractSharedSessionContract.java:503) at gov.epa.emissions.framework.services.cost.ControlMeasureDAO.removeSccs(ControlMeasureDAO.java:324) at gov.epa.emissions.framework.services.cost.ControlMeasureDAO.remove(ControlMeasureDAO.java:151) at gov.epa.emissions.framework.services.cost.controlmeasure.io.CMImportTask.run(CMImportTask.java:168) at gov.epa.emissions.framework.services.GCEnforcerTask.run(GCEnforcerTask.java:23) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Thread.java:833)
Method ControlMeasureDAO.remove() already begins a transaction, then removeSccs() tries to begin another one.
Commit be17702351e21bbba4160db803fa2872c9d2cd7e removes the attempts to create nested transactions from two functions.
removeSccs(int[] sectorIds, Session session) removeEfficiencyRecords(int[] sectorIds, Session session)
I confirmed that these are only called from the remove function that has already set up a transaction.
After getting past the purge problem, control measures are still failing to import
org.hibernate.resource.transaction.backend.jta.internal.JtaPlatformInaccessibleException: Unable to access TransactionManager or UserTransaction to make physical transaction delegate
at org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorImpl.makePhysicalTransactionDelegate(JtaTransactionCoordinatorImpl.java:257)
at org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorImpl.getTransactionDriverControl(JtaTransactionCoordinatorImpl.java:231)
at org.hibernate.engine.transaction.internal.TransactionImpl.
Steps to reproduce:
Commit a9f3d1c changes ReferencesDAO to use gov.epa.emissions.framework.services.persistence.HibernateSessionFactory instead of gov.epa.emissions.commons.db.HibernateSessionFactory. This matches all other DAOs in the EMF project.
The Commons version of HibernateSessionFactory doesn't appear to be used in the EMF.
I've deployed the two code updates to fix the errors purging old control measures and importing the new measures.
Affects EMF v4.2 on EPA server.
java.lang.NullPointerException at ControlMeasureDAO.removeSccs(ControlMeasureDAO.java:328)
CMDB import fails when trying to purge existing measures. Code was updated as part of Hibernate upgrades for v4.2.