4 Replies Latest reply on Sep 4, 2012 9:37 AM by Scott Marlow

    AS7-4857 correct JPA dependency injection (stop injecting javassist a…  …nd let Hibernate include envers)

    Frank Langelage Master

      A question regarding the changes by https://issues.jboss.org/browse/AS7-4857.

      After this, I have to include org.javassist into the dependencies of my ear.

      Otherwise I get lots of CNFE of org.javassist.*.

       

      I don't understand the background.

      Hibernate / JPA seems to need javassist. I did not mention it anywhere in my project.

      Why was it removed from the automatically added dependencies then.

      Or this there an option to avoid the use of javassist? If yes, what are the pros and cons?

        • 1. Re: AS7-4857 correct JPA dependency injection (stop injecting javassist a…  …nd let Hibernate include envers)
          Tomaz Cerar Master

          Hi,

           

          if you application needs javaassit then just include it yourself.

           

          as for JPA and javaassit goes, it is bit more complex than just that.

           

          jpa has dependancy to hibernate and hibernate has dependancy to javassist.

           

          jpa --> hibernate --> javassist

           

          and given that your application uses jpa, there is no need to directly include all transient depenencies.

           

          if you application still needs javaassit but you do not explecitly use it anywhere it might be interesting case to looke more into detail.

          Can you provide structure of your application (jar tf <name of ear>) and stacktrace you get. that will help find the couse of the issue.

           

          --

          tomaz

          • 3. Re: AS7-4857 correct JPA dependency injection (stop injecting javassist a…  …nd let Hibernate include envers)
            Frank Langelage Master

            Attached you find the complete serverlog of the redeployment of my ear without the javassist dependency.

            The stacktrace for the first Entity deployed:

            11:26:22,409 ERROR [org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer#getProxyFactory] HHH000142: Javassist Enhancement failed: biz.mbisoftware.fn.ejb.entity.MbiAsyst: java.lang.RuntimeException: by java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject

                at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:510)

                at javassist.util.proxy.ProxyFactory.createClass2(ProxyFactory.java:487)

                at javassist.util.proxy.ProxyFactory.createClass1(ProxyFactory.java:423)

                at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:395)

                at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxyFactory(JavassistLazyInitializer.java:163) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

                at org.hibernate.proxy.pojo.javassist.JavassistProxyFactory.postInstantiate(JavassistProxyFactory.java:66) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

                at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:221) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

                at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:212) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

                at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:82) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

                at sun.reflect.GeneratedConstructorAccessor110.newInstance(Unknown Source) [:1.6.0_35]

                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [rt.jar:1.6.0_35]

                at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [rt.jar:1.6.0_35]

                at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:135) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

                at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:188) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

                at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:341) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

                at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:505) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

                at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:146) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

                at sun.reflect.GeneratedConstructorAccessor109.newInstance(Unknown Source) [:1.6.0_35]

                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [rt.jar:1.6.0_35]

                at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [rt.jar:1.6.0_35]

                at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:163) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

                at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:135) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

                at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:381) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

                at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1746) [hibernate-core-4.1.6.Final.jar:4.1.6.Final]

                at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94) [hibernate-entitymanager-4.1.6.Final.jar:4.1.6.Final]

                at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905) [hibernate-entitymanager-4.1.6.Final.jar:4.1.6.Final]

                at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890) [hibernate-entitymanager-4.1.6.Final.jar:4.1.6.Final]

                at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) [hibernate-entitymanager-4.1.6.Final.jar:4.1.6.Final]

                at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:197) [jboss-as-jpa-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]

                at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$500(PersistenceUnitServiceImpl.java:57) [jboss-as-jpa-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]

                at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:96) [jboss-as-jpa-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]

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

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

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

                at org.jboss.threads.JBossThread.run(JBossThread.java:122)

            Caused by: javassist.CannotCompileException: by java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject

                at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:170)

                at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:502)

                ... 34 more

            Caused by: java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject

                at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_35]

                at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [rt.jar:1.6.0_35]

                at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [rt.jar:1.6.0_35]

                at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source) [:1.6.0_35]

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_35]

                at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_35]

                at javassist.util.proxy.FactoryHelper.toClass2(FactoryHelper.java:182)

                at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:164)

                ... 35 more

             

            As said, I do not use javassist in my application. It's nowhere mentioned in my source and build files.

            I might need it indirectly, because I'm using drools in my application.

            jar -tvf $BIN/*.ear

                 0 Sun Sep 02 11:16:14 CEST 2012 META-INF/

               174 Sun Sep 02 11:16:12 CEST 2012 META-INF/MANIFEST.MF

              2634 Mon May 07 18:34:36 CEST 2012 META-INF/application.xml

            924165 Sun Sep 02 11:16:10 CEST 2012 ejb-entity.jar

            61800 Sun Sep 02 11:16:10 CEST 2012 ejb-session-common.jar

            149853 Sun Sep 02 11:16:10 CEST 2012 ejb-session-core.jar

            15499 Sun Sep 02 11:16:10 CEST 2012 ejb-session-costing.jar

            31943 Sun Sep 02 11:16:10 CEST 2012 ejb-session-distribution.jar

            20667 Sun Sep 02 11:16:10 CEST 2012 ejb-session-inventory.jar

            20973 Sun Sep 02 11:16:10 CEST 2012 ejb-session-param.jar

            98661 Sun Sep 02 11:16:10 CEST 2012 ejb-session-planning.jar

            29973 Sun Sep 02 11:16:10 CEST 2012 ejb-session-production.jar

            15897 Sun Sep 02 11:16:10 CEST 2012 ejb-session-purchase.jar

            304208 Sun Sep 02 11:16:12 CEST 2012 ejb-session-sales.jar

              9274 Sun Sep 02 11:16:12 CEST 2012 ws-common.war

            39903 Sun Sep 02 11:16:12 CEST 2012 ws-core.war

              5514 Sun Sep 02 11:16:12 CEST 2012 ws-costing.war

              5130 Sun Sep 02 11:16:12 CEST 2012 ws-distribution.war

               671 Sun Sep 02 11:16:12 CEST 2012 ws-external.war

              5859 Sun Sep 02 11:16:12 CEST 2012 ws-inventory.war

            12585 Sun Sep 02 11:16:12 CEST 2012 ws-planning.war

            16421 Sun Sep 02 11:16:12 CEST 2012 ws-production.war

              9608 Sun Sep 02 11:16:12 CEST 2012 ws-purchase.war

            15157 Sun Sep 02 11:16:12 CEST 2012 ws-sales.war

              3074 Sun Sep 02 11:16:12 CEST 2012 web.war

                 0 Sun Sep 02 11:16:14 CEST 2012 lib/

            163650 Sun Sep 02 11:16:14 CEST 2012 lib/antlr-runtime.jar

            162079 Sun Sep 02 11:16:14 CEST 2012 lib/bltypes.jar

            89635 Sun Sep 02 11:16:14 CEST 2012 lib/common.jar

            1285617 Sun Sep 02 11:16:14 CEST 2012 lib/commons-math3.jar

            1128541 Sun Sep 02 11:16:14 CEST 2012 lib/drools-compiler.jar

            2842962 Sun Sep 02 11:16:14 CEST 2012 lib/drools-core.jar

            57611 Sun Sep 02 11:16:14 CEST 2012 lib/drools-decisiontables.jar

            54925 Sun Sep 02 11:16:14 CEST 2012 lib/drools-templates.jar

            1674737 Sun Sep 02 11:16:14 CEST 2012 lib/ecj.jar

            60197 Sun Sep 02 11:16:14 CEST 2012 lib/flattree-0.5.jar

              7040 Sun Sep 02 11:16:14 CEST 2012 lib/furnplan.jar

            288098 Sun Sep 02 11:16:14 CEST 2012 lib/htmlparser.jar

            11039 Sun Sep 02 11:16:14 CEST 2012 lib/imos-net.jar

            86149 Sun Sep 02 11:16:14 CEST 2012 lib/interfaces.jar

            65507 Sun Sep 02 11:16:14 CEST 2012 lib/javatuples.jar

            725735 Sun Sep 02 11:16:14 CEST 2012 lib/jxl.jar

            181418 Sun Sep 02 11:16:14 CEST 2012 lib/knowledge-api.jar

              8814 Sun Sep 02 11:16:14 CEST 2012 lib/knowledge-internal-api.jar

            741061 Sun Sep 02 11:16:14 CEST 2012 lib/mvel2.jar

            14146 Sun Sep 02 11:16:14 CEST 2012 lib/opencsv.jar

            136689 Sun Sep 02 11:16:14 CEST 2012 lib/twt-design.jar

            937265 Sun Sep 02 11:16:14 CEST 2012 lib/twt-insight.jar

            68593 Sun Sep 02 11:16:14 CEST 2012 lib/wsclient.jar

            184018 Sun Sep 02 11:16:14 CEST 2012 lib/wstypes.jar

              1103 Thu Feb 16 17:10:56 CET 2012 mbi_deploy.xml

            • 4. Re: AS7-4857 correct JPA dependency injection (stop injecting javassist a…  …nd let Hibernate include envers)
              Scott Marlow Master

              Thanks for finding this Frank.  It sounds like our testsuite needs a few more tests to ensure this doesn't happen again.  We will fix this.