javaagent springboot class not found的解决思路
使用bytebuddy对springboot应用进行instrument的时候,会原本正常的springboot 应用有class not found的情况。但经过测试发现使用appendToBootstrapClassLoaderSearch 把相关class。网上能看到基本都是说双亲机制导致的问题,有些提供了很复杂的解决方法。导入class path即可,参考代码如下。
·
使用bytebuddy对springboot 应用进行instrument的时候,会原本正常的springboot 应用有class not found的情况。
网上能看到基本都是说双亲机制导致的问题,有些提供了很复杂的解决方法。
但经过测试发现使用appendToBootstrapClassLoaderSearch 把相关class
导入class path即可,参考代码如下。
// instrumentation.appendToSystemClassLoaderSearch(jarFile);
//spring bott 使用bootStrapClassLoader
//The agent should take care to ensure that the JAR does not contain any classes or resources other than those to be defined by
// the bootstrap class loader for the purpose of instrumentation.
instrumentation.appendToBootstrapClassLoaderSearch(jarFile);
更多推荐
所有评论(0)