1 Reply Latest reply: Mar 19, 2014 9:23 AM by dvohra21 RSS

    Persistence unit not found when deploying as virtual application

    c82b575e-ffa7-4943-9b8e-d7259fd4be03

      Hello,

       

      I am having some problems regarding my persistence unit being out of scope when deploying my application as a virtual application.

      I am getting the following exception:

       

      java.lang.IllegalArgumentException: No persistence unit named 'myUnit' is available in scope myLib.jar. Available persistence units: []

      at weblogic.persistence.ModulePersistenceUnitRegistry.getPersistenceUnit(ModulePersistenceUnitRegistry.java:132)

      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)

      at weblogic.persistence.PersistenceManagerObjectFactory.getObjectInstance(PersistenceManagerObjectFactory.java:31)

      at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)

      at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)

      at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:426)

      at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:45)

      at weblogic.jndi.internal.AbstractURLContext.lookup(AbstractURLContext.java:130)

      at javax.naming.InitialContext.lookup(InitialContext.java:411)

      at javax.naming.InitialContext.doLookup(InitialContext.java:284)

      at com.oracle.pitchfork.inject.Jsr250Metadata.jndiLookup(Jsr250Metadata.java:310)

      at com.oracle.pitchfork.inject.Jsr250Metadata.resolveByName(Jsr250Metadata.java:306)

      at com.oracle.pitchfork.inject.Jsr250Metadata.resolve(Jsr250Metadata.java:269)

      at com.oracle.pitchfork.inject.Jsr250Metadata.applyInjections(Jsr250Metadata.java:231)

      at com.oracle.pitchfork.inject.Jsr250Metadata.inject(Jsr250Metadata.java:222)

      at com.oracle.pitchfork.spi.BaseComponentBrokerImpl.getBean(BaseComponentBrokerImpl.java:63)

      at com.oracle.pitchfork.spi.EjbComponentCreatorBrokerImpl.getBean(EjbComponentCreatorBrokerImpl.java:33)

      at weblogic.ejb.container.injection.EjbComponentCreatorImpl.getBean(EjbComponentCreatorImpl.java:76)

      at weblogic.ejb.container.manager.BaseEJBManager.createNewBeanInstance(BaseEJBManager.java:218)

      at weblogic.ejb.container.manager.BaseEJBManager.allocateBean(BaseEJBManager.java:244)

      at weblogic.ejb.container.manager.StatelessManager.createBean(StatelessManager.java:306)

      at weblogic.ejb.container.pool.StatelessSessionPool.createBean(StatelessSessionPool.java:179)

      at weblogic.ejb.container.pool.StatelessSessionPool.getBean(StatelessSessionPool.java:108)

      at weblogic.ejb.container.manager.StatelessManager.preInvoke(StatelessManager.java:187)

      at weblogic.ejb.container.internal.BaseLocalObject.getBeanInstance(BaseLocalObject.java:149)

      ... 88 more

       

      The persistence xml is located in a library myModel.jar.

      The .beabuild.txt file contains the following entry:

      path/to/myModel.jar = APP-INF/lib/myModel.jar

       

      However, when I open the myModel project in eclipse, a different .beabuild.txt file will be generated when deploying. It then contains the following entry:

      path/to/eclipse/workspace/myModel/target/classes = APP-INF/lib/myModel.jar

      With this .beabuild.txt file, the exception does not occur. It also does not occur when I directly deploy the ear on the server.

       

      Does anyone have an idea why the persistence unit can not be loaded from the jar?

       

      Thanks