I'm trying to run an integration test with Arquillian using OpenEJB embedded as environment, but the deployment fails due to missing persistence.xml.
This is being run in a module ("services") of a multi-module maven project. The module is being deployed as EJB-Jar ("services.jar") in an EAR ("services-ear.ear"). Also in the EAR I include as library the jar("data-1.0-SNAPSHOT.jar") of another module of my project ("data"). The latter module holds entity pojos and DAOs as EJBs. The DAOs all have an EntityManager, which references a persistence unit that is declared in the /META-INF/persistence.xml in the "data-1.0-SNAPSHOT.jar". So, the structure in the EAR is:
ear
|- services.jar
|- /lib/data-1.0-SNAPSHOT.jar
|- ...
The structure gets printed when I build the ear for deployment to verify that these components are really in the archive. When I run the integration tests, OpenEJB comes up ("15:45:48.345 [LogStreamAsync.Thread] INFO OpenEJB.server - Ready!") and the archives are built and deployed. OpenEJB finds the EJBs in the "data-1.0-SNAPSHOT.jar" and starts deploying them. However, it then fails to find the persistence.xml in the same jar. I have verified that the persistence.xml is in the jar. The messages I get are the same for each EJB:
...
15:56:42.167 [LogStreamAsync.Thread] ERROR OpenEJB.startup.validation - FAIL ... PlatformDaoImpl: A persistence unit must be defined via META-INF/persistence.xml to satisfy @PersistenceContext ref "manager" to unit "". An example of a suitable persistence.xml might be:<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"><persistence-unit name=""><jta-data-source>java:openejb/Resource/myDataSource</jta-data-source><non-jta-data-source>java:openejb/Resource/myUnmanagedDataSource</non-jta-data-source><properties><property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/></properties></persistence-unit></persistence>
15:56:42.167 [LogStreamAsync.Thread] ERROR OpenEJB.startup.validation - FAIL ... DefaultThreatResponseStatusDaoImpl: A persistence unit must be defined via META-INF/persistence.xml to satisfy @PersistenceContext ref "manager" to unit "". An example of a suitable persistence.xml might be:<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"><persistence-unit name=""><jta-data-source>java:openejb/Resource/myDataSource</jta-data-source><non-jta-data-source>java:openejb/Resource/myUnmanagedDataSource</non-jta-data-source><properties><property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/></properties></persistence-unit></persistence>
15:56:42.167 [LogStreamAsync.Thread] ERROR OpenEJB.startup.validation - FAIL ... DataSourceDaoImpl: A persistence unit must be defined via META-INF/persistence.xml to satisfy @PersistenceContext ref "manager" to unit "". An example of a suitable persistence.xml might be:<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"><persistence-unit name=""><jta-data-source>java:openejb/Resource/myDataSource</jta-data-source><non-jta-data-source>java:openejb/Resource/myUnmanagedDataSource</non-jta-data-source><properties><property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/></properties></persistence-unit></persistence>
15:56:42.167 [LogStreamAsync.Thread] ERROR OpenEJB.startup.validation - FAIL ... TechnologyDaoImpl: A persistence unit must be defined via META-INF/persistence.xml to satisfy @PersistenceContext ref "manager" to unit "". An example of a suitable persistence.xml might be:<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"><persistence-unit name=""><jta-data-source>java:openejb/Resource/myDataSource</jta-data-source><non-jta-data-source>java:openejb/Resource/myUnmanagedDataSource</non-jta-data-source><properties><property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/></properties></persistence-unit></persistence>
15:56:42.167 [LogStreamAsync.Thread] ERROR OpenEJB.startup.validation - FAIL ... ear-scoped-cdi-beans_services-ear: A persistence unit must be defined via META-INF/persistence.xml to satisfy @PersistenceContext ref "manager" to unit "". An example of a suitable persistence.xml might be:<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"><persistence-unit name=""><jta-data-source>java:openejb/Resource/myDataSource</jta-data-source><non-jta-data-source>java:openejb/Resource/myUnmanagedDataSource</non-jta-data-source><properties><property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/></properties></persistence-unit></persistence>
15:56:42.167 [LogStreamAsync.Thread] ERROR OpenEJB.startup.validation - Invalid EjbModule(name=ear-scoped-cdi-beans_services-ear, path=ear-scoped-cdi-beans_services-ear)
...
What am I missing?