3 Replies Latest reply on Aug 15, 2010 2:21 PM by Jose M. M. M.

    Fail on deploy project with persistence unit

    Jose M. M. M. Newbie

      When i try to deploy my project i have this error:

       

      16:48:58,194 INFO  [config] Initializing Mojarra (1.2_12-b01-FCS) for context '/admin-console'
      16:49:01,447 INFO  [TomcatDeployment] deploy, ctxPath=/
      16:49:01,509 INFO  [TomcatDeployment] deploy, ctxPath=/jmx-console
      16:49:01,605 ERROR [Ejb3Deployment] Exception while processing container metadata for EJB: prueba in unit: pruebajpa-ejb.jar
      16:49:01,606 ERROR [AbstractKernelController] Error installing to Real: name=vfszip:/E:/jboss/server/default/deploy/pruebajpa.ear/ state=PreReal mode=Manual requiredState=Real
      org.jboss.deployers.spi.DeploymentException: Error deploying pruebajpa-ejb.jar: Exception while processing container metadata for EJB: prueba in unit: pruebajpa-ejb.jar
              at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:196)
              at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:99)
              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.doInstallParentFirst(DeployersImpl.java:1210)
              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:1631)
              at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
              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:702)
              at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
              at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
              at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
              at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361)
              at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
              at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
              at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
              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.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)
              at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)
              at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
              at org.jboss.Main.boot(Main.java:221)
              at org.jboss.Main$1.run(Main.java:556)
              at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.Exception: Exception while processing container metadata for EJB: prueba in unit: pruebajpa-ejb.jar
              at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:549)
              at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:189)
              ... 34 more
      Caused by: java.lang.RuntimeException: <injection-target> could not be found: ejb.prueba.pruebajpa-ejbPU
              at org.jboss.injection.InjectionUtil.findInjectionTarget(InjectionUtil.java:223)
              at org.jboss.injection.InjectionUtil.injectionTarget(InjectionUtil.java:299)
              at org.jboss.injection.PersistenceContextHandler.loadXml(PersistenceContextHandler.java:64)
              at org.jboss.ejb3.EJBContainer.processMetadata(EJBContainer.java:588)
              at org.jboss.ejb3.Ejb3Deployment.processEJBContainerMetadata(Ejb3Deployment.java:418)
              at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:527)
              ... 35 more
      16:49:01,940 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

      DEPLOYMENTS IN ERROR:
        Deployment "vfszip:/E:/jboss/server/default/deploy/pruebajpa.ear/" is in error due to the following reason(s): java.lang.RuntimeException: <injection-target> could not be found: ejb.prueba.pruebajpa-ejbPU

      16:49:01,954 INFO  [Http11Protocol] Arrancando Coyote HTTP/1.1 en puerto http-127.0.0.1-8080
      16:49:01,979 INFO  [AjpProtocol] Arrancando Coyote AJP/1.3 en ajp-127.0.0.1-8009
      16:49:02,404 INFO  [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221634)] Started in 46s:293ms

       

       
      
       

      Files of this project:

      jboss-ds.xml

       

      <?xml version="1.0" encoding="UTF-8"?>
      <datasources>
        <local-tx-datasource>
          <jndi-name>pruebaDB</jndi-name>
          <connection-url>jdbc:mysql://localhost:3306/test</connection-url>
          <driver-class>com.mysql.jdbc.Driver</driver-class>
          <user-name>root</user-name>
          <password>root</password>
          <min-pool-size>5</min-pool-size>
          <max-pool-size>20</max-pool-size>
          <idle-timeout-minutes>5</idle-timeout-minutes>
        </local-tx-datasource>
      </datasources>
      

       

       

      persistence.xml:

       

      <?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="pruebajpa-ejbPU" transaction-type="JTA">
          <jta-data-source>java:/pruebaDB</jta-data-source>
        </persistence-unit>
      </persistence>
      

       

       

      EM-EJB:

       

      @Stateful
      public class prueba implements pruebaLocal {
          @PersistenceContext(name="pruebajpa-ejbPU")
          private EntityManager em;
          public int fila() {
              Query consulta = em.createNamedQuery("Zona.findAll");
              return ((Zona)(consulta.getResultList().get(1))).getPresupuestoMes();
              //return 0;
          }
          
          // Add business logic below. (Right-click in editor and choose
          // "Insert Code > Add Business Method")
          
      }
      

       

       

      In rar file: DB backup and project by Netbeans.

      I need more config files for it work?

        • 1. Re: Fail on deploy project with persistence unit
          jaikiran pai Master
          @PersistenceContext(name="pruebajpa-ejbPU")
              private EntityManager em;
          
          
          

           

          That should be:

           

          @PersistenceContext(unitName="pruebajpa-ejbPU")
              private EntityManager em;
          
          
          

           

          Note the use of "unitName" instead of "name"

          1 of 1 people found this helpful
          • 2. Re: Fail on deploy project with persistence unit
            Jose M. M. M. Newbie

            Thank you. I change it, but now i have a new error.

             

             

             

            18:32:25,160 INFO  [JBossASKernel] Added bean(jboss.j2ee:ear=pruebajpa.ear,jar=pruebajpa-ejb.jar,name=prueba,service=EJB3) to KernelDeployment of: pruebajpa-ejb.jar
            18:32:25,162 INFO  [EJB3EndpointDeployer] Deploy
            AbstractBeanMetaData@122cae2{name=jboss.j2ee:ear=pruebajpa.ear,jar=pruebajpa-ejb.jar,name=prueba,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
            18:32:25,291 INFO  [TomcatDeployment] deploy, ctxPath=/pruebajpa-war
            18:32:25,381 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

            DEPLOYMENTS MISSING DEPENDENCIES:
              Deployment "jboss.j2ee:ear=pruebajpa.ear,jar=pruebajpa-ejb.jar,name=prueba,service=EJB3" is missing the following dependencies:
                Dependency "<UNKNOWN jboss.j2ee:ear=pruebajpa.ear,jar=pruebajpa-ejb.jar,name=prueba,service=EJB3>" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'persistence.unit:unitName=pruebajpa.ear/pruebajpa-ejb.jar#pruebajpa-ejbPU' **")
              Deployment "jboss.j2ee:ear=pruebajpa.ear,jar=pruebajpa-ejb.jar,name=prueba,service=EJB3_endpoint" is missing the following dependencies:
                Dependency "jboss.j2ee:ear=pruebajpa.ear,jar=pruebajpa-ejb.jar,name=prueba,service=EJB3" (should be in state "Configured", but is actually in state "PreInstall")
              Deployment "persistence.unit:unitName=pruebajpa.ear/pruebajpa-ejb.jar#pruebajpa-ejbPU" is missing the following dependencies:
                Dependency "jboss.jca:name=pruebaDB,service=DataSourceBinding" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jca:name=pruebaDB,service=DataSourceBinding' **")

            DEPLOYMENTS IN ERROR:
              Deployment "<UNKNOWN jboss.j2ee:ear=pruebajpa.ear,jar=pruebajpa-ejb.jar,name=prueba,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'persistence.unit:unitName=pruebajpa.ear/pruebajpa-ejb.jar#pruebajpa-ejbPU' **
              Deployment "jboss.jca:name=pruebaDB,service=DataSourceBinding" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.jca:name=pruebaDB,service=DataSourceBinding' **

            18:32:25,682 INFO  [Http11Protocol] Arrancando Coyote HTTP/1.1 en puerto http-127.0.0.1-8080
            18:32:25,714 INFO  [AjpProtocol] Arrancando Coyote AJP/1.3 en ajp-127.0.0.1-8009
            18:32:25,724 INFO  [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221634)] Started in 49s:622ms