seata SPI加载外部扩展class异常ClassNotFoundException

332nm8kg  于 4个月前  发布在  其他
关注(0)|答案(2)|浏览(69)
  • I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

使用外部扩展,SPI无法加载对应的class,抛出java.lang.ClassNotFoundException:io.seata.sqlparser.druid.dm.DmOperateRecognizerHolder

io.seata.common.loader.EnhancedServiceLoader.InnerEnhancedServiceLoader#loadFile
能够扫描到对应的META-INF/services下的自定义文件,如果将新增的扩展类放到seata-all-1.6.1.jar中可以正常使用,如果使用外部扩展则不能使用。使用到的类加载器是io.seata.sqlparser.druid.DruidIsolationClassLoader

Ⅱ. Describe what happened

Ⅲ. Describe what you expected to happen

Ⅳ. How to reproduce it (as minimally and precisely as possible)

  1. xxx
  2. xxx
  3. xxx

Minimal yet complete reproducer code (or URL to code):

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

  • JDK version(e.g. java -version ): 17
  • Seata client/server version: 1.6.1
  • Database version:
  • OS(e.g. uname -a ):
  • Others:
q9yhzks0

q9yhzks01#

先临时改下包名处理吧,这个要讨论下是否去除sqlparser这个路径的加载隔离

rqenqsqc

rqenqsqc2#

改包名也无效,因为两者一个是业务classloader加载的实现,一个父类是DruidIsolationClassLoader加载的,无法判断实现类是接口的子类,导致类型转换异常

相关问题