Bug 327937 - JPQL test failed on JBoss EAP edition
Summary: JPQL test failed on JBoss EAP edition
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords: test
Depends on: 305330 305331
Blocks:
  Show dependency tree
 
Reported: 2010-10-15 14:12 EDT by Kevin Yuan CLA
Modified: 2022-06-09 10:23 EDT (History)
3 users (show)

See Also:


Attachments
patch for bug fix (1.64 KB, patch)
2010-10-26 10:13 EDT, Kevin Yuan CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Yuan CLA 2010-10-15 14:12:58 EDT
Currently all JPA tests have been run on both JBoss community (5.1.0.GA) and eap (5.0.0) edition. The key point for JBoss EAP is: 
The JPA 1.0 specification jar shipped with JBoss EAP is signed. In order to be able to use EclipseLink with this specific version of the JBoss server you must override the ejb3-persistence.jar by placing an unsigned version (./trunk/plugins/javax.persistence_unsigned_for_testing_1.0.0.jar) beside the eclipselink.jar off of the server/default/lib directory (please refer to the following wiki for more detail: http://wiki.eclipse.org/EclipseLink/Bugs/305331). 
 
Before the revision 8275 (EclipseLink 2.2.0), all JPQL tests passed, but after revision 8276 with change in org.eclipse.persistence.testing.tests.jpa.jpql.AdvancedQueryTestSuite, all tests failed with the following error:

java.lang.reflect.InvocationTargetException
Caused by: java.lang.SecurityException: class "javax.persistence.PersistenceException"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(ClassLoader.java:807)
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:488)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:626)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.eclipse.persistence.testing.tests.jpa.jpql.JPQLServerTestSuite.suite(JPQLServerTestSuite.java:26)
Comment 1 Kevin Yuan CLA 2010-10-15 15:41:39 EDT
After removing javax.persistence_unsigned_for_testing_1.0.0.jar and eclipselink.jar from server/default/lib directory, and adding the eclipselink bundles jars insteaded: 
  org.eclipse.persistence.antlr_2.2.0.qualifier.jar
  org.eclipse.persistence.asm_2.2.0.qualifier.jar
  org.eclipse.persistence.core_2.2.0.qualifier.jar
  org.eclipse.persistence.jpa_2.2.0.qualifier.jar
  org.eclipse.persistence.oracle_2.2.0.qualifier.jar

The tests still failed, but got the following NoClassDefFoundError Exceptions:

2010-10-15 14:55:34,646 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (HDScanner) Error installing to Start: name=persistence.unit:unitName=eclipselink-jpql-model.ear/eclipselink-jpql-model_ejb.jar#default state=Create
java.lang.NoClassDefFoundError: javax/persistence/spi/ProviderUtil
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
	at org.jboss.classloader.spi.base.BaseClassLoader.access$200(BaseClassLoader.java:63)
	at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:572)
	at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:532)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:530)
	at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:507)
	at org.jboss.classloader.spi.base.BaseDelegateLoader.loadClass(BaseDelegateLoader.java:134)
	at org.jboss.classloader.spi.filter.FilteredDelegateLoader.loadClass(FilteredDelegateLoader.java:131)
	at org.jboss.classloader.spi.base.ClassLoadingTask$ThreadTask.run(ClassLoadingTask.java:452)
	at org.jboss.classloader.spi.base.ClassLoaderManager.nextTask(ClassLoaderManager.java:267)
	at org.jboss.classloader.spi.base.ClassLoaderManager.process(ClassLoaderManager.java:166)
	at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:265)
	at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:1119)
	at org.jboss.classloader.spi.base.BaseClassLoader.loadClassFromDomain(BaseClassLoader.java:798)
	at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:441)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Comment 2 Tom Ware CLA 2010-10-15 15:52:31 EDT
Based on the testing we've done, it looks like, for some reason, JBoss is loading the SessionBean that is the client for testing differently than the domain classes.

The domain classes are able to pick up our unsigned persistence jar, but the client does not.  It seems to get the persistence classes shipped with JBoss first.   As a result, JPA 1.0 classes referenced in the client come from JBoss and the JPA 2.0 classes come from EclipseLink.  That is what causes the conflict.

We should check for a config option in JBoss EAP that allows us to prioritize the classes defined in our JBoss domain.  (WebSphere has a PARENT_FIRST/PARENT_LAST config.  Perhaps JBoss has something similar)

If that kind of a configuration option exists, we should try using it as the solution to this problem.

If that configuration option does not exist, I beleive the best solution is to exclude this whole test class from the JBoss EAP run.  The changes that triggered this issue are legitmate JPA code (catch a PessimisticLockException)

Customers who have this issue should use our bundles instead of eclispelink.jar.
Comment 3 Michael OBrien CLA 2010-10-15 16:43:01 EDT
>Check the 3 jboss EAR/EJB/WAR examples projects in trunk/examples for an architecture reference
It packages the entities in a separate SE jar (without a persistence.xml)
The entities jar is referenced by both the client WAR and the ejb.jar's persistence.xml
The EntityManager is injected on a stateless session bean as a default container managed transactional persistence unit
The servlet client in the war injects the SSB containing the PU and never interacts directly with the PU (there is no persistence.xml in the war) - only indirectly through the SSB local/remote interface.
Comment 4 Kevin Yuan CLA 2010-10-26 10:13:42 EDT
Created attachment 181731 [details]
patch for bug fix

This is a testing scripts issue, the jbossall-client.jar point to $JBoss_Home/common/lib/ejb3-persistence.jar (which is signed jar), and was added before JPA1.0 unsigned jar. 
Fix this issue just need to move javax.persistence_unsigned_for_testing_1.0.0.jar to the very beginning of client classpath.
Comment 5 Kevin Yuan CLA 2010-10-26 10:17:21 EDT
Tested by running server-test-jpql on JBoss-eap 5.0, all 397 tests passed.

Checked in trunk, and revision # is: 8410
Code reviewed by Yiping Zhao
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:16:39 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 7 Eclipse Webmaster CLA 2022-06-09 10:23:55 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink