Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in thread "main" java.lang.NullPointerException #561

Closed
sigezhao opened this issue Jul 6, 2022 · 2 comments
Closed

Exception in thread "main" java.lang.NullPointerException #561

sigezhao opened this issue Jul 6, 2022 · 2 comments

Comments

@sigezhao
Copy link

sigezhao commented Jul 6, 2022

I run btrace in k8s pod and met the following error:
./btrace -u 9 ../samples/AllCalls1.java (9 is target process's pid, AllCalls1.java is source file name)
btrace INFO: Attaching BTrace to PID: 9
Exception in thread "main" java.lang.NullPointerException
at org.openjdk.btrace.compiler.Compiler.(Compiler.java:66)
at org.openjdk.btrace.compiler.Compiler.(Compiler.java:71)
at org.openjdk.btrace.client.Client.compile(Client.java:208)
at org.openjdk.btrace.client.Client.compile(Client.java:193)
at org.openjdk.btrace.client.Main.main(Main.java:239)

I've search similar issue in the issues search box,but it didn't fix my problem;Can you help me out?

Enviroment information:

Java version:

java -version
openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2~bpo8+1-b14)
OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode)

brace version:

./btrace --version
BTrace v.2.2.2 (c8f81cc)

scritp content

cat ../samples/AllCalls1.java
....
@btrace
public class AllCalls1 {
@OnMethod(clazz = "demo.tcloud.triblewood.qcbm.favorites.service.FavoriteServiceImpl", method = "/./",
location = @location(value = Kind.CALL, clazz = "/.
/", method = "/.*/"))
public static void m(@self Object self, @TargetMethodOrField String method, @ProbeMethodName String probeMethod) { // all calls to the methods with signature "()"
println(method + " in " + probeMethod);
}
}

target method file

https://github.com/TencentCloud/container-demo/blob/main/qcbm/qcbm-backend/favorites-service/src/main/java/demo/tcloud/triblewood/qcbm/favorites/service/FavoriteServiceImpl.java

tools.jar

tools.jar is from:https://github.com/Tencent/TencentKona-8/releases/download/8.0.10-GA/TencentKona8.0.10.b1_jdk_linux-x86_64_8u332.tar.gz

@jbachorik
Copy link
Collaborator

It is indeed the tools.jar related issue. Are you sure you put the jar in the correct place? The required location is $JAVA_HOME/lib/tools.jar.

If the things are not working even after the jar file is in the correct place you could compile the script on a machine with full JDK with btracec command and then use the compiled version in btrace ... command.

@github-actions
Copy link

github-actions bot commented Sep 8, 2022

Stale issue message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants