geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Ljuba" <lju...@gmail.com>
Subject @GeneratedValue(strategy = GenerationType.TABLE... : org.apache.openjpa.persistence.PersistenceException: The Transaction Synchronization Registry can not suspend the current transaction
Date Wed, 03 Dec 2008 14:45:55 GMT
we have this symptom:
Generates exception:
...
18047  xxx  INFO   [RMI TCP Connection(216)-192.168.0.63] openjpa.Runtime -
Starting OpenJPA 1.2.0
18344  xxx  INFO   [RMI TCP Connection(216)-192.168.0.63] openjpa.jdbc.JDBC
- Using dictionary class "org.apache.openjpa.jdbc.sql.SQLServerDictionary"
(Microsoft SQL Server 09.00.3073 ,jTDS Type 4 JDBC Driver for MS SQL Server
and Sybase 1.2.2).
...


03 Dec 2008 15:04:17,421  INFO [pool-4-thread-2] (Transaction.java:70) - TX
Required: Started transaction
org.apache.geronimo.transaction.manager.TransactionImpl@b0d739
03 Dec 2008 15:04:17,421 DEBUG [pool-4-thread-2]
(net.xxx.persistenceTest.probnaTabela.ProbnaTabela1Home.java:66) -
persisting ProbnaTabela1 instance
03 Dec 2008 15:04:17,531 DEBUG [pool-4-thread-2]
(net.xxx.persistenceTest.probnaTabela.ProbnaTabela1Home.java:66) - persist
successful
03 Dec 2008 15:04:17,531  INFO [pool-4-thread-2] (Transaction.java:70) - TX
Required: Committing transaction
org.apache.geronimo.transaction.manager.TransactionImpl@b0d739
15:04:17,531 WARN  [Transaction] Unexpected exception from beforeCompletion;
transaction will roll back
<openjpa-1.2.0-r422266:683325 nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: The Transaction
Synchronization Registry can not suspend the current transaction.
    at
org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4238)
    at
org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4203)
    at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:102)
    at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:88)
    at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:64)
    at
org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq.next(AbstractJDBCSeq.java:65)
    at org.apache.openjpa.util.ImplHelper.generateValue(ImplHelper.java:160)
    at
org.apache.openjpa.util.ImplHelper.generateFieldValue(ImplHelper.java:144)
    at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignField(JDBCStoreManager.java:698)
    at
org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:487)
    at
org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:463)
    at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignObjectId(JDBCStoreManager.java:682)
    at
org.apache.openjpa.kernel.DelegatingStoreManager.assignObjectId(DelegatingStoreManager.java:134)
    at
org.apache.openjpa.kernel.StateManagerImpl.assignObjectId(StateManagerImpl.java:519)
    at
org.apache.openjpa.kernel.StateManagerImpl.preFlush(StateManagerImpl.java:2823)
    at org.apache.openjpa.kernel.PNewState.beforeFlush(PNewState.java:39)
    at
org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(StateManagerImpl.java:959)
    at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1948)
    at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1908)
    at
org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1826)
    at
org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:514)
    at
org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:499)
    at
org.apache.geronimo.transaction.manager.TransactionImpl.beforePrepare(TransactionImpl.java:400)
    at
org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:257)
    at
org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:245)
    at
org.apache.openejb.core.transaction.TransactionPolicy.commitTransaction(TransactionPolicy.java:138)
    at
org.apache.openejb.core.transaction.TxRequired.afterInvoke(TxRequired.java:76)
    at
org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:233)
    at
org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:188)
    at
org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:165)
    at
org.apache.openejb.core.timer.EjbTimerServiceImpl.ejbTimeout(EjbTimerServiceImpl.java:284)
    at
org.apache.openejb.core.timer.EjbTimerServiceImpl.access$100(EjbTimerServiceImpl.java:43)
    at
org.apache.openejb.core.timer.EjbTimerServiceImpl$EjbTimeoutTimerTask$1.run(EjbTimerServiceImpl.java:350)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.SQLException: The Transaction Synchronization Registry
can not suspend the current transaction.
    at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.allocateSequence(TableJDBCSeq.java:419)
    at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.nextInternal(TableJDBCSeq.java:290)
    at
org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq.next(AbstractJDBCSeq.java:60)
    ... 30 more
Caused by: javax.transaction.NotSupportedException: The Transaction
Synchronization Registry can not suspend the current transaction.
    at
org.apache.openjpa.ee.RegistryManagedRuntime.doNonTransactionalWork(RegistryManagedRuntime.java:203)
    at
org.apache.openjpa.ee.AutomaticManagedRuntime.doNonTransactionalWork(AutomaticManagedRuntime.java:312)
    at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.allocateSequence(TableJDBCSeq.java:415)
    ... 32 more
03 Dec 2008 15:04:17,531  WARN [pool-4-thread-2] (Transaction.java:96) -
Unexpected exception from beforeCompletion; transaction will roll back
<openjpa-1.2.0-r422266:683325 nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: The Transaction
Synchronization Registry can not suspend the current transaction.
    at
org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4238)
    at
org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4203)
    at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:102)
    at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:88)
    at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:64)
    at
org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq.next(AbstractJDBCSeq.java:65)
    at org.apache.openjpa.util.ImplHelper.generateValue(ImplHelper.java:160)
    at
org.apache.openjpa.util.ImplHelper.generateFieldValue(ImplHelper.java:144)
    at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignField(JDBCStoreManager.java:698)
    at
org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:487)
    at
org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:463)
    at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignObjectId(JDBCStoreManager.java:682)
    at
org.apache.openjpa.kernel.DelegatingStoreManager.assignObjectId(DelegatingStoreManager.java:134)
    at
org.apache.openjpa.kernel.StateManagerImpl.assignObjectId(StateManagerImpl.java:519)
    at
org.apache.openjpa.kernel.StateManagerImpl.preFlush(StateManagerImpl.java:2823)
    at org.apache.openjpa.kernel.PNewState.beforeFlush(PNewState.java:39)
    at
org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(StateManagerImpl.java:959)
    at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1948)
    at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1908)
    at
org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1826)
    at
org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:514)
    at
org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:499)
    at
org.apache.geronimo.transaction.manager.TransactionImpl.beforePrepare(TransactionImpl.java:400)
    at
org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:257)
    at
org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:245)
    at
org.apache.openejb.core.transaction.TransactionPolicy.commitTransaction(TransactionPolicy.java:138)
    at
org.apache.openejb.core.transaction.TxRequired.afterInvoke(TxRequired.java:76)
    at
org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:233)
    at
org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:188)
    at
org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:165)
    at
org.apache.openejb.core.timer.EjbTimerServiceImpl.ejbTimeout(EjbTimerServiceImpl.java:284)
    at
org.apache.openejb.core.timer.EjbTimerServiceImpl.access$100(EjbTimerServiceImpl.java:43)
    at
org.apache.openejb.core.timer.EjbTimerServiceImpl$EjbTimeoutTimerTask$1.run(EjbTimerServiceImpl.java:350)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.SQLException: The Transaction Synchronization Registry
can not suspend the current transaction.
    at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.allocateSequence(TableJDBCSeq.java:419)
    at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.nextInternal(TableJDBCSeq.java:290)
    at
org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq.next(AbstractJDBCSeq.java:60)
    ... 30 more
Caused by: javax.transaction.NotSupportedException: The Transaction
Synchronization Registry can not suspend the current transaction.
    at
org.apache.openjpa.ee.RegistryManagedRuntime.doNonTransactionalWork(RegistryManagedRuntime.java:203)
    at
org.apache.openjpa.ee.AutomaticManagedRuntime.doNonTransactionalWork(AutomaticManagedRuntime.java:312)
    at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.allocateSequence(TableJDBCSeq.java:415)
    ... 32 more
03 Dec 2008 15:04:17,531  INFO [pool-4-thread-2] (Transaction.java:70) - The
transaction has been rolled back rather than commited: Unable to commit:
transaction marked for rollback
15:04:17,531 WARN  [Timer] Exception from ejbTimeout on
limores-core-internal.jar/AutoErrorCheckBean
org.apache.openejb.ApplicationException:
javax.transaction.TransactionRolledbackException: Transaction was rolled
back, presumably because setRollbackOnly was called during a
synchronization: Unable to commit: transaction marked for rollback:
Transaction was rolled back, presumably because setRollbackOnly was called
during a synchronization: Unable to commit: transaction marked for rollback
    at
org.apache.openejb.core.transaction.TransactionPolicy.commitTransaction(TransactionPolicy.java:147)
    at
org.apache.openejb.core.transaction.TxRequired.afterInvoke(TxRequired.java:76)
    at
org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:233)
    at
org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:188)
    at
org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:165)
    at
org.apache.openejb.core.timer.EjbTimerServiceImpl.ejbTimeout(EjbTimerServiceImpl.java:284)
    at
org.apache.openejb.core.timer.EjbTimerServiceImpl.access$100(EjbTimerServiceImpl.java:43)
    at
org.apache.openejb.core.timer.EjbTimerServiceImpl$EjbTimeoutTimerTask$1.run(EjbTimerServiceImpl.java:350)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
Caused by: javax.transaction.TransactionRolledbackException: Transaction was
rolled back, presumably because setRollbackOnly was called during a
synchronization: Unable to commit: transaction marked for rollback
    at
org.apache.openejb.core.transaction.TransactionPolicy.commitTransaction(TransactionPolicy.java:146)
    ... 10 more
03 Dec 2008 15:04:17,531  WARN [pool-4-thread-2] (Timer.java:62) - Exception
from ejbTimeout on limores-core-internal.jar/AutoErrorCheckBean
org.apache.openejb.ApplicationException:
javax.transaction.TransactionRolledbackException: Transaction was rolled
back, presumably because setRollbackOnly was called during a
synchronization: Unable to commit: transaction marked for rollback:
Transaction was rolled back, presumably because setRollbackOnly was called
during a synchronization: Unable to commit: transaction marked for rollback
    at
org.apache.openejb.core.transaction.TransactionPolicy.commitTransaction(TransactionPolicy.java:147)
    at
org.apache.openejb.core.transaction.TxRequired.afterInvoke(TxRequired.java:76)
    at
org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:233)
    at
org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:188)
    at
org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:165)
    at
org.apache.openejb.core.timer.EjbTimerServiceImpl.ejbTimeout(EjbTimerServiceImpl.java:284)
    at
org.apache.openejb.core.timer.EjbTimerServiceImpl.access$100(EjbTimerServiceImpl.java:43)
    at
org.apache.openejb.core.timer.EjbTimerServiceImpl$EjbTimeoutTimerTask$1.run(EjbTimerServiceImpl.java:350)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
Caused by: javax.transaction.TransactionRolledbackException: Transaction was
rolled back, presumably because setRollbackOnly was called during a
synchronization: Unable to commit: transaction marked for rollback
    at
org.apache.openejb.core.transaction.TransactionPolicy.commitTransaction(TransactionPolicy.java:146)
    ... 10 more






when trying to persist :
...
ProbnaTabela1 probnaTabela1 = new ProbnaTabela1();
probnaTabela1.setIme("D");
probnaTabela1Home.persist(probnaTabela1);
...

    public void persist(ProbnaTabela1 transientInstance) {
        log.debug("persisting ProbnaTabela1 instance");
        try {
            entityManager.persist(transientInstance);
            //entityManager.flush();//commented line
            log.debug("persist successful");
        } catch (RuntimeException re) {
            log.error("persist failed", re);
            throw re;
        }
    }


package net.xxx.persistenceTest.probnaTabela;

// Generated Dec 3, 2008 10:48:54 AM by Hibernate Tools 3.2.2.GA

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

/**
 * ProbnaTabela1 generated by hbm2java
 */
@Entity
@Table(name = "ProbnaTabela1", schema = "aaa.bbb")
public class ProbnaTabela1 implements java.io.Serializable {

    private static final long serialVersionUID = -2618542290799601293L;
    private Integer id;
    private String ime;

    public ProbnaTabela1() {
    }

    @Id
    @Column(name = "id_1", unique = true, nullable = false)
    @GeneratedValue(strategy = GenerationType.TABLE, generator =
"CUSTOMER_ID")
    @TableGenerator(name = "CUSTOMER_ID", table = "counters", pkColumnName =
"CounterName", valueColumnName = "CounterValue", pkColumnValue =
"CUSTOMER_NO", allocationSize = 1)
    public Integer getId() {
        return this.id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Column(name = "ime", length = 1)
    public String getIme() {
        return this.ime;
    }

    public void setIme(String ime) {
        this.ime = ime;
    }

}

problem is with this part of code possible ties to suspend transaction when
determines Id:

...
@GeneratedValue(strategy = GenerationType.TABLE, generator = "CUSTOMER_ID")
    @TableGenerator(name = "CUSTOMER_ID", table = "counters", pkColumnName =
"CounterName", valueColumnName = "CounterValue", pkColumnValue =
"CUSTOMER_NO", allocationSize = 1)
...

we run unitils test and it persists succesfully but in Geronimo enviroment
it does not. Here is test log:


31  xxxMySql  WARN   [main] openjpa.Runtime - The configuration property
named "openjpa.InitializeEagerly" was not recognized and will be ignored,
although the name closely matches a valid property called
"openjpa.InverseManager".
INFO  - ConfigurationLoader                      - Loaded configuration file
unitils-local.properties from user home
INFO  - PropertiesDataSourceFactory              - Creating data source.
Driver: net.sourceforge.jtds.jdbc.Driver, url:
jdbc:jtds:sqlserver://test-server:1433, user: sa, password: <not shown>
INFO  - LocalContainerEntityManagerFactoryBean   - Building JPA container
EntityManagerFactory for persistence unit 'xxx'
31  xxx  WARN   [main] openjpa.Runtime - An error occurred while registering
a ClassTransformer with PersistenceUnitInfo: name 'xxx', root URL
[file:/D:/workspace-eclipse3.4/xxx-core/xxx-core-internal/target/test-classes/].
The error has been consumed. To see it, set your openjpa.Runtime log level
to TRACE. Load-time class transformation will not be available.
78  xxx  INFO   [main] openjpa.Runtime - Starting OpenJPA 1.2.0
281  xxx  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class
"org.apache.openjpa.jdbc.sql.SQLServerDictionary" (Microsoft SQL Server
09.00.3073 ,jTDS Type 4 JDBC Driver for MS SQL Server and Sybase 1.2.2).
...
DEBUG - ProbnaTabela1Home                        - persisting ProbnaTabela1
instance
DEBUG - ProbnaTabela1Home                        - persist successful
INFO  - JpaModule                                - Flushing entity manager
org.apache.openjpa.persistence.EntityManagerImpl@18e8fe0
9234  xxx  TRACE  [main] openjpa.jdbc.SQL - <t 9505547, conn 7080114>
executing prepstmnt 30318742 SELECT COUNTERVALUE FROM Address.dbo.counters
WITH (UPDLOCK) WHERE COUNTERNAME = ? [params=(String) CUSTOMER_NO]
9250  xxx  TRACE  [main] openjpa.jdbc.SQL - <t 9505547, conn 7080114> [16
ms] spent
9250  xxx  TRACE  [main] openjpa.jdbc.SQL - <t 9505547, conn 7080114>
executing prepstmnt 17474178 UPDATE Address.dbo.counters SET COUNTERVALUE =
? WHERE COUNTERNAME = ? AND COUNTERVALUE = ? [params=(long) 8673087,
(String) CUSTOMER_NO, (long) 8673086]
9250  xxx  TRACE  [main] openjpa.jdbc.SQL - <t 9505547, conn 7080114> [0 ms]
spent
9281  xxx  TRACE  [main] openjpa.jdbc.SQL - <t 9505547, conn 24597416>
executing prepstmnt 6823352 INSERT INTO Address.dbo.ProbnaTabela1 (id_1,
ime) VALUES (?, ?) [params=(int) 8673086, (String) D]
9281  xxx  TRACE  [main] openjpa.jdbc.SQL - <t 9505547, conn 24597416> [0
ms] spent

Please help,
David

enviroment:
 MSSQL, openjpa-1.2.0.jar, Geronimo 2.1.4-SNAPSHOT

Version 2.1.4-SNAPSHOT  Build 2008.09.03-14:17:48.870-0400  Start Time Wed
Dec 03 11:27:44 CET 2008  Up Time 4 hours 9 minutes 37 seconds

 Operating System  Architecture x86  Name Windows XP  Version 5.1  Patch
Level Service Pack 3  Locale en_US
 JVM  Java Version 1.6.0_10-ea  Java Vendor Sun Microsystems Inc.  Node
david/192.168.0.63

Mime
View raw message