7 Replies Latest reply on Feb 22, 2010 6:36 AM by Andrew Dinn

    Byteman 1.0.3.CP01 does not play nice with Weblogic 10, and in particular cglib

    John Backstrand Newbie

      As soon as I enable the byteman agent I see lots of these stacktraces:

       

      javax.ejb.EJBException: EJB Exception: : java.lang.NoClassDefFoundError: net/sf/cglib/proxy/Enhancer

      at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:117)

      at org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:43)

      at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:162)

      at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)

      at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)

      at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)

      at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:302)

      at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)

      at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)

      at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)

      at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)

      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)

      at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)

      at iipax.generic.hibernate.SessionFactoryHelper.instantiate(SessionFactoryHelper.java:163)

      ...

       

      I have to use JDK 1.5, thence the older byteman version. I tried patching the source according to Byteman-59, but that did not seem to help, and it also seems unrelated. Any ideas why this happens?

        • 1. Re: Byteman 1.0.3.CP01 does not play nice with Weblogic 10, and in particular cglib
          Andrew Dinn Master

          Hi John,

           

          Thanks for trying Byteman and for posting a report when it didn't do whhat you wanted.

          sopues wrote:

           

          As soon as I enable the byteman agent I see lots of these stacktraces:

           

          javax.ejb.EJBException: EJB Exception: : java.lang.NoClassDefFoundError: net/sf/cglib/proxy/Enhancer

          at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:117)

          at org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:43)

          at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:162)

          at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)

          at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)

          at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)

          at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:302)

          at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)

          at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)

          at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)

          at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)

          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)

          at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)

          at iipax.generic.hibernate.SessionFactoryHelper.instantiate(SessionFactoryHelper.java:163)

          ...

           

          I have to use JDK 1.5, thence the older byteman version. I tried patching the source according to Byteman-59, but that did not seem to help, and it also seems unrelated. Any ideas why this happens?

           

          I am not sure this error is actually to do with BYTEMAN-59. It may possibly relate to some other problem. Can you provide me with the command line you are usng to run your code? Also, any rule set you have employed (I understand that this may have occured before any rule injection has taken place).

           

          Another thing you might try is adding -Dorg.jboss.byteman.verbose to the java command line, just in case there is some useful trace printed by the Byteman agent. I'dbe inetersted to see exactly what it prints.

           

          I am sorry you cannot use the later 1.6 based releases. I would like to be able to continue providing a 1.5 compatible Byteman but the differences in the instrumentation class API between 1.5 and 1.6 are critical to implemening a fully functional tool. Consequently, the 1.5 compatible code has been downgraded to patch-only (CP is a cumulative patch release). If this is a bug which I can pin down and fix in 1.0.3.CP01 I will try to accommodate you by adding it into a subsequent 1.0.3.CP02 release.

          1 of 1 people found this helpful
          • 2. Re: Byteman 1.0.3.CP01 does not play nice with Weblogic 10, and in particular cglib
            John Backstrand Newbie

            I found out that the problem was (likely) with ASM classes not being obfuscated, even though objectweb was not visible in my stacktraces. I tried first disabling the transform-method in the ClassTransformer, that did not help. Then I tried not even adding the ClassTransformer which also didn't help so I realized it must be the classpath. I changed the build.xml to use jarjar and now it seems to work fine (even though my rule has a type-error in it):

             

            <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="lib/jarjar.jar"/>

             

            <jarjar jarfile="${build.lib.dir}/byteman.jar" manifest="${dd.dir}/META-INF/MANIFEST.MF">

                         <fileset dir="${build.classes.dir}" includes="**/*"/>

                 <rule pattern="org.objectweb.**" result="_org.objectweb.@1"/>

                 <rule pattern="java_cup.**" result="_java_cup.@1"/>

            </jarjar>

            • 3. Re: Byteman 1.0.3.CP01 does not play nice with Weblogic 10, and in particular cglib
              Andrew Dinn Master

              sopues wrote:

               

              I found out that the problem was (likely) with ASM classes not being obfuscated, even though objectweb was not visible in my stacktraces. I tried first disabling the transform-method in the ClassTransformer, that did not help. Then I tried not even adding the ClassTransformer which also didn't help so I realized it must be the classpath. I changed the build.xml to use jarjar and now it seems to work fine (even though my rule has a type-error in it):

               

              <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="lib/jarjar.jar"/>

               

              <jarjar jarfile="${build.lib.dir}/byteman.jar" manifest="${dd.dir}/META-INF/MANIFEST.MF">

                           <fileset dir="${build.classes.dir}" includes="**/*"/>

                   <rule pattern="org.objectweb.**" result="_org.objectweb.@1"/>

                   <rule pattern="java_cup.**" result="_java_cup.@1"/>

              </jarjar>

               

              Ok, that's great, as it means I already have a JIRA issue for this one. I guess it  needs promoting up the list of priorities! I'll build a jarjar treated byteman.jar for a 1.0..3.CP02 release at the same time as I fix this issue in the forthcoming  1.2.2 release (should be out in a week or two). Thanks very much for reporting this and for identifying the fix. I hope you enjoy playing with Byteman. Can you tell me what you are trying to use it for and whetehr it does what you need. Also, please let me know if you have any other problems using it.

               

              regards,

               

               

              Andrew Dinn

              • 4. Re: Byteman 1.0.3.CP01 does not play nice with Weblogic 10, and in particular cglib
                John Backstrand Newbie

                I am using this to simply emulate a "network outage" that a customer saw, making the database-connection unavailable. This in itself is not bad, but apparently some of our customer-specific extension code does not handle this very well, whereas our main product underneath does. I could read the code, try to understand every possible runtime-exception that could be thrown or I could use fault injection and emulate whatever problem happens at our customers, and see what happens, and testing any bugfixes this way. I also plan on building a small "library" of common faults to make testing customer code easier, which I realize could have come in handy many times before, and likely will in the future.

                 

                What I am missing most is a way to update rules dynamically somehow, since restarting the appserver takes some time.

                • 5. Re: Byteman 1.0.3.CP01 does not play nice with Weblogic 10, and in particular cglib
                  Andrew Dinn Master

                  sopues wrote:

                   

                  I am using this to simply emulate a "network outage" that a customer saw, making the database-connection unavailable. This in itself is not bad, but apparently some of our customer-specific extension code does not handle this very well, whereas our main product underneath does. I could read the code, try to understand every possible runtime-exception that could be thrown or I could use fault injection and emulate whatever problem happens at our customers, and see what happens, and testing any bugfixes this way. I also plan on building a small "library" of common faults to make testing customer code easier, which I realize could have come in handy many times before, and likely will in the future.

                   

                  What I am missing most is a way to update rules dynamically somehow, since restarting the appserver takes some time.

                   

                  Thanks for the info. That's just the sort of thing Byteman was aimed at. I'm very interested to hear how well it answers your needs and, where possible, extend it to meet any new requirements you identify.

                   

                  It's a shame you have to run on JDK5 as the dynamic rule upload capablity in the later releases sounds like it would be a big help. Are you able to tell me why running on JDK6 not an option?

                  • 6. Re: Byteman 1.0.3.CP01 does not play nice with Weblogic 10, and in particular cglib
                    John Backstrand Newbie

                    adinn wrote:

                     

                    sopues wrote:

                     

                    I am using this to simply emulate a "network outage" that a customer saw, making the database-connection unavailable. This in itself is not bad, but apparently some of our customer-specific extension code does not handle this very well, whereas our main product underneath does. I could read the code, try to understand every possible runtime-exception that could be thrown or I could use fault injection and emulate whatever problem happens at our customers, and see what happens, and testing any bugfixes this way. I also plan on building a small "library" of common faults to make testing customer code easier, which I realize could have come in handy many times before, and likely will in the future.

                     

                    What I am missing most is a way to update rules dynamically somehow, since restarting the appserver takes some time.

                     

                    Thanks for the info. That's just the sort of thing Byteman was aimed at. I'm very interested to hear how well it answers your needs and, where possible, extend it to meet any new requirements you identify.

                     

                    It's a shame you have to run on JDK5 as the dynamic rule upload capablity in the later releases sounds like it would be a big help. Are you able to tell me why running on JDK6 not an option?

                     

                    This is basically tied to the weblogic version in use, and this particular one bundles JRockit and a Sun JDK, both 1.5. Switching to something newer is a bit late since this went into production mode a week ago. Sadly I don't think any of our supported bundled app-servers run on 1.6, even though we require that for our webstart clients. We very recently moved away from java 1.4 actually.

                    • 7. Re: Byteman 1.0.3.CP01 does not play nice with Weblogic 10, and in particular cglib
                      Andrew Dinn Master

                      John,

                       

                      You may want to pull down the 1.0.1.CP02 release from the releases page. It uses jarjar to wrap the ObjectWeb and JavaCup class names into the byteman package and also inlcudes a few other bug fixes.

                       

                      regards,

                       

                       

                      Andrew Dinn