Community
Participate
Working Groups
Build Identifier: N/A. Affects EclipseLink 2.4.0-RC2 and 2.3.3-M3 EclipseLink doesn't activate the JBossPlatform adapter (org.eclipse.persistence.platform.server.jboss.JBossPlatform) when deployed on JBoss AS 7 unless explicitly told to with: <property name="eclipselink.target-server" value="jboss"/> in persistence.xml. Consequently it uses generic assumptions about the server platform and among other things fails to find the JTA TransactionManager (https://bugs.eclipse.org/bugs/show_bug.cgi?id=365704). When testing, the expected result would be for EclipseLink to recognise a JBoss AS 7 environment and activate the correct adapter automatically. Reproducible: Always Steps to Reproduce: 1. Grab the testcase at https://github.com/ringerc/scrapcode/tree/master/testcases/javaee/JBossAS7-EclipseLink-Module/as7.eclipselink by cloning git://github.com/ringerc/scrapcode.git and cd'ing to scrapcode/testcases/javaee/JBossAS7-EclipseLink-Module/as7.eclipselink 2. Read the README (https://github.com/ringerc/scrapcode/blob/master/testcases/javaee/JBossAS7-EclipseLink-Module/as7.eclipselink/README) showing how to add EclipseLink to AS 7, enable detailed logging, and run the test. You're only interested in ExplicitClassesTest, so you can add @Ignore to the class level of NoWorkaroundsTest and ExplicitClassesAndTxWorkaroundTest if desired. 3. mvn test . Note several failures. 4. edit src/main/java/META-INF/explicit-classes-persistence.xml and add <property name="eclipselink.target-server" value="jboss"/> 5. mvn clean test . Note that the test now passes.
It turns out this isn't a bug, it's a wishlist/todo item with a side-serve of usability bug. Tom Ware notes (https://bugs.eclipse.org/bugs/show_bug.cgi?id=365704#c26) that EclipseLink doesn't do any server detection. Proper support requires setting <property name="eclipselink.target-server" value="jboss"/> (or whatever other server you are using) to get the right integration and platform adapter. Thus this bug isn't really to do with AS7. Leaving the blocker in place because the current behavior doesn't tell the user anything about why EclipseLink doesn't work properly on AS7 if they haven't set the required property. All they see is that queries fail because EclipseLink can't get a transaction from JTA. It seems to me that either: - AS7 should to recognise Eclipse and feed it the target-server property in a way that a persistence unit configuration can still override; or - Eclipse needs to detect it's running within AS7 and default to the appropriate platform adapter / integration. The vague and hand-wavy nature of the above show that this needs design discussion before any implementation effort. See https://community.jboss.org/en/jbossas7/dev . Leaving this issue in place as a feature req.
FYI: Both GlassFish and WebLogic feed EclipseLink the target server property when creating Container managed EntityManagers. They do not even to detect whether they are feeding the property to EclipseLink because it is an EclipseLink specific property and other app servers will ignore it.
Tom: It seems sensible for JBoss to do the same, it'd be a trivial change. In the mean time users can set a system property to make this transparent to their deployments: $JBOSS_HOME/bin/jboss-cli.sh --connect '/system-property=eclipselink.target-server:add(value=JBoss)'
Added JIRA issue for JBoss to pass this property; https://issues.jboss.org/browse/AS7-5063 . I'll see if I can come up with something when it's not 11pm...
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink