8 Replies Latest reply on Mar 28, 2018 10:48 AM by virendra656

    Hibernate 3 issue.

    dvrajitha

      When i try to deploy this in wildfly 10 i am getting this error.

       

      Source: https://github.com/sgilda/wildfly-quickstart/tree/master/hibernate3

       

      What could be the issue?

       

      15:18:57,413 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) WFLYSRV0027: Starting deployment of "wildfly-hibernate3.war" (runtime-name: "wildfly-hibernate3.war")

      15:18:57,716 INFO  [org.jboss.as.jpa] (MSC service thread 1-2) WFLYJPA0002: Read persistence.xml for primary

      15:18:57,722 WARN  [org.jboss.as.connector] (MSC service thread 1-2) WFLYJCA0091: -ds.xml file deployments are deprecated. Support may be removed in a future version.

      15:18:57,850 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-4) WFLYSRV0018: Deployment "deployment.wildfly-hibernate3.war" is using a private module ("org.apache.commons.collections:main") which may be changed or removed in future versions without notice.

      15:18:57,869 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-4) WFLYSRV0018: Deployment "deployment.wildfly-hibernate3.war" is using a private module ("org.antlr:main") which may be changed or removed in future versions without notice.

      15:18:57,878 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-4) WFLYSRV0018: Deployment "deployment.wildfly-hibernate3.war" is using a private module ("asm.asm:main") which may be changed or removed in future versions without notice.

      15:18:57,888 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-4) WFLYSRV0018: Deployment "deployment.wildfly-hibernate3.war" is using a private module ("org.javassist:main") which may be changed or removed in future versions without notice.

      15:18:57,905 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.unit."wildfly-hibernate3.war".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."wildfly-hibernate3.war".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment "wildfly-hibernate3.war"

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

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

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

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

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

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

      Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYJPA0019: Could not deploy application packaged persistence provider 'org.hibernate.ejb.HibernatePersistence'

              at org.jboss.as.jpa.processor.PersistenceProviderHandler.deploy(PersistenceProviderHandler.java:79)

              at org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:49)

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

              ... 5 more

      Caused by: java.lang.ClassCastException: class org.hibernate.ejb.HibernatePersistence

              at java.lang.Class.asSubclass(Class.java:3404)

              at org.jboss.as.jpa.processor.PersistenceProviderHandler.deploy(PersistenceProviderHandler.java:72)

              ... 7 more

       

      15:18:57,984 ERROR [org.jboss.as.controller.management-operation] (management task-6) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "wildfly-hibernate3.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"wildfly-hibernate3.war\".FIRST_MODULE_USE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"wildfly-hibernate3.war\".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment \"wildfly-hibernate3.war\"

          Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYJPA0019: Could not deploy application packaged persistence provider 'org.hibernate.ejb.HibernatePersistence'

          Caused by: java.lang.ClassCastException: class org.hibernate.ejb.HibernatePersistence"}}

      15:18:58,078 ERROR [org.jboss.as.server] (management task-6) WFLYSRV0021: Deploy of deployment "wildfly-hibernate3.war" was rolled back with the following failure message:

      {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"wildfly-hibernate3.war\".FIRST_MODULE_USE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"wildfly-hibernate3.war\".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment \"wildfly-hibernate3.war\"

          Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYJPA0019: Could not deploy application packaged persistence provider 'org.hibernate.ejb.HibernatePersistence'

          Caused by: java.lang.ClassCastException: class org.hibernate.ejb.HibernatePersistence"}}

      15:18:58,109 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) WFLYSRV0028: Stopped deployment wildfly-hibernate3.war (runtime-name: wildfly-hibernate3.war) in 31ms

      15:18:58,133 INFO  [org.jboss.as.controller] (management task-6) WFLYCTL0183: Service status report

      WFLYCTL0186:   Services which failed to start:      service jboss.deployment.unit."wildfly-hibernate3.war".FIRST_MODULE_USE

        • 1. Re: Hibernate 3 issue.
          ctomc

          Rajitha Gunawardhane wrote:

           

          When i try to deploy this in wildfly 10 i am getting this error.

           

          Source: https://github.com/sgilda/wildfly-quickstart/tree/master/hibernate3

           

          What could be the issue?

          you are using severely outdated quickstarts

           

          this are official quickstarts GitHub - wildfly/quickstart: Holds all versioned docs & samples

          and you will notice there is no hibernate3 there, for a good reason, as it doesn't work anymore.

          • 2. Re: Hibernate 3 issue.
            dvrajitha

            Hi Tomaz,

             

            Thank you for your quick reply. Does that mean Wildfly 10 is not supporting hibernate 3?

            • 3. Re: Hibernate 3 issue.
              dvrajitha

              Hi Tomaz,

               

              Could you share some more details about this matter.

               

              Can you give me few points relate to why hibernate 3.X is not supporting as i need to make a decision whether we need to upgrade hibernate version before we migrating to wildfly 10.

              I have seen that in the documentation it has mentioned that 3.X is not supporting. But i though by using old modules application could be migrated to Wildfly 10.

               

              Your feedback will be really helpful.

               

              Thank you.

              • 4. Re: Hibernate 3 issue.
                smarlow

                Hi,

                 

                The reason why we removed the Hibernate 3.x integration code is to reduce the number of versions of Hibernate that we integrate with to Hibernate ORM 4.x + 5.x.  From the JPA persistence, any persistence provider can be used however, application server integration code is required (whether the app server integration code is in the persistence provider or actually in the app server).

                 

                Could you please explain why you are still using Hibernate 3.x, rather than upgrading to 4.x/5.x?  Please also explain whether you are using the Hibernate (non-JPA) native API or using the JPA api.

                 

                Scott

                • 5. Re: Hibernate 3 issue.
                  dvrajitha

                  Hi Scott,

                   

                  Thank you for your reply. So it seems that we cant use Hibernate 3.X with Wildfly 10.

                  The only reason is that this is an old application. Anyway we are planning to upgrade hibernate version as well.

                  Also i need to clarify about persistence provider implementation. You meant that even though we can use different persistence providers, application server integration to that provider is anyway needed.

                   

                  Thank you.

                  • 6. Re: Hibernate 3 issue.
                    smarlow

                    Hi Rajitha,

                    Also i need to clarify about persistence provider implementation. You meant that even though we can use different persistence providers, application server integration to that provider is anyway needed. 

                    Yes, any older version of JPA 1.0+ persistence provider should be possible to use with WildFly, however, the persistence provider needs to know how to integrate with the WildFly application server or WildFly needs to know how to integrate with that version of the persistence provider.  In this case, we are discussing the WildFly integration code for Hibernate 3.x that we removed, to reduce the number of Hibernate versions that we integrate with. 

                     

                    Scott

                    • 7. Re: Hibernate 3 issue.
                      dvrajitha

                      Hi Scott,

                       

                      Now it is clear to me. Thank you for this nice explanation. So In this case our option is to upgrade Hibernate.

                       

                      Thank you,

                      Rajitha.

                      • 8. Re: Hibernate 3 issue.
                        virendra656

                        If you are using Wildfly 9 or less than you can do following steps to bundle hibernate 3.5.6 along with your application. Add all jars into lib folder of ear. Add jboss-deployment-structure.xml into ear Meta-Inf directory.

                         

                        persistent.xml => It's important to add HibernatePersistence provider and provider module as hibernate3-bundled.

                         

                         

                         

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

                            <persistence 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" version="1.0" >

                               <persistence-unit name='pursem'>

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

                               <jta-data-source>java:/com/env/jdbc/OracleDS</jta-data-source>

                               <properties>

                                  <property name="jboss.entity.manager.jndi.name" value="java:EntityManager/rsem"/>

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

                                  <property name="jboss.as.jpa.providerModule" value="hibernate3-bundled" />

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

                              </persistence-unit>

                              

                            </persistence>

                        jboss-deployment-structure.xml => Remove wildfly assembled hibernate

                         

                         

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

                            <jboss-deployment-structure>

                            <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

                            <deployment> 

                                <exclusions> 

                                  <module name="org.hibernate"/> 

                                </exclusions> 

                              </deployment>

                            </jboss-deployment-structure>