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 来指定类加载器就可以了。