4 Replies Latest reply on May 8, 2012 9:39 PM by dvohra21

    War deployment via OEPE: persistence.xml not processed

      I'm using Oracle WebLogic Server Tools in Eclipse 3.7.2 on Mac OS X 10.6.8. I've created a dynamic web project (originally for JBoss AS 7.1.1), which I'm trying to deploy to WebLogic 12c.

      For some reason WebLogic can't find/process persistence.xml at run-time, resulting in an exception saying no persistence unit is available (see below).

      The project works fine when deployed to JBoss AS 7.1.1, GlassFish 3.1.2 or TomEE. When I export the .war, or create an ear containing that war, and export that via Eclipse's native export facility and put that in the autodeploy folder of WebLogic 12c, everything works.

      When I add a new EJB module to the EAR and add a persistence.xml to it, then deploy it via OEPE again, it works in the EJB module, but still fails in the web module.

      If I add a new web module (dynamic webproject) with the "default configuration for Oracle WebLogic Server 12c (12.1.1)" (which adds the "wls.web" Facet by default), add a persistence context and an EJB bean, then it again doesn't work.

      The persistence context in workspace/bla/src/META-INF:

      <?xml version="1.0" encoding="UTF-8"?>
      <persistence version="2.0"
      xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

      <persistence-unit name="blaz">


      <property name="javax.persistence.jtaDataSource" value="java:/app/jdbc/SimpleAppScopedDS" />


      The one and only bean in this web module at /workspace/bla/src/foo:

      public class MyFooBean {

      private EntityManager em;

      public void init() {


      The exception that follows during startup:

      weblogic.application.ModuleException: Exception starting EjbModuleExtension for Module(bla)
           at weblogic.ejb.container.deployer.EjbModuleExtension.start(EjbModuleExtension.java:169)
           at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:113)
           at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
           at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:213)
           at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:208)
           Truncated. see log file for complete stacktrace
      Caused By: java.lang.IllegalArgumentException: No persistence unit named 'em' is available in scope bla. Available persistence units: []
           at weblogic.persistence.ModulePersistenceUnitRegistry.getPersistenceUnit(ModulePersistenceUnitRegistry.java:130)
           at weblogic.persistence.BasePersistenceContextProxyImpl.<init>(BasePersistenceContextProxyImpl.java:40)
           at weblogic.persistence.TransactionalEntityManagerProxyImpl.<init>(TransactionalEntityManagerProxyImpl.java:31)
           at weblogic.persistence.EntityManagerInvocationHandlerFactory.createTransactionalEntityManagerInvocationHandler(EntityManagerInvocationHandlerFactory.java:20)
           at weblogic.persistence.PersistenceManagerObjectFactory.createPersistenceContextProxy(PersistenceManagerObjectFactory.java:66)
           Truncated. see log file for complete stacktrace

      As I originally thought it was a WebLogic problem, I first opened a thread here: Weblogic 12c not picking up persistence unit in WAR

      After trying nearly every combination I can think of it, the problem seems to be with the specific combination of OEPE, web modules and persistence.xml in META-INF. Every other combination does work.

      Edited by: Henk on Apr 30, 2012 1:47 AM