I think I'm putting the persistence.xml file in the wrong place.
I've read I can:
define the unit by placing a JAR file in the lib directory of the EAR, the persistence unit will automatically be visible to all modules in the EAR
So, that's what I tried to do.
Here is the structure of my appplication:
and this is the structure of the DB2 jar file:
I get this exception:
java.lang.IllegalStateException: Unable to retrieve EntityManagerFactory for unitName provaPU
I also tried to put the persistence.xml file directly in the archive (without the META-INF directory) but in this case the application won't event start and I'm getting this exception:
Caused by: java.lang.RuntimeException: Could not resolve a persistence unit corresponding to the persistence-context-ref-name [prova.NewSessionBean/entityManager] in the scope of the module called [EnterpriseApplication3#EJBModule1.jar]. Please verify your application.