openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Dick" <michael.d.d...@gmail.com>
Subject Re: What causes an optimistic exception?
Date Wed, 10 Jan 2007 19:35:14 GMT
Have you tried setting trimStackTrace to false in pom.xml?  It should look
something like this :

    <build>
        <plugins>
            . . .
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <trimStackTrace>false</trimStackTrace>
                </configuration>
            </plugin>
            . . .
        </plugins>
    </build>


On 1/10/07, Dain Sundstrom <dain@iq80.com> wrote:
>
> Finally got some time to dig into this.  The problem was I was
> attempting to create a bean that already existed (a bug in my test
> case).  It is possible to get the original SQL exception message out
> of JPA, so I could know that I was getting a duplicate key?
>
> -dain
>
> On Jan 4, 2007, at 10:29 AM, Dain Sundstrom wrote:
>
> > I'm getting this exception printed to my log, but my tests work.
> > Is my test doing something wrong?
> >
> > <2|false|0.9.6-incubating>
> > org.apache.openjpa.util.OptimisticException: Optimistic locking
> > errors were detected when flushing to the data store.  The
> > following objects may have been concurrently modified in another
> > transaction:
> > [org.apache.openejb.test.entity.cmr.onetoone.ABean_JPA@2c4eaa]
> >         at org.apache.openjpa.kernel.BrokerImpl.newFlushException
> > (BrokerImpl.java:2077)
> >         at org.apache.openjpa.kernel.BrokerImpl.flush
> > (BrokerImpl.java:1927)
> >         at org.apache.openjpa.kernel.BrokerImpl.flushSafe
> > (BrokerImpl.java:1825)
> >         at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion
> > (BrokerImpl.java:1756)
> >         at org.apache.openejb.core.TransactionManagerWrapper
> > $TransactionWrapper.beforeCompletion(TransactionManagerWrapper.java:
> > 194)
> >         at
> > org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompleti
> > on(TransactionImpl.java:515)
> >         at
> > org.apache.geronimo.transaction.manager.TransactionImpl.beforePrepare(
> > TransactionImpl.java:399)
> >         at
> > org.apache.geronimo.transaction.manager.TransactionImpl.commit
> > (TransactionImpl.java:256)
> >         at
> > org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(
> > TransactionManagerImpl.java:264)
> >         at org.apache.openejb.core.TransactionManagerWrapper.commit
> > (TransactionManagerWrapper.java:58)
> >         at
> > org.apache.openejb.test.entity.cmr.AbstractCMRTest.completeTransaction
> > (AbstractCMRTest.java:57)
> >         at
> > org.apache.openejb.test.entity.cmr.OneToOneTests.test07_BSetAExistingB
> > NewA(OneToOneTests.java:154)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke
> > (NativeMethodAccessorImpl.java:39)
> >         at sun.reflect.DelegatingMethodAccessorImpl.invoke
> > (DelegatingMethodAccessorImpl.java:25)
> >         at java.lang.reflect.Method.invoke(Method.java:585)
> >         at org.apache.openejb.test.NumberedTestCase.runTestMethod
> > (NumberedTestCase.java:135)
> >         at org.apache.openejb.test.NumberedTestCase$1.protect
> > (NumberedTestCase.java:120)
> >         at junit.framework.TestResult.runProtected(TestResult.java:
> > 128)
> >         at org.apache.openejb.test.NumberedTestCase.run
> > (NumberedTestCase.java:123)
> >         at org.apache.openejb.test.NumberedTestCase.run
> > (NumberedTestCase.java:102)
> >         at org.apache.openejb.test.TestSuite.run(TestSuite.java:46)
> >         at org.apache.openejb.test.TestSuite.run(TestSuite.java:46)
> >         at org.apache.openejb.test.TestSuite.run(TestSuite.java:46)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke
> > (NativeMethodAccessorImpl.java:39)
> >         at sun.reflect.DelegatingMethodAccessorImpl.invoke
> > (DelegatingMethodAccessorImpl.java:25)
> >         at java.lang.reflect.Method.invoke(Method.java:585)
> >         at org.apache.maven.surefire.junit.JUnitTestSet.execute
> > (JUnitTestSet.java:210)
> >         at
> > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTest
> > Set(AbstractDirectoryTestSuite.java:135)
> >         at
> > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute
> > (AbstractDirectoryTestSuite.java:160)
> >         at org.apache.maven.surefire.Surefire.run(Surefire.java:81)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke
> > (NativeMethodAccessorImpl.java:39)
> >         at sun.reflect.DelegatingMethodAccessorImpl.invoke
> > (DelegatingMethodAccessorImpl.java:25)
> >         at java.lang.reflect.Method.invoke(Method.java:585)
> >         at
> > org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess
> > (SurefireBooter.java:182)
> >         at org.apache.maven.surefire.booter.SurefireBooter.main
> > (SurefireBooter.java:743)
> > Caused by: <2|false|0.9.6-incubating>
> > org.apache.openjpa.util.OptimisticException: An optimistic lock
> > violation was detected when flushing object instance
> > "org.apache.openejb.test.entity.cmr.onetoone.ABean_JPA@2c4eaa" to
> > the data store.  This indicates that the object was concurrently
> > modified in another transaction.
> > FailedObject:
> > org.apache.openejb.test.entity.cmr.onetoone.ABean_JPA@2c4eaa
> >         at
> > org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushInter
> > nal(PreparedStatementManagerImpl.java:96)
> >         at
> > org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flush
> > (PreparedStatementManagerImpl.java:68)
> >         at
> > org.apache.openjpa.jdbc.kernel.OperationOrderUpdateManager.flushPrimar
> > yRow(OperationOrderUpdateManager.java:200)
> >         at
> > org.apache.openjpa.jdbc.kernel.OperationOrderUpdateManager.flush
> > (OperationOrderUpdateManager.java:86)
> >         at
> > org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush
> > (AbstractUpdateManager.java:86)
> >         at
> > org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush
> > (AbstractUpdateManager.java:69)
> >         at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush
> > (JDBCStoreManager.java:511)
> >         at org.apache.openjpa.kernel.DelegatingStoreManager.flush
> > (DelegatingStoreManager.java:127)
> >         ... 37 more
>
>


-- 
-Michael Dick

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message