Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » EclipseLink 2.1.2 on JBoss 6.0.0 Final
EclipseLink 2.1.2 on JBoss 6.0.0 Final [message #651436] Sun, 30 January 2011 21:12 Go to next message
diego.rivera.cr is currently offline diego.rivera.crFriend
Messages: 5
Registered: January 2011
Junior Member
Hello, everyone!

I'm migrating an application from Glassfish 3.0.1 to JBoss 6.0.0 Final (due to customer requirements). To expedite the migration and avoid a rather hefty persistence layer refactor I'm using EclipseLink 2.1.2 as the JPA provider. Needless to say the application works fine in Glassfish. Anyway...

The application uses EJB 3.1 in a WAR (Servlet 3.0, JSF 2.0), and JPA 2.0 persistence. I have already defined the DataSources needed (included below).

I've almost got it running in JBoss 6. But I have a very strange issue regarding transactions not being properly enlisted by the persistence manager (or, at least, that's what it seems). I keep getting javax.ejb.EJBException: javax.persistence.TransactionRequiredException

I believe the problem may have to do with the fact that I have no "target-server" configuration in my persistence.xml - before you chastise me, it turns out that if I do add that configuration, the error then becomes that EclipseLink can't find (let alone weave/process) any entities.

It seems this is in response to an old JBoss bug wrt classloader wonkiness (can't remember what forum post I read that on).

After looking through the code, it seems obvious that the problem is that EclipseLink isn't finding the JTA transaction manager. This is probably because it's trying to locate it in the wrong place (because JBoss platform isn't active).

It seems I'm in a catch-22 here: if I fix one thing, I irreparably break another.

My question is: how can I make EclipseLink work with JBoss 6 container-managed transactions, AND dynamic entity discovery + weaving?

This is the last hurdle (I think/hope) before completing the migration and beginning the certification process.

Ideas? Thoughts?

Thanks!
Re: EclipseLink 2.1.2 on JBoss 6.0.0 Final [message #651535 is a reply to message #651436] Mon, 31 January 2011 15:25 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

JBoss does not support dynamic weaving of JPA Entities. So to use weaving you must use static weaving in EclipseLink. i.e. run the static weaving ant task on your ejb jar. Otherwise you could disable weaving.

You must use the JBoss target-server to integrate with JTA. Other than weaving this should work. EclipseLink works with, and is tested on JBoss nightly.


James : Wiki : Book : Blog : Twitter
Re: EclipseLink 2.1.2 on JBoss 6.0.0 Final [message #651541 is a reply to message #651535] Mon, 31 January 2011 15:34 Go to previous messageGo to next message
diego.rivera.cr is currently offline diego.rivera.crFriend
Messages: 5
Registered: January 2011
Junior Member
Thanks!

I did try that, and did succeed. However, I had to explicitly list the classes in persistence.xml (which sucks). I was doing my weaving using the antrun task via Maven.

This is the task:
Quote:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>process-classes</phase>
<configuration>
<target>
<taskdef name="weave" classname=" org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask " classpathref="maven.test.classpath" />
<weave loglevel="ALL" source="${basedir}/target/classes" target="${basedir}/target/classes" log="weaver.log">
<classpath refid="maven.test.classpath" />
</weave>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>



Is there any way to configure the Eclipselink weaver to scan those directories and weave as-necessary vs. having to explicitly list the classes in persistence.xml?
Re: EclipseLink 2.1.2 on JBoss 6.0.0 Final [message #652319 is a reply to message #651436] Thu, 03 February 2011 15:15 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

If you include the class in a jar and have the persistence.xml in the meta-inf in the jar, and have exclude-unlisted-classes=false, then all Entities should be auto discovered.


James : Wiki : Book : Blog : Twitter
Re: EclipseLink 2.1.2 on JBoss 6.0.0 Final [message #652435 is a reply to message #652319] Thu, 03 February 2011 21:54 Go to previous message
diego.rivera.cr is currently offline diego.rivera.crFriend
Messages: 5
Registered: January 2011
Junior Member
Perfect! Thank you!

I have the application deploying perfectly on JBoss, but still not running due to (what I expect to be) a JBoss bug.

Cheers.
Previous Topic:exception while paging data with eclipselink jpa
Next Topic:Discriminator and caching
Goto Forum:
  


Current Time: Sun Dec 21 06:21:30 GMT 2014

Powered by FUDForum. Page generated in 0.20848 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software