I’m having a problem with JBoss 7.02.Final. I’m porting a project from JBoss5.1GA and (outside a fair amount of rewrites in the lookups to support EE6) I’m having a problem registering Eclipselink on the classpath. I’ve searched around and I see several posts saying this issue is fixed but I can’t seem to find a working example.
There’s a very high chance I’m doing something wrong as I’m new to EE6 development.
The ear is built as the following
- ProductionEE6
./lib/eclipselink2.*.jar
./lib/javax.persistence.jar
. . .
ProductionEJB.jar
. . .
Production.war
My persistence.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_2_0.xsd">
<persistence-unit name="production" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<non-jta-data-source>java:/ProductionDS</non-jta-data-source>
<class><!-- entities --></class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
<property name="eclipselink.target-server" value="JBoss"/>
<!-- A few other properties here -->
</properties>
</persistence-unit>
</persistence>
Everything boots up fine, I see the datasources, I get through security (through a custom DatabaseModule so my data-sources are definitely fine) and when I finally make a call to an EJB I see the following errors:
Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named production
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:69) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final]
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final]
at com.danielbchapman.production.entity.DelegateInstance.getEm(DelegateInstance.java:67) [ProductionEJB.jar:]
at com.danielbchapman.production.entity.EntityInstance.getEm(EntityInstance.java:39) [ProductionEJB.jar:]
at com.danielbchapman.production.beans.OptionsDao.<init>(OptionsDao.java:20) [ProductionEJB.jar:]
... 94 more
In regards to that, I’m not using a JTA DataSource so I’ve been handling the transactions manually. This call is the “DelegateInstance” above with the following code: (where persistenceUnitId is “production” in this case.)
/**
* @return an instance of the entity manager if it isn't there.
*/
public EntityManager getEm()
{
if(manager == null)
{
manager = Persistence.createEntityManagerFactory(getPersistenceUnitId())
.createEntityManager();
}
return manager;
}
What worries me the most is seeing this on the stack:
[hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final] Obviously I’m not loading EclipseLink properly. I’m running out of ideas here so if anyone can help I’d be very grateful.
EclipseLink 2.4 will now work with JBoss AS 7.1.1 – tested and working – hth