Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPI加载外部扩展class异常ClassNotFoundException #5781

Open
1 task
luochen-123-bot opened this issue Aug 14, 2023 · 2 comments
Open
1 task

SPI加载外部扩展class异常ClassNotFoundException #5781

luochen-123-bot opened this issue Aug 14, 2023 · 2 comments

Comments

@luochen-123-bot
Copy link

  • 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:
@funky-eyes
Copy link
Contributor

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

@funky-eyes
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants