3 Replies Latest reply on Aug 12, 2014 11:27 AM by Bradley Snyder

    AS 7.1.1 -> WF 8.1 hibernate backward comp issue?

    Nicklas Karlsson Master

      Hi,

       

        More of a Hibernate question but I guess others might run into this also. I'm migrating an application from AS 7.1 to WF 8.1 and running into an issue with

       

      java.lang.ClassNotFoundException: org.hibernate.validator.resourceloading.ResourceBundleLocator

       

      According to Hibernate Validator Migration Guide

       

      • org.hibernate.validator.resourceloading.ResourceBundleLocator is deprecated and replaced by org.hibernate.validator.spi.resourceloading.ResourceBundleLocator

       

      but it looks more like it has been moved(?). How should this be handled if I'd like to deploy the app both in 7.1.1 and 8.1?

       

      Thanks in advance,

      Nik

        • 1. Re: AS 7.1.1 -> WF 8.1 hibernate backward comp issue?
          Scott Marlow Master

          Suddenly that macro processor in C/other languages doesn't seem so bad, when facing issues like this. 

           

          Can you show us the exception call stack?

          • 2. Re: AS 7.1.1 -> WF 8.1 hibernate backward comp issue?
            Nicklas Karlsson Master

            08:39:31,041 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.deployment.unit."OSTi-3.0.86-SNAPSHOT-KEH-OSTi.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."OSTi-3.0.86-SNAPSHOT-KEH-OSTi.war".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment "OSTi-3.0.86-SNAPSHOT-KEH-OSTi.war"

              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]

              at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]

            Caused by: java.lang.NoClassDefFoundError: org/hibernate/validator/resourceloading/ResourceBundleLocator

              at java.lang.Class.getDeclaredConstructors0(Native Method) [rt.jar:1.7.0_51]

              at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493) [rt.jar:1.7.0_51]

              at java.lang.Class.getConstructor0(Class.java:2803) [rt.jar:1.7.0_51]

              at java.lang.Class.newInstance(Class.java:345) [rt.jar:1.7.0_51]

              at org.hibernate.validator.internal.util.privilegedactions.NewInstance.run(NewInstance.java:48)

              at org.hibernate.validator.internal.util.ReflectionHelper.run(ReflectionHelper.java:674)

              at org.hibernate.validator.internal.util.ReflectionHelper.newInstance(ReflectionHelper.java:202)

              at org.hibernate.validator.internal.xml.ValidationBootstrapParameters.setMessageInterpolator(ValidationBootstrapParameters.java:163)

              at org.hibernate.validator.internal.xml.ValidationBootstrapParameters.<init>(ValidationBootstrapParameters.java:64)

              at org.hibernate.validator.internal.engine.ConfigurationImpl.parseValidationXml(ConfigurationImpl.java:361)

              at org.hibernate.validator.internal.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:214)

              at org.hibernate.validator.internal.cdi.ValidationExtension.<init>(ValidationExtension.java:124)

              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_51]

              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0_51]

              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_51]

              at java.lang.reflect.Constructor.newInstance(Constructor.java:526) [rt.jar:1.7.0_51]

              at java.lang.Class.newInstance(Class.java:374) [rt.jar:1.7.0_51]

              at org.jboss.as.weld.deployment.WeldPortableExtensions.tryRegisterExtension(WeldPortableExtensions.java:54)

              at org.jboss.as.weld.deployment.processors.WeldPortableExtensionProcessor.loadAttachments(WeldPortableExtensionProcessor.java:121)

              at org.jboss.as.weld.deployment.processors.WeldPortableExtensionProcessor.deploy(WeldPortableExtensionProcessor.java:81)

              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]

              ... 5 more

            Caused by: java.lang.ClassNotFoundException: org.hibernate.validator.resourceloading.ResourceBundleLocator from [Module "deployment.OSTi-3.0.86-SNAPSHOT-KEH-OSTi.war:main" from Service Module Loader]

              at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final]

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]

              at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]

              at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]

              ... 26 more

             

             

            08:39:31,049 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 1) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "OSTi-3.0.86-SNAPSHOT-KEH-OSTi.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"OSTi-3.0.86-SNAPSHOT-KEH-OSTi.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"OSTi-3.0.86-SNAPSHOT-KEH-OSTi.war\".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment \"OSTi-3.0.86-SNAPSHOT-KEH-OSTi.war\"

                Caused by: java.lang.NoClassDefFoundError: org/hibernate/validator/resourceloading/ResourceBundleLocator

                Caused by: java.lang.ClassNotFoundException: org.hibernate.validator.resourceloading.ResourceBundleLocator from [Module \"deployment.OSTi-3.0.86-SNAPSHOT-KEH-OSTi.war:main\" from Service Module Loader]"}}

            08:39:31,052 ERROR [org.jboss.as.server] (management-handler-thread - 1) JBAS015870: Deploy of deployment "OSTi-3.0.86-SNAPSHOT-KEH-OSTi.war" was rolled back with the following failure message:

            {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"OSTi-3.0.86-SNAPSHOT-KEH-OSTi.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"OSTi-3.0.86-SNAPSHOT-KEH-OSTi.war\".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment \"OSTi-3.0.86-SNAPSHOT-KEH-OSTi.war\"

                Caused by: java.lang.NoClassDefFoundError: org/hibernate/validator/resourceloading/ResourceBundleLocator

                Caused by: java.lang.ClassNotFoundException: org.hibernate.validator.resourceloading.ResourceBundleLocator from [Module \"deployment.OSTi-3.0.86-SNAPSHOT-KEH-OSTi.war:main\" from Service Module Loader]"}}

            Thanks for the reply.

             

            The point of usage is a custom (DB backed) resource bundle for Bean Validation. I'm a bit surprised at this since Hibernate is usually quite good in backward compatibility/deprecation

            • 3. Re: AS 7.1.1 -> WF 8.1 hibernate backward comp issue?
              Bradley Snyder Newbie

              [HV-561] Determine and mark the API to be deprecated for HV5 - Hibernate JIRA indicates that the class package name was changed in 4.3.0. You are looking at the initial entry of your issue in the Hibernate Validator Migration guide, but what you really want to look at is under 5.0.0.Alpha1: "The deprecated classes and methods from HV-561 have been removed. This means if you are using any of the affected APIs you will need to migrate." So you WON'T be able to deploy the same package as is in both 7.1.1 and 8.1.

               

              My recommendation if you are unable to fully embrace Wildfly and Java EE 7 is to use Maven profiles. One profile would define dependencies for Wildfly using the Wildfly BOMs and provided scope. This would be your default profile that executes on the Wildfly server with the libraries provided in the Wildfly modules folder. The second profile would define dependencies for JBoss AS7, but would then define the new Hibernate dependencies under compile scope as part of your WAR/EAR. That way you can run on AS7 without changing your code, and your code is oriented towards the newer version (since I have to assume at some point you will drop AS7).

               

              It will be impossible for the same WAR/EAR to run on both servers in this case.