0 Replies Latest reply on Feb 23, 2009 6:34 AM by ercan celik

    Can't find a persistence unit named 'null'

    ercan celik Newbie

      Hi

      When i am deploying my projects to server, it gives an error. My project structure looks like this:

      Doc-EJB3
      - src
      - doc.ejb3.entitiy // source package
      - doc.ejb3.service //another source package
      - META-INF
      - MANIFEST.MF
      - persistence.xml
      - doc-ds.xml
      - jndi.properties


      persistence.xml looks like this:

      <?xml version="1.0" encoding="UTF-8"?>
      <persistence>
       <persistence-unit name="DOCPU">
       <jta-data-source>java:/DOCDS</jta-data-source>
       <properties>
       <!-- <property name="hibernate.hbm2ddl.auto" value="create-drop"/> -->
       </properties>
       </persistence-unit>
      </persistence>
      

      doc-ds.xml looks like this:
      <?xml version="1.0" encoding="UTF-8"?>
      
      <!-- $Id: mim-ds.xml,v 1.1 2007/06/29 21:08:56 ugur Exp $ -->
      <!-- Datasource config for MySQL using 3.0.9 available from:
      http://www.mysql.com/downloads/api-jdbc-stable.html
      -->
      
      <datasources>
       <local-tx-datasource>
       <jndi-name>DOCDS</jndi-name>
       <connection-url>jdbc:mysql://localhost:3306/document</connection-url>
       <driver-class>com.mysql.jdbc.Driver</driver-class>
       <user-name>root</user-name>
       <password>atasrv123*</password>
       <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
       <!-- should only be used on drivers after 3.22.1 with "ping" support
       <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
       -->
       <!-- sql to call when connection is created
       <new-connection-sql>some arbitrary sql</new-connection-sql>
       -->
       <!-- sql to call on an existing pooled connection when it is obtained from pool - MySQLValidConnectionChecker is preferred for newer drivers
       <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
       -->
      
       <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
       <metadata>
       <type-mapping>mySQL</type-mapping>
       </metadata>
       </local-tx-datasource>
      </datasources>
      


      And finally this is the error :
      13:08:30,651 INFO [TomcatDeployment] deploy, ctxPath=/Doc-Admin, vfsUrl=Doc-Admin.war
      13:08:30,714 INFO [TomcatDeployment] deploy, ctxPath=/Doc-WEB, vfsUrl=Doc-WEB.war
      13:08:30,846 INFO [TomcatDeployment] deploy, ctxPath=/, vfsUrl=ROOT.war
      13:08:31,012 INFO [TomcatDeployment] deploy, ctxPath=/jmx-console, vfsUrl=jmx-console.war
      13:08:31,932 ERROR [AbstractKernelController] Error installing to Real: name=vfsfile:/F:/jboss-5.0.0.GA/server/all/deploy/Doc-EJB3.jar/ state=PreReal mode=Manual requiredState=Real
      org.jboss.deployers.spi.DeploymentException: Error deploying Doc-EJB3.jar: Container jboss.j2ee:jar=Doc-EJB3.jar,name=GenelServiceBean,service=EJB3 failed to resolve persistence unit null
       at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:203)
       at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:104)
       at org.jboss.deployers.vfs.spi.deployer.AbstractVFSRealDeployer.internalDeploy(AbstractVFSRealDeployer.java:45)
       at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
       at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
       at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
       at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
       at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
       at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
       at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
       at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
       at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
       at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:545)
       at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:304)
       at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:205)
       at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
       at org.jboss.Main.boot(Main.java:209)
       at org.jboss.Main$1.run(Main.java:547)
       at java.lang.Thread.run(Unknown Source)
      Caused by: java.lang.IllegalArgumentException: Container jboss.j2ee:jar=Doc-EJB3.jar,name=GenelServiceBean,service=EJB3 failed to resolve persistence unit null
       at org.jboss.injection.PersistenceUnitHandler.addPUDependency(PersistenceUnitHandler.java:135)
       at org.jboss.injection.PersistenceContextHandler.loadXml(PersistenceContextHandler.java:76)
       at org.jboss.ejb3.EJBContainer.processMetadata(EJBContainer.java:588)
       at org.jboss.ejb3.Ejb3Deployment.processEJBContainerMetadata(Ejb3Deployment.java:415)
       at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:523)
       at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:196)
       ... 22 more
      Caused by: java.lang.IllegalArgumentException: Can't find a persistence unit named 'null' in AbstractVFSDeploymentContext@18707904{vfsfile:/F:/jboss-5.0.0.GA/server/all/deploy/Doc-EJB3.jar/}
       at org.jboss.jpa.resolvers.BasePersistenceUnitDependencyResolver.resolvePersistenceUnitSupplier(BasePersistenceUnitDependencyResolver.java:107)
       at org.jboss.ejb3.Ejb3Deployment.resolvePersistenceUnitSupplier(Ejb3Deployment.java:720)
       at org.jboss.ejb3.EJBContainer.resolvePersistenceUnitSupplier(EJBContainer.java:1428)
       at org.jboss.injection.PersistenceUnitHandler.addPUDependency(PersistenceUnitHandler.java:130)
       ... 27 more
      13:08:32,018 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
      
      *** CONTEXTS IN ERROR: Name -> Error
      
      vfsfile:/F:/jboss-5.0.0.GA/server/all/deploy/Doc-EJB3.jar/ -> java.lang.IllegalArgumentException: Can't find a persistence unit named 'null' in AbstractVFSDeploymentContext@18707904{vfsfile:/F:/jboss-5.0.0.GA/server/all/deploy/Doc-EJB3.jar/}
      


      please help