1 Reply Latest reply on Aug 7, 2011 12:02 PM by Nitin Bhardwaj

    Persistence Unit deployment error in JBoss 6

    Nitin Bhardwaj Newbie

      Hi Friends,

       

      I am trying to develop an application with Spring 3 and Hibernate 3.3.

      I've used JPA annotations (JPA 1.0) 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:

      <?xml version="1.0" encoding="UTF-8"?>

      <persistence version="1.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_1_0.xsd">

                <persistence-unit name="XCMSPU" transaction-type="JTA">

                          <description>Hibernate ORM</description>

                          <provider>org.hibernate.ejb.HibernatePersistence</provider>

                          <jta-data-source>java:XCMSDS</jta-data-source>

                          <properties>

                                    <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>

                                    <property name="hibernate.show_sql" value="true"/>

                          </properties>

         </persistence-unit>

      </persistence>

       

       

      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.

      I am really not sure whether this persistence.xml is being read or not (I've placed it in META-INF folder of web-app).

       

      Just for a little more information to you, I've also configured the session factory in Spring's application context as below:

       

      <jee:jndi-lookup id="xcmsDataSource" jndi-name="java:XCMSDS"/>

       

       

      <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">

                          <property name="dataSource">

                                    <ref bean="xcmsDataSource" />

                          </property>

       

                          <property name="entityInterceptor">

                                    <ref bean="entityInterceptor" />

                          </property>

                          <property name="hibernateProperties">

                                    <props>

                                              <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>

                                              <prop key="hibernate.show_sql">true</prop> <!-- This should be set to false in production environment. -->                                 

                                    </props>

                          </property>

                </bean>

        

       

       

      Please let me know what am I missing?

       

       

      Best Regards,

      Nitin