JBoss 5.1.0.GA, JPA 2.0, and EClipseLink 2.0
dghighfill Jan 11, 2010 12:37 PMI have been working on an issue getting JBoss, JPS, and EClipseLink all working together for several days now. I believe it's in the class loading of the JPA through JBoss, but I just can't figure it out.
I have the development environment all setup in Eclipse Gannymede and I can start up the server and all works fine. I do however have to put the WebContent directory of my Eclipse Project on the launch configuration of the startup of the JBoss Server in Eclise so that it can find my META-INF\persistence.xml file. This is using RESOURCE-LOCAL as the transaction type.
Now I'm trying to build team testing server, obviously outside of Eclipse, but I cannot get the environment to run. I'll have errors like there is no @Id defined for the entity class when that is clearly not the case because it runs fine through JUnit. Sometimes it just depends on where I put the META-INF directory and what exception gets thrown.
Can one run these three technologies together? I would assume so?
I'm attaching a zip file of my deployed Ear file from Eclipse that runs fine through Eclipse (with the WebContent added to the startup) but will not run by starting up JBoss with run.bat. I've tried passing the same VM args Eclipse does, but still no dice. In this Ear, I've also taken the META-INF folder and moved it under the WEB-INF\classes directory and I a different set of exceptions.
I can attach the Eclipse Workspace as well if that would help.
Is there something that I'm doing wrong that is very obvious? Is there something special in the JBoss configuration that I need to do to support EclipseLink or JPA 2.0 or get the class loading to occur properly.
I'm stuck and cannot proceed further as I've exaushted all my resources on this one. Normally I can figure things out on my own or find another post with the answer, but I'm really stumped this time.
It's been a couple of days and I have a lot of reviews, but still responses. I thought I'd add a few of the exceptions that are thrown by the JPA to see if it may better describe what is going on. I'm also going to attach the Eclipse workspace to see if there's something obvious. After I start the server, I run the com.dstsystems.services.ProductSponsorTest from the JUnit source directory. I realize that anyone trying to test this will not have the schema for the database and can't run the tests, but I'm hoping that something is obvious in what I'm doing wrong.
01-11-2010 - With everything running in Eclipse and the WebContent directory added to my "Open Launch Configuration" for the JBoss Server in Eclipse. I open a DOS window and run JBoss from the installation directory and type run.bat.
This results in the following exception.
Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named RICCDB
I'm pretty confident this is because the META-INF directory is not included in the classpath running from the DOS window. I've added the WebContent directory to the classpath in Eclipse and I don't get this error. So I then moved the take the META-INF directory from the SampleService.war to the SampleService.war\WEB-INF\classes directory. I restart the server.
This results in the following exception.
java.lang.RuntimeException: Specification violation [EJB3 JPA 6.2.1.2] - You have not defined a non-jta-data-source for a RESOURCE_LOCAL enabled persistence context named: RICCDB
So I then add the following two lines to the persistence.xml
<jta-data-source>java:RICCDB</jta-data-source>
<non-jta-data-source>java:RICCDB</non-jta-data-source>
This change results in the following exception
Exception Description: Entity class [class com.dstsystems.entity.ProductSponsorEntity] has no primary key specified. It should define either an @Id, @EmbeddedId or an @IdClass. If you have defined PK using any of these annotations then make sure that you do not have mixed access-type (both fields and properties annotated) in your entity class hierarchy.
I believe this is where the ProductSponsorEntity cannot be found in the classpath, because I can get the same error from my JUnit tests if I specify the wrong package name for a class in the classes element of the persistence.xml.
Any help would be greatly appreciated.
-
SampleServiceEAR.ear.zip 21.4 KB
-
JBossJpa.zip 72.2 KB