'java.lang.IllegalArgumentException: No persistence unit named' Exception After Using With Split Dir Deployment Feature (Doc ID 1528440.1)

Last updated on SEPTEMBER 10, 2014

Applies to:

Oracle Weblogic Server - Version 12.1.1.0 and later
Oracle TopLink - Version 11.1.1.6.0 and later
Information in this document applies to any platform.

Symptoms

 

A J2EE  application is composed  of a Web Module.

This  WEB module consists of :

This Web module is packaged in a WAR file as the following :

 Under WEB-INF/classes :

  1.  META-INF/persistence.xml   (eclipselink descriptor where persistence unit  (with Employee entity) is declared )
  2.  ecl.basic.mod.Employee class
  3.  ejb.TestEjb class      
  4.  web.ServletTest class

 The ServletTest servlet invokes TestEjb  EJB method  querying  JPA Employee  entity.

To deploy this application into WLS 12.1.1 ,  split development dir  feature is used.

The problem happens when invoking the servlet, the following error occurs :

java.lang.IllegalArgumentException: No persistence unit named 'PU_LOCAL_2'
  is available in scope /Web-cdi-project-ant. Available persistence units: []
  at weblogic.persistence.ModulePersistenceUnitRegistry.getPersistenceUnit(ModulePersistenceUnitRegistry.java:130)
  at weblogic.persistence.BasePersistenceContextProxyImpl.(BasePersistenceContextProxyImpl.java:40)
  at weblogic.persistence.TransactionalEntityManagerProxyImpl.(TransactionalEntityManagerProxyImpl.java:31)
  at weblogic.persistence.EntityManagerInvocationHandlerFactory.createTransactionalEntityManagerInvocationHandler(EntityManagerInvocationHandlerFactory.java:20)
  at weblogic.persistence.PersistenceManagerObjectFactory.createPersistenceContextProxy(PersistenceManagerObjectFactory.java:66)
  at com.oracle.injection.integration.ModuleInjectionArchive$DefaultPersistenceContextProxyFactory.createPersistenceContextProxy(ModuleInjectionArchive.java:245)
  at com.oracle.injection.integration.ModuleInjectionArchive.getPersistenceContext(ModuleInjectionArchive.java:200)
  at com.oracle.injection.provider.weld.WeldJpaInjectionServicesAdapter.resolvePersistenceContext(WeldJpaInjectionServicesAdapter.java:37)
  at org.jboss.weld.util.Beans.injectEEFields(Beans.java:617)
  at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1$1.proceed(ManagedBean.java:155)
  at com.oracle.injection.provider.weld.WeldInjectionServicesAdapter.aroundInject(WeldInjectionServicesAdapter.java:88)
  at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:45)

 

This problem does not occur when deploying the application via the WLS console.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms