Uploaded image for project: 'Byteman'
  1. Byteman
  2. BYTEMAN-265

Invalid path to static field exception

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 2.1.4.1
    • None
    • None

      I have a test class which uses a static boolean

        public static boolean stopped = false;
      

      in order to trigger an action in a byteman RULE

      RULE stop method
      CLASS MyInstrumentedClass
      METHOD doOps
      AT ENTRY
      BIND stopped:boolean = StopTest.stopped
      IF stopped
      DO Thread.sleep(10000)
      ENDRULE
      

      It gives me an exception:

      byteman jar is /Users/aur/.m2/repository/org/jboss/byteman/byteman/2.1.4.1/byteman-2.1.4.1.jar
      objc[3434]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
      Rule.ensureTypeCheckedCompiled : error type checking rule stop method
      org.jboss.byteman.rule.exception.TypeException: FieldExpression.typeCheck : invalid path StopTest to static field stopped file /work/terracotta/qa/jira/byteman/my-app/target/test-classes/byteman/stop.btm line 5
      	at org.jboss.byteman.rule.expression.FieldExpression.checkIndirectStatic(FieldExpression.java:148)
      	at org.jboss.byteman.rule.expression.FieldExpression.typeCheck(FieldExpression.java:106)
      	at org.jboss.byteman.rule.binding.Binding.typeCheck(Binding.java:131)
      	at org.jboss.byteman.rule.Event.typeCheck(Event.java:114)
      	at org.jboss.byteman.rule.Event.typeCheck(Event.java:106)
      	at org.jboss.byteman.rule.Rule.typeCheck(Rule.java:521)
      	at org.jboss.byteman.rule.Rule.ensureTypeCheckedCompiled(Rule.java:449)
      	at org.jboss.byteman.rule.Rule.execute(Rule.java:672)
      	at org.jboss.byteman.rule.Rule.execute(Rule.java:653)
      	at com.mycompany.app.MyInstrumentedClass.doOps(MyInstrumentedClass.java)
      	at com.mycompany.app.StopTest.testStop(StopTest.java:24)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
      	at org.testng.internal.MethodInvocationHelper$1.runTestMethod(MethodInvocationHelper.java:200)
      	at org.jboss.byteman.contrib.bmunit.BMNGAbstractRunner.run(BMNGAbstractRunner.java:58)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:212)
      	at org.testng.internal.Invoker.invokeMethod(Invoker.java:707)
      	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
      	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
      	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
      	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
      	at org.testng.TestRunner.privateRun(TestRunner.java:767)
      	at org.testng.TestRunner.run(TestRunner.java:617)
      	at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
      	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:343)
      	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:305)
      	at org.testng.SuiteRunner.run(SuiteRunner.java:254)
      	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
      	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
      	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
      	at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
      	at org.testng.TestNG.run(TestNG.java:1057)
      	at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
      	at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
      	at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
      	at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:111)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
      

      Please find here a simple maven-based project that reproduces this problem:
      https://github.com/aurbroszniowski/byteman-exception.git

            rhn-engineering-adinn Andrew Dinn
            abroszni Aur Brsz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: