1 2 Previous Next 23 Replies Latest reply on Mar 27, 2013 12:06 PM by smarlow

    No persistence provider for EntityManager when using a shared Hibernate 3 module

    glsilver

      I'm trying to migrate my web application from Jboss AS 5 to AS 7.1.1. The application includes a separately deployed DAO jar with the database entities and a persistence.xml file and depends on Hibernate 3 libraries. I created a hibernate 3 module per the AS 7.1.1 documentation on using a shared Hibernate 3.5 or greater persistence provider, but when I run my web application,  I get the following error:

       

      08:51:01,220 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/WebPortal].[action]] (http--127.0.0.1-8080-2) Servlet.service() for servlet action threw exception: javax.persistence.

      PersistenceException: No Persistence provider for EntityManager named AccountManagement

              at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:69) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final]

              at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final]

              at com.dsi.objectmodel.persistence.PersistenceUnitBase.<clinit>(PersistenceUnitBase.java:37) [edispense.objectModel.core.jar:]

              at com.dsi.evaccine.web.portal.struts.ShowLoginAction.getCopyright(ShowLoginAction.java:110) [classes:]

              at com.dsi.evaccine.web.portal.struts.ShowLoginAction.execute(ShowLoginAction.java:97) [classes:]

              at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) [struts-1.2.9.jar:1.2.9]

              at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) [struts-1.2.9.jar:1.2.9]

              at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) [struts-1.2.9.jar:1.2.9]

              at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) [struts-1.2.9.jar:1.2.9]

              at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

              at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]

              at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]

              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]

              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]

              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]

              at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]

       

       

      My Hibernate 3 module.xml is as follows:

       

      <module xmlns="urn:jboss:module:1.0" name="org.hibernate" slot="3">

          <resources>

              <resource-root path="hibernate-core-3.6.6.Final.jar"/>

              <resource-root path="hibernate-commons-annotations-3.2.0.Final.jar"/>

              <resource-root path="hibernate-entitymanager-3.6.6.Final.jar"/>

              <resource-root path="javassist-3.12.0.GA.jar"/>

              <resource-root path="antlr-2.7.6.jar"/> 

              <resource-root path="commons-collections-3.2.1.jar"/> 

              <resource-root path="dom4j-1.6.1.jar"/>

              <!-- Insert other Hibernate 3 jars to be used here -->

          </resources>

       

          <dependencies>

              <module name="org.jboss.as.jpa.hibernate" slot="3"/>

              <module name="asm.asm"/>

              <module name="javax.api"/>

              <module name="javax.persistence.api"/>

              <module name="javax.transaction.api"/>

              <module name="javax.validation.api"/>

                          <!--<module name="org.infinispan"/>-->

              <module name="org.javassist"/>

              <module name="org.slf4j"/>

          </dependencies>

      </module>

       

      And here is the relevent portion of my persistence.xml:

       

      <persistence xmlns="http://java.sun.com/xml/ns/persistence">

          <persistence-unit name="AccountManagement" transaction-type="RESOURCE_LOCAL">

              <!-- UNCOMMENT THE NEXT LINE WHEN RUNNING IN JBOSS -->

              <non-jta-data-source>java:/DsiDS</non-jta-data-source>

       

      <!-- PERSISTENT CLASSES -->

       

      <properties>          

                  <property name="jboss.as.jpa.providerModule" value="org.hibernate:3" />

                  <property name="jboss.as.jpa.managed" value="false" />

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

                  <property name="hibernate.hbm2ddl.auto" value="update"/>           

              </properties>

          </persistence-unit>

      </persistence>

       

       

      Finally, here is my datasource configuration in standalone.xml:

       

      <datasource jndi-name="java:/DsiDS" pool-name="DsiDS_Pool" enabled="true" use-java-context="true">

                          <connection-url>jdbc:postgresql://dsidev:5432/qa</connection-url>

                          <driver>postgresql</driver>

                          <security>

                              <user-name>....</user-name>

                              <password>...</password>

                          </security>

                      </datasource>

       

      My web application (war file) and dependent jars deploy without error. Can anyone tell me what I'm doing wrong?

        • 1. Re: No persistence provider for EntityManager when using a shared Hibernate 3 module
          smarlow

          Can you try doing two things here.  First stop the AS7 server and enable trace logging for JPA.

           

          Recreate the above failure and then change the persistence.xml to have jboss.as.jpa.managed to set true.  Try deploying again.  Attach the as7/standalone/log/server.log here after so we can see it.

          • 2. Re: No persistence provider for EntityManager when using a shared Hibernate 3 module
            glsilver

            I activated trace logging as suggested. Attached are two server.log files, the first one is with jboss.as.jpa.managed="false" in my persistence.xml and the second one is with it set to "true", so you can see the difference. There are some classpath errors in the logs, but I don’t believe those are relevant to the issue at hand, which is the loading of the persistence unit. You notice that with jboss.as.jpa.managed=”true”, I get a “Failed to define class org.jboss.as.jpa.hibernate3.infinispan.InfinispanRegionFactory” error and my DAO jar, edispense.objectModel.core.jar, won’t deploy at all.

            • 3. Re: No persistence provider for EntityManager when using a shared Hibernate 3 module
              smarlow

              Can you try again with the AS7 nightly build here.  You should leave 'jboss.as.jpa.managed' set to true or comment it out (it defaults to true).

              • 4. Re: No persistence provider for EntityManager when using a shared Hibernate 3 module
                glsilver

                Per your suggestion, I tried with jboss-as-7.1.2.Final-SNAPSHOT. Same persistence.xml, same datasource configuration, same org.hibernate:3 module. The server.log is attached.  Everything seemed to going fine during deployment until I got the following error:

                 

                ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => "JBAS014750: Operation handler failed to complete"}}

                 

                What exactly does that mean?

                • 5. Re: No persistence provider for EntityManager when using a shared Hibernate 3 module
                  glsilver

                  Oops. Don't respond to my previous reply yet. I forgot to include the postgres deiver module in the mix. Once I did that, the deployment worked without a hitch. So far so good in my migration efforts. Thanks for the help.

                  • 6. Re: No persistence provider for EntityManager when using a shared Hibernate 3 module
                    glsilver

                    Although my DAO library is now loading, correctly, it appears, in jboss-as-7.1.2-FInal-SNAPSHOT, I still can't run my web application due to the initial error message I started this thread with, namely:

                     

                    08:36:59,480 INFO  [org.jboss.as.osgi] (MSC service thread 1-4) JBAS011941: Register module: Module "deployment.WebPortal.war:main" from Service Module Loader

                    08:36:59,511 WARN  [org.jboss.web] (MSC service thread 1-1) JBAS018204: Clustering not supported, falling back to non-clustered session manager

                    08:36:59,589 INFO  [org.apache.struts.tiles.TilesPlugin] (MSC service thread 1-1) Tiles definition factory loaded for module ''.

                    08:36:59,605 INFO  [org.apache.struts.validator.ValidatorPlugIn] (MSC service thread 1-1) Loading validation rules file from '/WEB-INF/validator-rules.xml'

                    08:36:59,605 INFO  [org.apache.struts.validator.ValidatorPlugIn] (MSC service thread 1-1) Loading validation rules file from '/WEB-INF/validation.xml'

                    08:36:59,636 INFO  [org.jboss.web] (MSC service thread 1-1) JBAS018210: Registering web context: /WebPortal

                    08:36:59,792 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018559: Deployed "WebPortal.war"

                    08:37:21,599 INFO  [org.apache.struts.tiles.TilesRequestProcessor] (http--127.0.0.1-8080-2) Tiles definition factory found for request processor ''.

                    08:37:21,605 TRACE [org.jboss.as.jpa] (http--127.0.0.1-8080-2) returning global (module) Persistence Provider org.hibernate.ejb.HibernatePersistence

                    08:37:21,606 TRACE [org.jboss.as.jpa] (http--127.0.0.1-8080-2) returning global (module) Persistence Provider org.hibernate.ejb.HibernatePersistence

                    08:37:21,668 INFO  [org.hibernate.annotations.common.Version] (http--127.0.0.1-8080-2) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}

                    08:37:21,671 INFO  [org.hibernate.Version] (http--127.0.0.1-8080-2) HHH000412: Hibernate Core {4.1.1}

                    08:37:21,673 INFO  [org.hibernate.cfg.Environment] (http--127.0.0.1-8080-2) HHH000206: hibernate.properties not found

                    08:37:21,674 INFO  [org.hibernate.cfg.Environment] (http--127.0.0.1-8080-2) HHH000021: Bytecode provider name : javassist

                    08:37:21,685 INFO  [org.hibernate.ejb.Ejb3Configuration] (http--127.0.0.1-8080-2) HHH000318: Could not find any META-INF/persistence.xml file in the classpath

                    08:37:21,686 INFO  [org.hibernate.ejb.Ejb3Configuration] (http--127.0.0.1-8080-2) Could not find any META-INF/persistence.xml file in the classpath

                    08:37:21,687 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/WebPortal].[action]] (http--127.0.0.1-8080-2) Servlet.service() for servlet action threw exception: javax.persistence.PersistenceException: No Persistence provider for EntityManager named AccountManagement

                              at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:69) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final]

                              at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final]

                              at com.dsi.objectmodel.persistence.PersistenceUnitBase.<clinit>(PersistenceUnitBase.java:37) [edispense.objectModel.core.jar:]

                              at com.dsi.evaccine.web.portal.struts.ShowLoginAction.getCopyright(ShowLoginAction.java:110) [classes:]

                              at com.dsi.evaccine.web.portal.struts.ShowLoginAction.execute(ShowLoginAction.java:97) [classes:]

                              at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) [struts-1.2.9.jar:1.2.9]

                              at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) [struts-1.2.9.jar:1.2.9]

                              at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) [struts-1.2.9.jar:1.2.9]

                              at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) [struts-1.2.9.jar:1.2.9]

                              at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]

                              at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]

                              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.14.Final.jar:]

                              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.14.Final.jar:]

                              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.14.Final.jar:]

                              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.14.Final.jar:]

                              at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.14.Final.jar:]

                              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.14.Final.jar:]

                              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.14.Final.jar:]

                              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.14.Final.jar:]

                              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.14.Final.jar:]

                              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.14.Final.jar:]

                              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931) [jbossweb-7.0.14.Final.jar:]

                              at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]

                     

                    You'll notice that my war file, WebPortal.war, deployed, but I can't run it as http://localhost:8080/WebPortal. The log says it can't find the META-INF/persistence.xml file. But this was deployed in the DAO library and should be visible in the classpath. But it isn't. Any idea why? Also, since I am using hibernate 3 libraries, why does the log show Hibernate version 4.1.1? Do I need to add a dependency to org.hibernate:3 in my war file??

                    • 7. Re: No persistence provider for EntityManager when using a shared Hibernate 3 module
                      smarlow

                      I think that you are getting the Hibernate 4 module instead of the Hibernate 3 module from the javax.persistence.Persistence lookup (since that API isn't modularized yet and the same persistence provider class name is used for Hibernate 3 + 4). 

                       

                      The easiest hack  to try first, is removing the as7/modules/org/hibernate/main folder, so only as7/modules/org/hibernate/3 will be loaded.  You will see a startup error when we fail to pre-load the Hibernate 4 module. 

                       

                      The cleaner change, would be to package the Hibernate 3 jars with your application (the javax.persistence.Persistence API will give preference to the persistence provider that is packaged with the application).

                      • 8. Re: No persistence provider for EntityManager when using a shared Hibernate 3 module
                        glsilver

                        When I tried  your  "easiest hack", the server won't even start. I get a boot.log error (see below). And I can't do the "cleaner change" since I am packaging my DAO library as a jar, not a war. In any case, is this even the reason the persistence.xml isn't in the classpath?

                         

                        09:26:01,467 DEBUG [org.jboss.as.config] VM Arguments: -XX:+TieredCompilation -Dprogram.name=standalone.bat -Xms64M -Xmx512M -XX:MaxPermSize=256M -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djboss.server.default.config=standalone.xml -Dorg.jboss.boot.log.file=C:\Apps\jboss-as-7.1.2.Final-SNAPSHOT\standalone\log\boot.log -Dlogging.configuration=file:C:\Apps\jboss-as-7.1.2.Final-SNAPSHOT\standalone/configuration/logging.properties

                         

                         

                        09:26:01,810 ERROR [org.jboss.as.server] JBAS015956: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: JBAS014676: Failed to parse configuration

                                  at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:141) [jboss-as-controller-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                                  at org.jboss.as.server.ServerService.boot(ServerService.java:268) [jboss-as-server-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                                  at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:155) [jboss-as-controller-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                                  at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]

                        Caused by: javax.xml.stream.XMLStreamException: Failed to load module org.jboss.as.ejb3

                                  at org.jboss.as.controller.parsing.ExtensionXml.parseExtensions(ExtensionXml.java:154) [jboss-as-controller-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                                  at org.jboss.as.server.parsing.StandaloneXml.readServerElement_1_1(StandaloneXml.java:307) [jboss-as-server-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                                  at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:128) [jboss-as-server-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                                  at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:100) [jboss-as-server-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                                  at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) [staxmapper-1.1.0.Final.jar:1.1.0.Final]

                                  at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69) [staxmapper-1.1.0.Final.jar:1.1.0.Final]

                                  at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:133) [jboss-as-controller-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                                  ... 3 more

                        Caused by: java.util.concurrent.ExecutionException: javax.xml.stream.XMLStreamException: JBAS014674: Failed to load module

                                  at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222) [rt.jar:1.6.0_26]

                                  at java.util.concurrent.FutureTask.get(FutureTask.java:83) [rt.jar:1.6.0_26]

                                  at org.jboss.as.controller.parsing.ExtensionXml.parseExtensions(ExtensionXml.java:146) [jboss-as-controller-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                                  ... 9 more

                        Caused by: javax.xml.stream.XMLStreamException: JBAS014674: Failed to load module

                                  at org.jboss.as.controller.parsing.ExtensionXml.loadModule(ExtensionXml.java:195) [jboss-as-controller-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                                  at org.jboss.as.controller.parsing.ExtensionXml.access$000(ExtensionXml.java:68) [jboss-as-controller-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                                  at org.jboss.as.controller.parsing.ExtensionXml$1.call(ExtensionXml.java:126) [jboss-as-controller-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                                  at org.jboss.as.controller.parsing.ExtensionXml$1.call(ExtensionXml.java:123) [jboss-as-controller-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                                  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [rt.jar:1.6.0_26]

                                  at java.util.concurrent.FutureTask.run(FutureTask.java:138) [rt.jar:1.6.0_26]

                                  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_26]

                                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_26]

                                  at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]

                                  at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.0.0.GA.jar:2.0.0.GA]

                        Caused by: org.jboss.modules.ModuleNotFoundException: Module org.hibernate:main is not found in local module loader @3e110003 (roots: C:\Apps\jboss-as-7.1.2.Final-SNAPSHOT\modules)

                                  at org.jboss.modules.LocalModuleLoader.findModule(LocalModuleLoader.java:126) [jboss-modules.jar:1.1.1.GA]

                                  at org.jboss.modules.ModuleLoader.loadModuleLocal(ModuleLoader.java:275) [jboss-modules.jar:1.1.1.GA]

                                  at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:222) [jboss-modules.jar:1.1.1.GA]

                                  at org.jboss.modules.LocalModuleLoader.preloadModule(LocalModuleLoader.java:94) [jboss-modules.jar:1.1.1.GA]

                                  at org.jboss.modules.Module.addPaths(Module.java:841) [jboss-modules.jar:1.1.1.GA]

                                  at org.jboss.modules.Module.link(Module.java:1181) [jboss-modules.jar:1.1.1.GA]

                                  at org.jboss.modules.Module.relinkIfNecessary(Module.java:1207) [jboss-modules.jar:1.1.1.GA]

                                  at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:208) [jboss-modules.jar:1.1.1.GA]

                                  at org.jboss.as.controller.parsing.ExtensionXml.loadModule(ExtensionXml.java:177) [jboss-as-controller-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                                  ... 9 more

                        09:26:01,857 FATAL [org.jboss.as.server] JBAS015957: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.

                        09:26:01,872 INFO  [org.jboss.as] JBAS015950: JBoss AS 7.1.2.Final-SNAPSHOT "Brontes" stopped in 3ms

                        • 9. Re: No persistence provider for EntityManager when using a shared Hibernate 3 module
                          smarlow

                          Yeah, scratch the "easiest" hack off the list.

                           

                          In any case, is this even the reason the persistence.xml isn't in the classpath?

                           

                           

                          I think your right that the PersistenceException is occuring (with the Hibernate 4 module) because the persistence.xml is not found.  The code that generates the warning (prior to the exception being thrown) is here.  The separately deployed DAO jar won't be visible to the war. 

                           

                          You could try to add the deployment.dao.jar to the application classpath but I'm not sure if that will be enough.  See https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7 for tips on changing the application classpath.

                           

                          I think switching to an EAR packaging might be better (you could bring the DAO into each separate ear deployment). 

                          • 10. Re: No persistence provider for EntityManager when using a shared Hibernate 3 module
                            glsilver

                            I was afraid you might suggest packaging everything as an EAR. That is not going to be possible for us. We have a home-grown portal environment where we independently deploy some 70+ war files and a number of dependent jars, including our DAO library. A complete EAR deployment would be out-of the question on size alone. Is there another solution, or should we give up migrating from AS 5?

                            • 11. Re: No persistence provider for EntityManager when using a shared Hibernate 3 module
                              smarlow

                              You could try to add the deployment.dao.jar to the application classpath but I'm not sure if that will be enough.  See https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7 for tips on changing the application classpath.

                               

                              You could try some of the ideas mentioned in the above link.

                              • 12. Re: No persistence provider for EntityManager when using a shared Hibernate 3 module
                                glsilver

                                Well, I tried everything described in https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7 to load modules, including using global modules in the standalone.xml, sticking a jboss-deployment-structure.xml in META-INF and generating dependencies in MANIFEST.MF, and nothing works. I keep getting the following error when I try to run my web application:

                                 

                                12:06:02,173 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/WebPortal].[action]] (http--127.0.0.1-8080-1) Servlet.service() for servlet action threw exception: javax.persistence.

                                PersistenceException: No Persistence provider for EntityManager named AccountManagement

                                        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:69) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final]

                                        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final]

                                       at com.dsi.objectmodel.persistence.PersistenceUnitBase.<clinit>(PersistenceUnitBase.java:37) [edispense.objectModel.core.jar:]

                                        at com.dsi.evaccine.web.portal.struts.ShowLoginAction.getCopyright(ShowLoginAction.java:110) [classes:]

                                        at com.dsi.evaccine.web.portal.struts.ShowLoginAction.execute(ShowLoginAction.java:97) [classes:]

                                        at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) [struts-1.2.9.jar:1.2.9]

                                        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) [struts-1.2.9.jar:1.2.9]

                                        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) [struts-1.2.9.jar:1.2.9]

                                        at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) [struts-1.2.9.jar:1.2.9]

                                        at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]

                                        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]

                                        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.14.Final.jar:]

                                        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.14.Final.jar:]

                                        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.14.Final.jar:]

                                        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.14.Final.jar:]

                                        at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                                        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.14.Final.jar:]

                                        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.14.Final.jar:]

                                        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.14.Final.jar:]

                                        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.14.Final.jar:]

                                        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.14.Final.jar:]

                                        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.14.Final.jar:]

                                        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931) [jbossweb-7.0.14.Final.jar:]

                                        at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]

                                 

                                 

                                Here, I highlighted the code that is breaking. The exact line is:

                                     

                                protected static EntityManagerFactory factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);

                                 

                                where PERSISTENCE_UNIT_NAME is defined as "AccountManagement", the persistence unit name in the persistence.xml file.  Could the fact that I am using a non-JTA datasource and  RESOURCE_LOCAL as the transaction type make any difference?

                                 

                                I'm about ready to give up migrating from AS 5 to AS 7 if this can't be resolved.

                                • 13. Re: No persistence provider for EntityManager when using a shared Hibernate 3 module
                                  smarlow

                                  Do you still see the "INFO  [org.hibernate.ejb.Ejb3Configuration] (http--127.0.0.1-8080-2) HHH000318: Could not find any META-INF/persistence.xml file in the classpath" message logged prior to the PersistenceException?

                                  • 14. Re: No persistence provider for EntityManager when using a shared Hibernate 3 module
                                    glsilver

                                    Yes, I do get that message. Interestingly, if instead of  loading the dependencies in MANIFEST.MF, I include a jboss-deployment-structure.xml file in my web application WEB-INF directory, I don't get that error, but instead get a NoClassDefException when I run the web application and it first tries to instantiate a class from the DAO library. Here is my jboss-deployment-structure.xml:

                                     

                                    <?xml version="1.0"?>

                                    <jboss-deployment-structure>

                                      <deployment>

                                         <dependencies>

                                            <module name="javax.servlet.api"/>

                                            <module name="deployment.edispense.objectModel.core.jar"/>  

                                            <module name="org.jboss.as.web"/>

                                          </dependencies>   

                                      </deployment> 

                                    </jboss-deployment-structure>

                                     

                                    The DAO library, edispense.objectModel.core.jar, is deployed in the standalone/deployments directory. Here is the code that fails:

                                     

                                    AccountManagement am = new AccountManagement();

                                     

                                    You see, I am just trying to instantiate a class from the library, and it should be in the classpath. I understand a java.lang.ClassNotFoundException, but what is NoClassDefFoundError? Is it the same thing, or does it mean something else?  I'm spinning my wheels on trying to fix this.

                                     

                                    Here is the system.log error:

                                     

                                    17:22:16,729 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/WebPortal].[action]] (http--127.0.0.1-8080-2) Servlet.service() for servlet action threw exception: java.lang.NoClassD

                                    efFoundError: Could not initialize class com.dsi.objectmodel.accountmanagement.AccountManagement

                                            at com.dsi.evaccine.web.portal.struts.ShowLoginAction.getCopyright(ShowLoginAction.java:110) [classes:]

                                            at com.dsi.evaccine.web.portal.struts.ShowLoginAction.execute(ShowLoginAction.java:97) [classes:]

                                            at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) [struts-1.2.9.jar:1.2.9]

                                            at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) [struts-1.2.9.jar:1.2.9]

                                            at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) [struts-1.2.9.jar:1.2.9]

                                            at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) [struts-1.2.9.jar:1.2.9]

                                            at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]

                                            at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final.jar:1.0.1.Final]

                                            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.14.Final.jar:]

                                            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.14.Final.jar:]

                                            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.14.Final.jar:]

                                            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.14.Final.jar:]

                                            at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.2.Final-SNAPSHOT.jar:7.1.2.Final-SNAPSHOT]

                                            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.14.Final.jar:]

                                            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.14.Final.jar:]

                                            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.14.Final.jar:]

                                            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.14.Final.jar:]

                                            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.14.Final.jar:]

                                            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.14.Final.jar:]

                                            at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931) [jbossweb-7.0.14.Final.jar:]

                                            at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]

                                    1 2 Previous Next