3 Replies Latest reply on Jan 17, 2019 11:43 AM by kmahesh

    Error while starting Wildfly 11 App Server - persistence unit named null

    kmahesh

      I have a maven based JSF+JPA+EJB Project using Eclipse and Wildfly 11.

      Following is the project structure, as you can see persistence.xml is present in META-INF directory.

       

       

      While starting the App Server am getting the following error :

       

      20:37:27,664 INFO  [org.jboss.weld.deployer] (MSC service thread 1-4) WFLYWELD0003: Processing weld deployment erpmini.war

      20:37:28,116 INFO  [org.hibernate.validator.internal.util.Version] (MSC service thread 1-4) HV000001: Hibernate Validator 5.3.5.Final

      20:37:28,552 INFO  [org.jboss.as.ejb3.deployment] (MSC service thread 1-4) WFLYEJB0473: JNDI bindings for session bean named 'UserManagementServiceSlsb' in deployment unit 'deployment "erpmini.war"' are as follows:

       

       

      java:global/erpmini/UserManagementServiceSlsb!com.itsys.erp.server.commonservices.usermgmt.UserManagementService

      java:app/erpmini/UserManagementServiceSlsb!com.itsys.erp.server.commonservices.usermgmt.UserManagementService

      java:module/UserManagementServiceSlsb!com.itsys.erp.server.commonservices.usermgmt.UserManagementService

      java:jboss/exported/erpmini/UserManagementServiceSlsb!com.itsys.erp.server.commonservices.usermgmt.UserManagementService

      java:global/erpmini/UserManagementServiceSlsb

      java:app/erpmini/UserManagementServiceSlsb

      java:module/UserManagementServiceSlsb

       

       

      20:37:29,879 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."erpmini.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."erpmini.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "erpmini.war"

      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:172)

      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)

      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)

      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

      at java.lang.Thread.run(Thread.java:748)

      Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEE0041: Component class com.itsys.erp.server.commonservices.usermgmt.slsbadapter.UserManagementServiceSlsb for component UserManagementServiceSlsb has errors:

      WFLYJPA0033: Can't find a persistence unit named null in deployment "erpmini.war"

      at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor$1.handle(ModuleJndiBindingProcessor.java:157)

      at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54)

      at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.processClassConfigurations(ModuleJndiBindingProcessor.java:186)

      at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:143)

      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165)

      ... 5 more

       

       

      20:37:30,098 INFO  [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-2) ISPN000128: Infinispan version: Infinispan 'Chakra' 8.2.8.Final

      20:37:31,825 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 63) WFLYCLINF0002: Started client-mappings cache from ejb container

      20:37:32,131 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "erpmini.war")]) - failure description: {

          "WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"erpmini.war\".INSTALL" => "WFLYSRV0153: Failed to process phase INSTALL of deployment \"erpmini.war\"

          Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEE0041: Component class com.itsys.erp.server.commonservices.usermgmt.slsbadapter.UserManagementServiceSlsb for component UserManagementServiceSlsb has errors:

      WFLYJPA0033: Can't find a persistence unit named null in deployment \"erpmini.war\""},

          "WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"erpmini.war\".beanmanager"],

          "WFLYCTL0180: Services with missing/unavailable dependencies" => [

              "jboss.deployment.unit.\"erpmini.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"erpmini.war\".beanmanager]",

              "jboss.deployment.unit.\"erpmini.war\".batch.artifact.factory is missing [jboss.deployment.unit.\"erpmini.war\".beanmanager]"

          ]

      }

       

      I'm injecting the EntityManager in stateless bean:

      @Stateless

      public class UserManagementServiceSlsb implements UserManagementService {

       

           /** The Entity Manager */

           @PersistenceContext(name = "ErpMiniAppPU")

           private EntityManager entityManager;

       

           private UserManagementService userMgmtService;

           ....

      }

      Why the Container is not able to find persistence file? Any help would be appreciated.

        • 1. Re: Error while starting Wildfly 11 App Server - persistence unit named null
          simkam

          Hi,

           

          how does resulting war file look like? When you unpack it, is persistence.xml at correct location. In screenshot I would expect META-INF dir in resources instead of src.

          • 2. Re: Error while starting Wildfly 11 App Server - persistence unit named null
            kmahesh

            Hi,

            Tried moving META-INF folder to resources folder, it's showing same error.

             

            19:17:22,195 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC000001: Failed to start service jboss.deployment.unit."erpmini.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."erpmini.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "erpmini.war"

             

            The war file under deployments dir is failed one : erpmini.war.failed

            I did the maven update and then mvn clean install, build is success.

            But now I see that Eclipse is showing some error with red colored cross icon over the erpmini project when added to Wildfly server.

             

            Don't know why.

             

            Now I read that in JPA 2.2 specification section 8.2, it says :

            A persistence unit is defined by a persistence.xml file. The jar file or directory whose

            META-INF directory contains the persistence.xml file is termed the root of the persistence unit.

            In Java EE environments, the root of a persistence unit must be one of the following:

             

            • an EJB-JAR file
            • the WEB-INF/classes directory of a WAR file[89]
            • a jar file in the WEB-INF/lib directory of a WAR file
            • a jar file in the EAR library directory
            • an application client jar file

             

            Now my project is a maven Web App project and I don't see WEB-INF dir under src/main/java/webapp. So I created the WEB-INF/classes directory and moved the persistence.xml file over there.

            But this shows error icon over the root directory of the project and getting same error on server start.

            • 3. Re: Error while starting Wildfly 11 App Server - persistence unit named null
              kmahesh

              I solved it by adding resources folder (as source folder) to the path src/main/resources and moving the META-INF  folder to resources folder, which in turn tells maven to put all files under resources directory to target/classes and in WEB-INF/classes in the WAR.