Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Amir Keibi
Ranch Hand
Posts: 49
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 66
Java Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Amir Keibi
Ranch Hand
Posts: 49
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure what you mean. The persistence.xml resides within the EJB's JAR file's META-INF directory.
 
Amir Keibi
Ranch Hand
Posts: 49
Eclipse IDE Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 66
Java Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(case sensitive)


it's always the small ones that are nasty. And thanks for sharing the thing about the version. Appreciate it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic