Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 320663

Summary: jpa/cacheable tests failed on Java EE with AssertionFailedError and TransactionRequiredException
Product: z_Archived Reporter: Yiping Zhao <yiping.zhao>
Component: EclipselinkAssignee: Project Inbox <eclipselink.orm-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P2 CC: christopher.delahunt, michael.f.obrien, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Yiping Zhao CLA 2010-07-22 16:07:36 EDT
After fix the issue with multiple persistence unit support as stated in bug 315486, 

1. "testEMPropertiesOnCommit1" & "testEMPropertiesOnCommit2" failed with AssertionFailedError on WebSphere and Weblogic, the two tests failed with javax.persistence.TransactionRequiredException on GlassFish

(1) Error message for WebLogic and WebSphere
<testcase classname="org.eclipse.persistence.testing.tests.jpa.cacheable.CacheableModelJunitTestDisableSelective" name="testEMPropertiesOnCommit1" time="0.313">
    <failure message="The shared cache was updated when the EM property CacheStoreMode = BYPASS" type="junit.framework.AssertionFailedError">junit.framework.AssertionFailedError: The shared cache was updated when the EM property CacheStoreMode = BYPASS
	at org.eclipse.persistence.testing.tests.jpa.cacheable.CacheableModelJunitTestDisableSelective.testEMPropertiesOnCommit1(CacheableModelJunitTestDisableSelective.java:240)
	at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBareServer(JUnitTestCase.java:534)
	at org.eclipse.persistence.testing.framework.server.TestRunner4Bean.runTest(TestRunner4Bean.java:87)
	at org.eclipse.persistence.testing.framework.server.EJSRemote0SLTestRunner4_4a95f6b1.runTest(EJSRemote0SLTestRunner4_4a95f6b1.java)
	at org.eclipse.persistence.testing.framework.server._EJSRemote0SLTestRunner4_4a95f6b1_Tie.runTest(_EJSRemote0SLTestRunner4_4a95f6b1_Tie.java)
	at org.eclipse.persistence.testing.framework.server._EJSRemote0SLTestRunner4_4a95f6b1_Tie._invoke(_EJSRemote0SLTestRunner4_4a95f6b1_Tie.java)
	at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:622)
	at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:475)
	at com.ibm.rmi.iiop.ORB.process(ORB.java:513)
	at com.ibm.CORBA.iiop.ORB.process(ORB.java:1574)
	at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2841)
	at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2714)
	at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:63)
	at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118)
	at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)
</failure>

<testcase classname="org.eclipse.persistence.testing.tests.jpa.cacheable.CacheableModelJunitTestDisableSelective" name="testEMPropertiesOnCommit2" time="0.156">
    <failure message="The shared cache should NOT have been updated" type="junit.framework.AssertionFailedError">junit.framework.AssertionFailedError: The shared cache should NOT have been updated
	at org.eclipse.persistence.testing.tests.jpa.cacheable.CacheableModelJunitTestDisableSelective.testEMPropertiesOnCommit2(CacheableModelJunitTestDisableSelective.java:290)
	at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBareServer(JUnitTestCase.java:534)
	at org.eclipse.persistence.testing.framework.server.TestRunner4Bean.runTest(TestRunner4Bean.java:87)
	at org.eclipse.persistence.testing.framework.server.EJSRemote0SLTestRunner4_4a95f6b1.runTest(EJSRemote0SLTestRunner4_4a95f6b1.java)
	at org.eclipse.persistence.testing.framework.server._EJSRemote0SLTestRunner4_4a95f6b1_Tie.runTest(_EJSRemote0SLTestRunner4_4a95f6b1_Tie.java)
	at org.eclipse.persistence.testing.framework.server._EJSRemote0SLTestRunner4_4a95f6b1_Tie._invoke(_EJSRemote0SLTestRunner4_4a95f6b1_Tie.java)
	at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:622)
	at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:475)
	at com.ibm.rmi.iiop.ORB.process(ORB.java:513)
	at com.ibm.CORBA.iiop.ORB.process(ORB.java:1574)
	at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2841)
	at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2714)
	at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:63)
	at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118)
	at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)

(2). Error message for GlassFish
<testcase classname="org.eclipse.persistence.testing.tests.jpa.cacheable.CacheableModelJunitTestDisableSelective" name="testEMPropertiesOnCommit1" time="0.297">
    <error type="javax.persistence.TransactionRequiredException">javax.persistence.TransactionRequiredException
	at com.sun.enterprise.container.common.impl.EntityManagerWrapper.doTxRequiredCheck(EntityManagerWrapper.java:152)
	at com.sun.enterprise.container.common.impl.EntityManagerWrapper.setProperty(EntityManagerWrapper.java:785)
	at org.eclipse.persistence.testing.tests.jpa.cacheable.CacheableModelJunitTestDisableSelective.testEMPropertiesOnCommit1(CacheableModelJunitTestDisableSelective.java:228)
	at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBareServer(JUnitTestCase.java:534)

<testcase classname="org.eclipse.persistence.testing.tests.jpa.cacheable.CacheableModelJunitTestDisableSelective" name="testEMPropertiesOnCommit2" time="0.141">
    <error type="javax.persistence.TransactionRequiredException">javax.persistence.TransactionRequiredException
	at com.sun.enterprise.container.common.impl.EntityManagerWrapper.doTxRequiredCheck(EntityManagerWrapper.java:152)
	at com.sun.enterprise.container.common.impl.EntityManagerWrapper.setProperty(EntityManagerWrapper.java:785)
	at org.eclipse.persistence.testing.tests.jpa.cacheable.CacheableModelJunitTestDisableSelective.testEMPropertiesOnCommit2(CacheableModelJunitTestDisableSelective.java:269)
	at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBareServer(JUnitTestCase.java:534)

2. "testCachingOnUNSPECIFIED" failed on WebSphere only with following error
 <testcase classname="org.eclipse.persistence.testing.tests.jpa.cacheable.CacheableModelJunitTestUnspecified" name="testCachingOnUNSPECIFIED" time="0.047">
    <failure message="CacheableFalseEntity (UNSPECIFIED) from annotations has caching turned on" type="junit.framework.AssertionFailedError">junit.framework.AssertionFailedError: CacheableFalseEntity (UNSPECIFIED) from annotations has caching turned on
	at org.eclipse.persistence.testing.tests.jpa.cacheable.CacheableModelJunitTestUnspecified.testCachingOnUNSPECIFIED(CacheableModelJunitTestUnspecified.java:88)
	at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBareServer(JUnitTestCase.java:534)
	at org.eclipse.persistence.testing.framework.server.TestRunner5Bean.runTest(TestRunner5Bean.java:87)
	at org.eclipse.persistence.testing.framework.server.EJSRemote0SLTestRunner5_a2bf8d17.runTest(EJSRemote0SLTestRunner5_a2bf8d17.java)
	at org.eclipse.persistence.testing.framework.server._EJSRemote0SLTestRunner5_a2bf8d17_Tie.runTest(_EJSRemote0SLTestRunner5_a2bf8d17_Tie.java)
	at org.eclipse.persistence.testing.framework.server._EJSRemote0SLTestRunner5_a2bf8d17_Tie._invoke(_EJSRemote0SLTestRunner5_a2bf8d17_Tie.java)
	at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:622)
Comment 1 Tom Ware CLA 2010-08-05 13:41:05 EDT
The TransactionRequiredException is likely a test framework issue due to restrictions on the SessionBeans running the tests.  Assertion failures should be triaged.
Comment 2 Tom Ware CLA 2010-11-18 09:22:49 EST
Deferring 2.1.2 is closed.  This should be triaged in a group effor by QA and Dev based on the fact that this may be a framework issue.
Comment 3 Chris Delahunt CLA 2010-12-08 14:29:55 EST
 The first tests are framework issues: 
CacheableModelJunitTestDisableSelective.testEMPropertiesOnCommit1 and testEMPropertiesOnCommit2 will not work on a server because it tries to get two seperate entityManagers from em.createDSEntityManager().  On a server, I believe they return the one assocated to the transaction - so they will be the same, causing the test to fail - it checks to see if something read in one is cached in the other.  Since they are the same em, it is and so fails.


b) Glassfish TransactionRequiredException message :
<testcase classname="org.eclipse.persistence.testing.tests.jpa.cacheable.CacheableModelJunitTestDisableSelective"
name="testEMPropertiesOnCommit1" time="0.297">
    <error
type="javax.persistence.TransactionRequiredException">javax.persistence.TransactionRequiredException
  at
com.sun.enterprise.container.common.impl.EntityManagerWrapper.doTxRequiredCheck(EntityManagerWrapper.java:152)
  at
com.sun.enterprise.container.common.impl.EntityManagerWrapper.setProperty(EntityManagerWrapper.java:785)
  at org.eclipse.persistence.testing.tests.jpa.cacheable.CacheableModelJunitTestDisableSelective.testEMPropertiesOnCommit1(CacheableModelJunitTestDisableSelective.java:228)

Looks like a Glassfish bug - they are not allowing em1.setProperties() outside a transaction.  It follows the commitTransaction(em1) call, and needs to be investigated what this means/does in the framework on Glassfish and if a bug should be filed.  If this is fixed though, the same tests might still fail in the same way they do on Websphere and Weblogic due to the test made for using multiple EntityManager instances.  

3) testCachingOnUNSPECIFIED failing on Websphere.  This failure implies that Websphere is handling the <shared-cache-mode>UNSPECIFIED</shared-cache-mode> persistence unit property differently (such as interpreting it to mean ALL instead, or that there is a test config failure causing the wrong persistence unit to be used.  I could not find any mention of a Websphere issue, so it is likely a config issue where PU.  This should show up in the logging as a config message should be logged if ALL is being used and the entity specifies @Cacheable(false).
Comment 4 Chris Delahunt CLA 2010-12-08 14:39:24 EST
Glassfish transactionRequiredException is fixed in bug
http://java.net/jira/browse/GLASSFISH-14054
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:03:57 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink