arthas 执行ognl表达式的时候,出现
java.lang.ClassNotFoundException: Unable to resolve class
可能是因为类加载器加载不到指定的类。
可以使用
sc -d 类全名
找到该类的类加载器的hash:
classLoaderHash 7c2e8ffa
然后在执行ognl表达式时加上参数,指定类加载器:
ognl -x 3 -c 7c2e8ffa '#springContext=@com..util.SpringContextUtil@ctu,#springContext.getBean("classService").getExamClass("111","aaa")'
通过-c hash 来指定类加载器就可以了。
当使用Arthas执行OGNL表达式遇到ClassNotFoundException时,可能是因为类加载器无法找到指定类。可以使用`sc-d`命令查找类的类加载器哈希,并在执行OGNL时通过`-chash`参数指定类加载器,例如`ognl-x3-c7c2e8ffa#springContext=...`,这样能解决类找不到的问题。
1万+

被折叠的 条评论
为什么被折叠?



