Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Unable to retrieve EntityManagerFactory for unitName primary

anemdhanaSep 12 2013 — edited Sep 13 2013

Hi,

this is the exception thrown when injecting EntityManager.

Caused by: java.lang.IllegalStateException: Unable to retrieve EntityManagerFactory for unitName primary at com.sun.enterprise.container.common.impl.EntityManagerWrapper.init(EntityManagerWrapper.java:132)

The following exists in ejb module of my maven project.

public class Resources {

    @Produces
    @PersistenceContext(unitName = "primary")
    private EntityManager em;

My persistence unit below in the location ejb/src/main/resources/META-INF

<persistence-unit name="primary">
      <!-- If you are running in a production environment, add a managed 
         data source, this example data source is just for development and testing! -->
      <!-- The datasource is deployed as <EAR>/META-INF/glassfish-resources.xml, you
         can find it in the source at ear/src/main/application/META-INF/glassfish-resources.xml -->
      <jta-data-source>java:app/jdbc/myportalDS</jta-data-source>

Pls help me what could be missing in my code.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 11 2013
Added on Sep 12 2013
2 comments
4,378 views