Ear deployment and EntityManager injection
I'm fairly new to glassfish and i can't manage to deploy properly my enterprise application on it.
I'm using Glassfish 3.0.1 and JPA 2 with Hibernate 3.5.0 as a persistence provider. My Ear used to deploy and initialize itself just fine on Jboss 6 M2, but for some reason i wanted to migrate to Glassfish.
Problem is, the EntityManager injection doesn't seem to work in my Dao session bean
Here is the structure of my Ear:
my-ejb-daos.jar contain a reference to my-domain.jar in its manifest's class-path entry.
I created a Connection pool which i can ping successfully and a jdbc resource with the exact same name as the jta-data-source element in my persistence.xml
Deployment fails just after the servlet startup. the servlet tries to load some data from the domain via my DAO and it fails and throw this exception:
java.lang.IllegalStateException: Unable to retrieve EntityManagerFactory for unitName MY-UNIT-NAME
In my DAO, I just try to inject an EntityManagerFactory like this
protected EntityManager entityManager;
and then use it like in this example:
return entityManager.find(entityClass, id);
After reading this thread : (http://forums.java.net/jive/thread.jspa?messageID=396967 ), I tried putting persistence.xml in the META-INF folder of my-ejb-daos.jar but that doesn't help.
Any idea why the persistence unit isn't resolved ?