三步解锁网络控制权:中兴光猫配置解密工具终极指南
2026/4/30 18:42:24
curl-Ohttps://arthas.aliyun.com/arthas-boot.jar你刚才只是ls和pwd,
还没有真正 attach JVM。
java-jararthas-boot.jar类似这样 👇
Found existing java process, please choose one and hit RETURN. * [1]: 23145 demo20250304-0.0.1-SNAPSHOT.jar看清楚是你这个 jar:
demo20250304-0.0.1-SNAPSHOT.jar输入前面的数字,比如:
1然后回车
Welcome to Arthas!并且命令行前缀会变成:
[arthas@23145]$到这一步,你已经成功 attach 正在运行的 JVM
后面所有操作,都是不重启、直接改内存
在 Arthas 控制台里,输入👇:
sc *BookController*com.example.demo.controller.BookController👉把这个完整包名记住
假设是:
com.example.demo.controller.BookControllersc-dcom.example.demo.controller.BookController你主要看两点:
classLoaderHashlocation(一般是 BOOT-INF/classes)只要能正常显示,就可以 redefine
⚠️ 注意:
这条命令里的路径,是 Linux 绝对路径
你的 class 在:
/root/1230/BookController.classredefine /root/1230/BookController.classredefine success, size: 1🎉恭喜你,此时:
curlhttp://localhost:8080/你BookController的接口如果你在新代码里加了类似:
log.info("=== arthas hotfix ===");那你现在一请求接口,就应该能看到。
VerifyError👉 你改了方法签名 / 字段 / 注解
Unsupported major.minor👉 class 编译 JDK 和线上不一致
👉 说明这个 Controller 还没被加载(极少)
Arthas 热修 = 临时止血
一定要记得:后续正常打包 + 重启发布
否则:
[root@VM-12-7-centos1230]# java -jar arthas-boot.jar[INFO]JAVA_HOME: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.412.b08-1.el7_9.x86_64/jre[INFO]arthas-boot version:4.1.4[INFO]Found existingjavaprocess, please choose one and input the serial number of the process, eg:1. Then hit ENTER. *[1]:20038demo20250304-0.0.1-SNAPSHOT.jar1[INFO]arthas home: /root/.arthas/lib/4.1.4/arthas[INFO]Try to attach process20038Picked up JAVA_TOOL_OPTIONS:[INFO]Attach process20038success.[INFO]arthas-client connect127.0.0.13658,---. ,------. ,--------.,--. ,--. ,---. ,---. / O\|.--.''--. .--'| '--' | / O \ '.-' | .-. || '--'.'|||.--.||.-.|`.`-.||||||\\||||||||||.-' | `--'`--'`--' '--' `--'`--'`--'`--'`--'`-----' wiki https://arthas.aliyun.com/doc tutorials https://arthas.aliyun.com/doc/arthas-tutorials.html version4.1.4 main_class demo20250304-0.0.1-SNAPSHOT.jar pid20038start_time2025-12-31 00:14:37.452 current_time2025-12-31 00:15:05.480[arthas@20038]$ redefine /root/1230/BookController.class redefine success, size:1, classes: com.example.demo20250304.controller.BookController[arthas@20038]$