控制台报错:
C:\workspace\selfspace\src>btrace 9056 HelloBtrace.java
Exception in thread "main" java.lang.NullPointerException
at com.sun.btrace.client.Client.submit(Client.java:369)
at com.sun.btrace.client.Main.main(Main.java:201)
Exception in thread "Thread-0" java.lang.IllegalStateException
at com.sun.btrace.client.Client.send(Client.java:487)
at com.sun.btrace.client.Client.sendExit(Client.java:421)
at com.sun.btrace.client.Main$2.run(Main.java:235)
at java.lang.Thread.run(Thread.java:748)
IDEA报错:
btrace DEBUG: adding to boot classpath failed!
btrace DEBUG: java.io.FileNotFoundException: . (拒绝访问。)
java.io.FileNotFoundException: . (拒绝访问。)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:225)
at java.util.zip.ZipFile.<init>(ZipFile.java:155)
at java.util.jar.JarFile.<init>(JarFile.java:166)
at java.util.jar.JarFile.<init>(JarFile.java:130)
at com.sun.btrace.agent.Main.main(Main.java:129)
at com.sun.btrace.agent.Main.agentmain(Main.java:105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
at sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:411)
原因:项目中btrace的jar包版本和安装的btrace的jar包版本不一致
如果Java VisualVM安装BTrace Workbench不能使用,在jdk的安装目录lib文件夹下复制btrace/build的3个jar包