Hi Aslak
I now have Byteman injecting code in my Glassfish testclass thanks to your help - so thank you!
The addition of the <property name="autoInstallClientAgent">false</property>
in the arquillian.xml and the boot:<path to byteman.jar>
where the two important changes you made.
However, I still have one question - and this is not preventing us from using the byteman extension but is more about me understanding how Byteman maintains it's rules.
I have also pointed the attention of Andrew Dinn to this since it may be more related to Byteman than to the way in which the Arquillian-byteman extension uses Byteman.
The logs below is the result of running the test multiple times from eclipse against my local Glassfish server and to me it indicates that the FaultyInjectionRule is accumulating.
Each time I run the test, the rule is added to the ruleKeyMap in Rule ( as seen in http://grepcode.com/file/repository.jboss.org/nexus/content/repositories/releases/org.jboss.byteman/byteman/2.0.1/org/jboss/byteman/rule/Rule.java#Rule) but with a new key.
And each time I run the test, Byteman seems to transform the TestClass for each Rule loaded during the lifetime of the instantiated container.
However, Byteman only executes the latest rule during test so there is no problem per say, except that you could argue that the rule should not be applied so many times.
This seems to be due the installScript method in Retransformer line 114 (http://grepcode.com/file/repository.jboss.org/nexus/content/repositories/releases/org.jboss.byteman/byteman/2.0.1/org/jboss/byteman/agent/Retransformer.java?av=f)
where it get "too many" TestClasses that is going to be retransformed.
What is you take on this ?
[#|2012-11-29T09:44:27.778+0400|INFO|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=89;_ThreadName=Thread-3;|WEB0671: Loading application [8a21b4cc-7846-4f55-aeb5-6e0b5c6dfe46] at [/8a21b4cc-7846-4f55-aeb5-6e0b5c6dfe46]|#]
[#|2012-11-29T09:44:27.836+0400|INFO|glassfish3.1.2|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=89;_ThreadName=Thread-3;|8a21b4cc-7846-4f55-aeb5-6e0b5c6dfe46 was successfully deployed in 11,890 milliseconds.|#]
[#|2012-11-29T09:44:28.658+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|TransformListener() : handling connection on port 8888|#]
[#|2012-11-29T09:44:28.745+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|retransforming com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:28.745+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|retransforming com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:28.749+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|retransforming com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:28.750+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|retransforming com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:28.750+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|retransforming com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:28.750+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|retransforming com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:28.750+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|retransforming com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:28.759+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|org.jboss.byteman.agent.Transformer : possible trigger for rule FaultyInjectionRule in class com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:28.760+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|RuleTriggerMethodAdapter.injectTriggerPoint : inserting trigger into com.ejb.egs.TestClass.testMethod() void for rule FaultyInjectionRule|#]
[#|2012-11-29T09:44:28.760+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|org.jboss.byteman.agent.Transformer : inserted trigger for FaultyInjectionRule in class com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:28.780+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|org.jboss.byteman.agent.Transformer : possible trigger for rule FaultyInjectionRule in class com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:28.781+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|RuleTriggerMethodAdapter.injectTriggerPoint : inserting trigger into com.ejb.egs.TestClass.testMethod() void for rule FaultyInjectionRule|#]
[#|2012-11-29T09:44:28.781+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|org.jboss.byteman.agent.Transformer : inserted trigger for FaultyInjectionRule in class com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:28.782+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|org.jboss.byteman.agent.Transformer : possible trigger for rule FaultyInjectionRule in class com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:28.782+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|RuleTriggerMethodAdapter.injectTriggerPoint : inserting trigger into com.ejb.egs.TestClass.testMethod() void for rule FaultyInjectionRule|#]
[#|2012-11-29T09:44:28.783+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|org.jboss.byteman.agent.Transformer : inserted trigger for FaultyInjectionRule in class com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:28.797+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|org.jboss.byteman.agent.Transformer : possible trigger for rule FaultyInjectionRule in class com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:28.797+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|RuleTriggerMethodAdapter.injectTriggerPoint : inserting trigger into com.ejb.egs.TestClass.testMethod() void for rule FaultyInjectionRule|#]
[#|2012-11-29T09:44:28.798+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|org.jboss.byteman.agent.Transformer : inserted trigger for FaultyInjectionRule in class com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:28.798+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|org.jboss.byteman.agent.Transformer : possible trigger for rule FaultyInjectionRule in class com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:28.799+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|RuleTriggerMethodAdapter.injectTriggerPoint : inserting trigger into com.ejb.egs.TestClass.testMethod() void for rule FaultyInjectionRule|#]
[#|2012-11-29T09:44:28.799+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|org.jboss.byteman.agent.Transformer : inserted trigger for FaultyInjectionRule in class com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:28.800+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|org.jboss.byteman.agent.Transformer : possible trigger for rule FaultyInjectionRule in class com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:28.800+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|RuleTriggerMethodAdapter.injectTriggerPoint : inserting trigger into com.ejb.egs.TestClass.testMethod() void for rule FaultyInjectionRule|#]
[#|2012-11-29T09:44:28.801+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|org.jboss.byteman.agent.Transformer : inserted trigger for FaultyInjectionRule in class com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:28.802+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|org.jboss.byteman.agent.Transformer : possible trigger for rule FaultyInjectionRule in class com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:28.802+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|RuleTriggerMethodAdapter.injectTriggerPoint : inserting trigger into com.ejb.egs.TestClass.testMethod() void for rule FaultyInjectionRule|#]
[#|2012-11-29T09:44:28.803+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|org.jboss.byteman.agent.Transformer : inserted trigger for FaultyInjectionRule in class com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:29.859+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=41;_ThreadName=Thread-3;|Rule.execute called for FaultyInjectionRule_26|#]
[#|2012-11-29T09:44:29.863+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=41;_ThreadName=Thread-3;|HelperManager.install for helper class org.jboss.byteman.rule.helper.Helper|#]
[#|2012-11-29T09:44:29.864+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=41;_ThreadName=Thread-3;|calling activated() for helper class org.jboss.byteman.rule.helper.Helper|#]
[#|2012-11-29T09:44:29.864+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=41;_ThreadName=Thread-3;|Default helper activated|#]
[#|2012-11-29T09:44:29.864+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=41;_ThreadName=Thread-3;|calling installed(FaultyInjectionRule) for helper classorg.jboss.byteman.rule.helper.Helper|#]
[#|2012-11-29T09:44:29.865+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=41;_ThreadName=Thread-3;|Installed rule using default helper : FaultyInjectionRule|#]
[#|2012-11-29T09:44:29.865+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=41;_ThreadName=Thread-3;|FaultyInjectionRule execute|#]
[#|2012-11-29T09:44:29.865+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=41;_ThreadName=Thread-3;|Test impl|#]
[#|2012-11-29T09:44:29.866+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=41;_ThreadName=Thread-3;|caught ReturnException|#]
[#|2012-11-29T09:44:29.883+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|TransformListener() : handling connection on port 8888|#]
[#|2012-11-29T09:44:29.922+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|retransforming com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:29.923+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|retransforming com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:29.923+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|retransforming com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:29.923+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|retransforming com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:29.923+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|retransforming com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:29.923+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|retransforming com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:29.923+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|retransforming com.ejb.egs.TestClass|#]
[#|2012-11-29T09:44:30.998+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|HelperManager.uninstall for helper class org.jboss.byteman.rule.helper.Helper|#]
[#|2012-11-29T09:44:31.038+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|calling uninstalled(FaultyInjectionRule) for helper class org.jboss.byteman.rule.helper.Helper|#]
[#|2012-11-29T09:44:31.038+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|Uninstalled rule using default helper : FaultyInjectionRule|#]
[#|2012-11-29T09:44:31.039+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|calling deactivated() for helper classorg.jboss.byteman.rule.helper.Helper|#]
[#|2012-11-29T09:44:31.039+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=5;_ThreadName=Thread-3;|Default helper deactivated|#]
Regards Henrik