1 Reply Latest reply on Aug 11, 2015 4:52 AM by adinn

    Helper class issue on server startup

    rachmato

      I have a byteman script which I want to run from startup in an application server. This byteman script makes use of a HelperClass.

      I have modified the server startup to specify the javaagent as follows:

      -Dorg.jboss.byteman.transform.all -javaagent:/opt/byteman-3.0.1/lib/byteman.jar=script:/home/nrla/java/byteman/jboss-ejb-client/jboss-ejb-client.btm,boot:/opt/byteman-3.0.1/lib/byteman.jar,boot:/home/nrla/ideaProjects/byteman-helper/target/EJBClientHelper-1.0-SNAPSHOT.jar,listener:true

      As far as I can tell, this is a fairly conventional approach to loading a helper class at startup. Note that I have put the helper in the org.jboss.byteman package.

      When the server starts, however, I see this:

      16:24:10,005 INFO  [stdout] (ServerService Thread Pool -- 31) Rule.execute called for ConfigBasedEJBClientContextSelector_init_7

      16:24:10,014 INFO  [stdout] (ServerService Thread Pool -- 31) Rule.ensureTypeCheckedCompiled : error compiling rule ConfigBasedEJBClientContextSelector_init

      16:24:10,015 INFO  [stdout] (ServerService Thread Pool -- 31) org.jboss.byteman.rule.exception.CompileException: Compiler.createHelperAdapter : exception creating interpreted helper adapter for org.jboss.byteman.EJBClientHelper

      16:24:10,015 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.byteman.rule.compiler.Compiler.getHelperAdapter(Compiler.java:78)

      16:24:10,015 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.byteman.rule.Rule.compile(Rule.java:545)

      16:24:10,015 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.byteman.rule.Rule.ensureTypeCheckedCompiled(Rule.java:450)

      16:24:10,015 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.byteman.rule.Rule.execute(Rule.java:672)

      16:24:10,016 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.byteman.rule.Rule.execute(Rule.java:653)

      16:24:10,016 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.<init>(ConfigBasedEJBClientContextSelector.java:53)

      16:24:10,016 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.<init>(ConfigBasedEJBClientContextSelector.java:71)

      16:24:10,016 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.ejb.client.EJBClientContext.<clinit>(EJBClientContext.java:78)

      16:24:10,016 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.as.ejb3.remote.DefaultEjbClientContextService$SetSelectorAction.run(DefaultEjbClientContextService.java:144)

      16:24:10,017 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.as.ejb3.remote.DefaultEjbClientContextService$SetSelectorAction.run(DefaultEjbClientContextService.java:134)

      16:24:10,017 INFO  [stdout] (ServerService Thread Pool -- 31) at java.security.AccessController.doPrivileged(Native Method)

      16:24:10,017 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.as.ejb3.remote.DefaultEjbClientContextService.<clinit>(DefaultEjbClientContextService.java:68)

      16:24:10,017 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.as.ejb3.subsystem.EJB3SubsystemAdd.addRemoteInvocationServices(EJB3SubsystemAdd.java:392)

      16:24:10,017 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.as.ejb3.subsystem.EJB3SubsystemAdd.performBoottime(EJB3SubsystemAdd.java:344)

      16:24:10,018 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.as.controller.AbstractBoottimeAddStepHandler.performRuntime(AbstractBoottimeAddStepHandler.java:69)

      16:24:10,018 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.as.controller.AbstractAddStepHandler$1.execute(AbstractAddStepHandler.java:75)

      16:24:10,018 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:591)

      16:24:10,018 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:469)

      16:24:10,018 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.as.controller.AbstractOperationContext.completeStepInternal(AbstractOperationContext.java:273)

      16:24:10,019 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:268)

      16:24:10,019 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.as.controller.ParallelBootOperationStepHandler$ParallelBootTask.run(ParallelBootOperationStepHandler.java:343)

      16:24:10,019 INFO  [stdout] (ServerService Thread Pool -- 31) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

      16:24:10,019 INFO  [stdout] (ServerService Thread Pool -- 31) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

      16:24:10,020 INFO  [stdout] (ServerService Thread Pool -- 31) at java.lang.Thread.run(Thread.java:744)

      16:24:10,020 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.threads.JBossThread.run(JBossThread.java:122)

      16:24:10,020 INFO  [stdout] (ServerService Thread Pool -- 31) Caused by: java.lang.IllegalAccessError: class org.jboss.byteman.EJBClientHelper_HelperAdapter_Interpreted_1 cannot access its superclass org.jboss.byteman.EJBClientHelper

      16:24:10,020 INFO  [stdout] (ServerService Thread Pool -- 31) at java.lang.ClassLoader.defineClass1(Native Method)

      16:24:10,020 INFO  [stdout] (ServerService Thread Pool -- 31) at java.lang.ClassLoader.defineClass(ClassLoader.java:800)

      16:24:10,021 INFO  [stdout] (ServerService Thread Pool -- 31) at java.lang.ClassLoader.defineClass(ClassLoader.java:643)

      16:24:10,021 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.byteman.rule.compiler.Compiler$ClassbyteClassLoader.addClass(Compiler.java:530)

      16:24:10,021 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.byteman.rule.compiler.Compiler.loadHelperAdapter(Compiler.java:555)

      16:24:10,021 INFO  [stdout] (ServerService Thread Pool -- 31) at org.jboss.byteman.rule.compiler.Compiler.getHelperAdapter(Compiler.java:71)

      16:24:10,021 INFO  [stdout] (ServerService Thread Pool -- 31) ... 24 more

      16:24:10,022 INFO  [stdout] (ServerService Thread Pool -- 31)

      I have tried loading this helper jar via boot: as well as sys: and I get the same error.

      From looking at blog examples, I know this should not be happening.

      Any ideas?

       

      BTW, I did have this same problem on the client side, when configuring the javaagent for the client and trying tp specify the helper there, and it "disappeared" when I added the helper jar to the application client startup classpath (via a maven depenedency).

       

      Richard

        • 1. Re: Helper class issue on server startup
          adinn

          Hi Richard,

           

          I think the problem here is that you have not added policy:true to the -javaagent arguments list. This option must be provided to ensure that Byteman retains its ALLPERMISSIONS security clearance when running with recent versions of the JBoss App Server which employ a security manager. It requests the agent to install an ALLPERMISSIONS security policy for its own protection domain. I thought I had added details of this option to the user guide but it seems that I failed to do so. I have raised [BYTEMAN-295] Document missing security policy option needed by JBoss AS and other secure apps - JBoss Issue Tracker to cover this omission.

           

          n.b. there is an equivalent option to the bminstall script which has the same effect (pass -s on the command line). This option is documented in the header of the bminstall script and in the javadoc for class Install. It probably ought also to be mentioned in the user guide as well.