File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes Strange Persistence Unit deployment error in JBoss 6 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Strange Persistence Unit deployment error in JBoss 6" Watch "Strange Persistence Unit deployment error in JBoss 6" New topic
Author

Strange Persistence Unit deployment error in JBoss 6

Nitin Bhardwaj
Ranch Hand

Joined: Feb 02, 2007
Posts: 72
Hi Friends,

I've used JPA annotations to define the entities and relationship between them. I am using Hibernate 3.3 as persistence provider. When I go to deploy the WAR file of my project (XCMS) in JBoss 6 then I get the following error:

19:16:01,328 INFO [PersistenceUnitDeployment] Starting persistence unit persistence.unit:unitName=XCMS.war#XCMS
19:16:01,390 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=XCMS.war#XCMS state=Create: javax.naming.NameNotFoundException: XCMSDS not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771) [:5.0.5.Final]
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779) [:5.0.5.Final]
at org.jnp.server.NamingServer.getObject(NamingServer.java:785) [:5.0.5.Final]
at org.jnp.server.NamingServer.lookup(NamingServer.java:443) [:5.0.5.Final]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728) [:5.0.5.Final]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688) [:5.0.5.Final]
at javax.naming.InitialContext.lookup(InitialContext.java:392) [:1.6.0_23]
at org.jboss.jpa.impl.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:120) [:2.0.0]
at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:252) [:1.0.2-alpha-1]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_23]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_23]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_23]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_23]
at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:60) [jboss-reflect.jar:2.2.0.Alpha9]
at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:168) [jboss-reflect.jar:2.2.0.Alpha9]
at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66) [jboss-reflect.jar:2.2.0.Alpha9]
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:257) [jbos
s-kernel.jar:2.2.0.Alpha10]
at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47) [jboss-kernel.jar:2.2.0.Alpha10]
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:125) [jboss-kernel
.jar:2.2.0.Alpha10]
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:72) [jboss-kernel.jar:2.2
.0.Alpha10]
at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:202) [jboss-kernel.jar:2.2.0.Alpha10]
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54) [jboss-kernel.jar:2.2.0.Alpha10]
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) [jboss-kernel.jar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-dependency.j
ar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-dependency.jar:2.2.0.Alp
ha10]
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-dependency.jar:2.2.0.Alph
a10]
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.Alpha1
0]
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:894) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:641) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:182) [:2.2.0.Alpha8]
at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:58) [:2.2.0.Alpha8]
at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62) [:2.2.0.Alpha8]
at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55) [:2.2.0.Alpha8]
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179) [:2.2.0.Alpha8]
at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1832) [:2.2.0.Alpha8]
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1550) [:2.2.0.Alpha8]
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1571) [:2.2.0.Alpha8]
at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1491) [:2.2.0.Alpha8]
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.Alpha1
0]
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.deployers.plugins.deployers.DeployersImpl.change(DeployersImpl.java:1983) [:2.2.0.Alpha8]
at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:1076) [:2.2.0.Alpha8]
at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:679) [:2.2.0.Alpha8]
at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.process(MainDeployerPlugin.java:106) [:6.0.0.20101110-CR1]
at org.jboss.profileservice.dependency.ProfileControllerContext$DelegateDeployer.process(ProfileControllerContext.java:130) [:0.1.0.Alpha1]
at org.jboss.profileservice.dependency.ProfileDeployAction.deploy(ProfileDeployAction.java:148) [:0.1.0.Alpha1]
at org.jboss.profileservice.dependency.ProfileDeployAction.installActionInternal(ProfileDeployAction.java:94) [:0.1.0.Alpha1]
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54) [jboss-kernel.jar:2.2.0.Alpha10]
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) [jboss-kernel.jar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-dependency.j
ar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-dependency.jar:2.2.0.Alp
ha10]
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-dependency.jar:2.2.0.Alph
a10]
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.Alpha1
0]
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.Alpha10]
at org.jboss.profileservice.dependency.ProfileServiceController.activate(ProfileServiceController.java:188) [:0.1.0.Alpha1]
at org.jboss.profileservice.AbstractProfileService.activateProfile(AbstractProfileService.java:170) [:0.1.0.Alpha1]
at org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap.activate(AbstractProfileServiceBootstrap.java:117) [:0.1.0.Alpha1]
at org.jboss.profileservice.resolver.BasicResolverFactory$ProfileResolverFacade.deploy(BasicResolverFactory.java:89) [:0.1.0.Alpha1]
at org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap.start(AbstractProfileServiceBootstrap.java:97) [:0.1.0.Alpha1]
at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:130) [:6.0.0.20101110-CR1]

at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.0.0.20101110-CR1]
at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_23]

19:16:02,031 INFO [service] Removing bootstrap log handlers
19:16:02,140 ERROR [org.jboss.profileservice.bootstrap] Failed to load profile:: org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of i
ncomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

DEPLOYMENTS IN ERROR:
Deployment "persistence.unit:unitName=XCMS.war#XCMS" is in error due to the following reason(s): javax.naming.NameNotFoundException: XCMSDS not bound

at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1228) [:2.2.0.Alpha8]
at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:905) [:2.2.0.Alpha8]
at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.checkComplete(MainDeployerPlugin.java:87) [:6.0.0.20101110-CR1]
at org.jboss.profileservice.deployment.ProfileDeployerPluginRegistry.checkAllComplete(ProfileDeployerPluginRegistry.java:118) [:0.1.0.Alpha1]
at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:133) [:6.0.0.20101110-CR1]

at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.0.0.20101110-CR1]
at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_23]

19:16:02,250 INFO [org.apache.coyote.http11.Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
19:16:02,265 INFO [org.apache.coyote.ajp.AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
19:16:02,265 INFO [org.jboss.bootstrap.impl.base.server.AbstractServer] JBossAS [6.0.0.20101110-CR1 "Neo"] Started in 3m:44s:781ms

The persistence.xml listing is given below:


The Persistence Unit name defined in persistence.xml is XCMSPU. However, in Jboss 6 logs I can see that it is trying to use the unitName=XCMS.war#XCMS. Also, in the logs it says that XCMSDS is not bound. But I've checked that the XCMSDS datasource is correctly bound in JBoss 6. I can retrieve that using JNDI in an another web-app.
Just for a little more information I've also configured the session factory in Spring's application context as below:




Please let me know what am I missing?

Best Regards,
Nitin
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10288
    
168

What does the *-ds.xml containing the datasource look like?

[My Blog] [JavaRanch Journal]
Nitin Bhardwaj
Ranch Hand

Joined: Feb 02, 2007
Posts: 72
Hi Jaikiran,

The mysql-ds.xml looks like:



I've tried to retrieve the datasource named XCMSDS above in an another sample web-app deployed in same Jboss instance and it works fine there.

Best Regards,
Nitin
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10288
    
168

It might be a deployment ordering issue then. Try starting the the server with the datasource and without the application. Once it's completely started, place your application in the deploy folder for hot deployment and see if that works. By the way, where is the *-ds.xml located?

Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10288
    
168

Also, are you sure the correct persistence.xml is being picked up? Is there any other persistence.xml in the deployment packaging?
Nitin Bhardwaj
Ranch Hand

Joined: Feb 02, 2007
Posts: 72
Hi Jaikiran,

The mysql-ds.xml is located in the deploy folder of JBoss: the same folder where I am deploying the XCMS app. The Datasource can be retrieved in an another web-app by using the JNDI lookup for string "java:XCMSDS".
The persistence.xml is contained in the META-INF folder of XCMS Web-App, and I really doubt if it is being read because the Persistence Unit name defined in persistence.xml is XCMSPU while in the server logs it is showing the error for persistence unit named XCMS.war#XCMS.
I've checked there is no other persistence.xml except for which I mentioned just above.
Can sessionFactory bean configuration in applicationContext.xml be a source of problem ? (I am using JSF2.0 +Spring 3.0 +Hibernate 3.3 + JPA1 in XCMS. The JPA is only used for annotations part).

Best Regards,
Nitin

Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10288
    
168

Nitin Bhardwaj wrote:
The persistence.xml is contained in the META-INF folder of XCMS Web-App,

That's a wrong location. It should be in .war/WEB-INF/classes/META-INF folder. Move it to the right location.

Nitin Bhardwaj wrote:
and I really doubt if it is being read because the Persistence Unit name defined in persistence.xml is XCMSPU while in the server logs it is showing the error for persistence unit named XCMS.war#XCMS.

If it still doesn't work after moving to the right location, then just remove that persistence.xml from the application and deploy the application. That'll confirm whether it's being picked up or not.
Nitin Bhardwaj
Ranch Hand

Joined: Feb 02, 2007
Posts: 72
Thank you very much Jaikiran. I tried the same and I got the following error this time:

Is it due to some jar conflict (probably slf4j-api.jar)?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10288
    
168

Yes, it looks like a jar conflict. Try removing the slf4j-api (and other slf4j jars) from your application packaging.
Nitin Bhardwaj
Ranch Hand

Joined: Feb 02, 2007
Posts: 72

Yeah it was a jar conflict. I removed slf4j jar and all other hibernate jars (version 3.3) from my application while deploying and this time JBoss started without any error. The Hibernate version that it uses by default is 3.6 (JPA 2).
Just suppose if I want to use the Hibernate 3.3 version (JPA 1) then what should I do? Any way to define the specific jars that my App should be using?

I feel like thanking you again I wasted a lot of time in this when you pointed to my silly mistake

Best Regards,
Nitin
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10288
    
168

Nitin Bhardwaj wrote:
Just suppose if I want to use the Hibernate 3.3 version (JPA 1) then what should I do? Any way to define the specific jars that my App should be using?


This was written for JBoss AS 4.2.x but it would still be applicable for AS6 (maybe with some minor changes).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Strange Persistence Unit deployment error in JBoss 6