4 Replies Latest reply on Dec 28, 2015 12:17 PM by Anton Hughes

    Errors when migrating from jboss 7x to wildfly 9

    Anton Hughes Master

      Hello

       

      I am trying to upgrade our Errai app to run on Wildfly.

       

      I am getting hibernate errors, displayed below. Does anyone know how to fix this?

       

      appui-dev-local | 15:53:53,211 INFO  [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 72) HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL9Dialect

      appui-dev-local | 15:53:53,217 INFO  [org.hibernate.engine.jdbc.internal.LobCreatorBuilder] (ServerService Thread Pool -- 72) HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException

      appui-dev-local | 15:53:53,385 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 72) HHH000397: Using ASTQueryTranslatorFactory

      appui-dev-local | 15:53:53,385 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 73) HHH000397: Using ASTQueryTranslatorFactory

      appui-dev-local | 15:53:53,761 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 73) MSC000001: Failed to start service jboss.persistenceunit."app.ui.war#pu-magick2": org.jboss.msc.service.StartException in service jboss.persistenceunit."app.ui.war#pu-magick2": java.lang.NoClassDefFoundError: org/hibernate/service/classloading/spi/ClassLoaderService

      appui-dev-local | at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:172)

      appui-dev-local | at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117)

      appui-dev-local | at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:665)

      appui-dev-local | at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182)

      appui-dev-local | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

      appui-dev-local | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

      appui-dev-local | at java.lang.Thread.run(Thread.java:745)

      appui-dev-local | at org.jboss.threads.JBossThread.run(JBossThread.java:320)

      appui-dev-local | Caused by: java.lang.NoClassDefFoundError: org/hibernate/service/classloading/spi/ClassLoaderService

      appui-dev-local | at org.hibernate.envers.event.EnversIntegrator.integrate(EnversIntegrator.java:64)

      appui-dev-local | at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:312)

      appui-dev-local | at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1859)

      appui-dev-local | at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857)

      appui-dev-local | at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)

      appui-dev-local | at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425)

      appui-dev-local | at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849)

      appui-dev-local | at org.jboss.as.jpa.hibernate4.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44)

      appui-dev-local | at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:154)

      appui-dev-local | ... 7 more

       

      Persistence.xml

       

      <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_2_0.xsd"

                   version="2.0">

          <persistence-unit name="pu-magick" transaction-type="JTA">

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

              <jta-data-source>java:jboss/datasources/magick</jta-data-source>

              <class>com.my.models.shared.User</class>

              <class>com.my.models.shared.Broker</class>

              <class>com.my.models.shared.BrokerServer</class>

              <class>com.my.models.shared.TraderAccount</class>

              <class>com.my.models.shared.Strategy</class>

              <class>com.my.models.shared.Rule</class>

              <class>com.my.models.shared.DataFeed</class>

              <class>com.my.models.shared.TraderDataFeed</class>

              <class>com.my.models.shared.Symbol</class>

              <class>com.my.models.shared.Role</class>

              <class>com.my.models.shared.UserRequest</class>

       

       

              <properties>

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

                   <property name="org.hibernate.envers.auditTableSuffix" value="_versions" />

        <property name="org.hibernate.envers.revisionFieldName" value="_revision" />

        <property name="org.hibernate.envers.revisionTypeFieldName" value="_rev_type" />           

              </properties>

          </persistence-unit>

      </persistence>

        • 1. Re: Errors when migrating from jboss 7x to wildfly 9
          Jay SenSharma Master

          By any chance are you packaging any hibernate related JAR inside your app?

           

          The class which is causing [NoClassDefFoundError: org/hibernate/service/classloading/spi/ClassLoaderService]  is not available in WildFly.  So let us know if you are trying to use Hibernate 4.2 or lower version for your application?    

           

          Earlier in JBossAS7 you could find it inside the "$JBOSS_7_HOME/modules/system/layers/base/org/hibernate/main/hibernate-core-*.jar"

          • 2. Re: Errors when migrating from jboss 7x to wildfly 9
            Anton Hughes Master

            Hi Jay

             

            I am using the following relevant versions:

            <hibernate.version>4.3.10.Final</hibernate.version>

            <version.org.hibernate.validator>4.1.0.Final</version.org.hibernate.validator>

             

            And I have the following dependency:

                   <dependency>

                        <groupId>org.hibernate</groupId>

                        <artifactId>hibernate-core</artifactId>

                        <version>${hibernate.version}</version>

                    </dependency>

            • 3. Re: Errors when migrating from jboss 7x to wildfly 9
              Jay SenSharma Master

              What happens when you try using the hibernate version that is shipped by WildFly ?

               

              I mean can you try building your project using <scope>provided</scope>

               

              Example:

               

                     <dependency>

                          <groupId>org.hibernate</groupId>

                          <artifactId>hibernate-core</artifactId>

                          <version>${hibernate.version}</version>

                          <scope>provided</scope>

                      </dependency>

               

              Regards

              Jay SenSharma

              • 4. Re: Errors when migrating from jboss 7x to wildfly 9
                Anton Hughes Master

                Ok, I found the problem. While  I had updated the hibernate version in my errai app pom, there was another dependency that also used hibernate that wasnt updated.

                This is fixed, and the hibernate problem is solved.

                 

                Thanks