Friday, June 22, 2012

Getting EclipseLink to play well on JBoss AS 7

It's currently a bit tricky to get EclipseLink to work smoothly on JBoss AS 7. There's a good write-up on it by Rich DiCroce on the JBoss Community site that I won't repeat; go read it if you want to use EclipseLink with AS7.

I've packaged Rich's VFS integration code, some JBoss loging integration code, and a platform adapter needed for older versions of EclipseLink into a a simple as7-eclipselink-integration library that can be included directly in projects or bundled in the EclipseLink module installed in AS7.

The library build produces a ready-to-install AS7 module for EclipseLink with the integration helper code pre-installed.

It should simplify doing the integration work on a project.




To use, just:

git clone git://github.com/ringerc/as7-eclipselink-integration.git
cd as7-eclipselink-integration
mvn -DskipTests=true clean install

then either install the jboss as 7 module for EclipseLink that's been produced at target/as7module or add the dependency shown in the README to your project.

All the tests pass fine, but only when the as7module is installed and a system property is set (see README), which is why you should skip them when simply building the package.

Feedback would be welcome. Most of the code isn't mine but all the packaging and integration is, so there's plenty of room for me to have added bugs. Credit goes to Rich DiCroce, all bugs are probably mine.

Please also keep an eye on the EclipseLink / JBoss AS 7 integration bug in Eclipse bugzilla, and link to issues related to AS7 + EclipseLink there.

3 comments:

  1. If we can get the code contributed to the EclipseLink project through the listed bug we can try to make some of this support available out of the box.

    Doug

    ReplyDelete
    Replies
    1. Doug: I'm trying to make that happen at the moment. The only code that's actually mine (other than the build) is the server adapter, and that's obsoleted in 2.3.3 and 2.4. I'm not free to sign the rest over, but hope that Rich DiCroce will submit his archiver integration code.

      It's not necessarily best to include this in EclipseLink in any case. Some integration code may be better off in JBoss's modules/org/jboss/as/jpa (as pointed out to me by Rich), which contains persistence provider integration.

      Comments on https://bugs.eclipse.org/bugs/show_bug.cgi?id=383200 by Tom Ware suggest that at least one of the issues may be rooted in a JBoss non-compliant behaviour; another can be solved trivially by JBoss by passing a property to EclipseLink. Ideally most of this adapter code won't be needed once bugs in both projects get sorted out.

      Delete
    2. It looks like most of the integration code will sit better in AS7, where it can be automatically activated on demand.

      The library linked to above now builds a proper AS7 persistence provider integration module with an implementation of org.jboss.as.jpa.spi.PersistenceProviderAdaptor registered using a META-INF/services/org.jboss.as.jpa.spi.PersistenceProviderAdaptor entry. It now activates when EclipseLink is found, automatically setting eclipselink.target-server, eclipselink.logging.logger and eclipselink.archive.factory as part of entity manager factory creation.

      I haven't figured out a way to solve the null members in the static metamodel, but the other issues I know of are resolved by the new integration, and it doesn't require the addition of any properties to persistence.xml anymore.

      Delete

Captchas suck. Bots suck more. Sorry.