aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes No persistence unit named '***' is available in scope BL-1.0.0-SNAPSHOT.jar. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "No persistence unit named Watch "No persistence unit named New topic
Author

No persistence unit named '***' is available in scope BL-1.0.0-SNAPSHOT.jar.

Amir Keibi
Ranch Hand

Joined: Apr 23, 2012
Posts: 49

Hi all,

Environment:
An EJB 3.0 module being deployed to WebLogic 11g. The persistence code is currently included in the EJB's JAR.

Problem:
Upon deployment of EJB to WebLogic, I receive the following error:

Exception preparing module: EJBModule(BL-1.0.0-SNAPSHOT) Unable to deploy EJB: PlaceOrderBean from BL-1.0.0-SNAPSHOT.jar: No persistence unit named 'orderingMainPU' is available in scope BL-1.0.0-SNAPSHOT.jar. Available persistence units: []

Persistence.xml:



JAR file's structure:

BL-1.0.0-SNAPSHOT.jar
|
-----META-INF
| |
| ------- Persistence.xml
| ------- MANIFEST.MF
|
.....


WebLogic's stack trace:
Caused By: java.lang.IllegalArgumentException: No persistence unit named 'orderingMainPU' is available in scope BL-1.0.0-SNAPSHOT.jar. Available persistence units: []
at weblogic.deployment.ModulePersistenceUnitRegistry.getPersistenceUnit(ModulePersistenceUnitRegistry.java:132)
at weblogic.deployment.BasePersistenceContextProxyImpl.<init>(BasePersistenceContextProxyImpl.java:38)
at weblogic.deployment.TransactionalEntityManagerProxyImpl.<init>(TransactionalEntityManagerProxyImpl.java:35)
at weblogic.deployment.BaseEnvironmentBuilder.createPersistenceContextProxy(BaseEnvironmentBuilder.java:974)
at weblogic.deployment.BaseEnvironmentBuilder.addPersistenceContextRefs(BaseEnvironmentBuilder.java:855)
at weblogic.ejb.container.deployer.EJBDeployer.setupEnvironmentContext(EJBDeployer.java:275)
at weblogic.ejb.container.deployer.EJBDeployer.setupEnvironmentFor(EJBDeployer.java:1114)
at weblogic.ejb.container.deployer.EJBDeployer.setupBeanInfos(EJBDeployer.java:1008)
at weblogic.ejb.container.deployer.EJBDeployer.prepare(EJBDeployer.java:1271)
at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:440)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:507)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:149)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:45)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:1221)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:367)
at weblogic.application.internal.SingleModuleDeployment.prepare(SingleModuleDeployment.java:43)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:747)
at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216)
at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:46)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)


Any help is greatly appreciated.
Prabaharan Gopalan
Ranch Hand

Joined: Oct 16, 2009
Posts: 66

The straightforward thing that comes to my mind is that the application is not able to find the persistence.xml in the classpath. Are you sure it is in the classpath?


Googling doesn't make you a genius. But not Googling makes you dumber.
Amir Keibi
Ranch Hand

Joined: Apr 23, 2012
Posts: 49

Not sure what you mean. The persistence.xml resides within the EJB's JAR file's META-INF directory.
Amir Keibi
Ranch Hand

Joined: Apr 23, 2012
Posts: 49

For the sake of others who are searching for same issue:

Persistence.xml should've been persistence.xml (case sensitive)

Also, I realized I made a mistake in versioning of the XML namespace of the persistence.xml file. Since I copied the XML file from another project which is deployed to Glassfish 3 (which uses JDK7 and consequently version 2.0 of JPA spi) it conflicts with my EJB's dependency to version 1.0 of JPA spi.

So instead of



I now have

Prabaharan Gopalan
Ranch Hand

Joined: Oct 16, 2009
Posts: 66

(case sensitive)


it's always the small ones that are nasty. And thanks for sharing the thing about the version. Appreciate it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: No persistence unit named '***' is available in scope BL-1.0.0-SNAPSHOT.jar.
 
Similar Threads
EJB3 2 client apps and 2 different databases
JPA/Hibernate 3.5.5 in WebSphere Application Server 7 Exception
JPA: Can't find Persistence Provider
Please tell me I have a typo in my Persistence.xml
Problem with ORM by Weblogic