Skip to content
New issue

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

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

Already on GitHub? # to your account

[BUG] jdk 17 模块化使用报错 Package com.alibaba.fastjson2.support in both module com.alibaba.fastjson2 and module com.alibaba.fastjson2.extension #2451

Closed
liguotian opened this issue Apr 16, 2024 · 5 comments
Labels
bug Something isn't working fixed
Milestone

Comments

@liguotian
Copy link

问题描述

在jdkl17种使用 fastjson2 (2.0.45),采用模块化的方式引入,启动项目报错如下
java.lang.LayerInstantiationException: Package com.alibaba.fastjson2.support in both module com.alibaba.fastjson2 and module com.alibaba.fastjson2.extension

环境信息

  • OS信息: mac os Monterey Apple M1 16G
  • JDK信息:jdk-17.0.2
  • 版本信息:Fastjson2 2.0.45

重现步骤

1.在jdkl17种使用 fastjson2 (2.0.45),采用模块化的方式引入

    requires transitive fastjson;
    requires transitive com.alibaba.fastjson2;
    requires transitive com.alibaba.fastjson2.extension;
```,
2.构建main函数启动项目报错如下
`java.lang.LayerInstantiationException: Package com.alibaba.fastjson2.support in both module com.alibaba.fastjson2 and module com.alibaba.fastjson2.extension`


### 期待的正确结果
不应该出现该报错,


### 相关日志输出

Error occurred during initialization of boot layer
java.lang.LayerInstantiationException: Package com.alibaba.fastjson2.support in both module com.alibaba.fastjson2 and module com.alibaba.fastjson2.extension

Process finished with exit code 1



#### 附加信息
无
@liguotian liguotian added the bug Something isn't working label Apr 16, 2024
@wenshao
Copy link
Member

wenshao commented Apr 16, 2024

这个问题修复过,帮忙用2.0.49版本验证下是否问题还存在

@liguotian
Copy link
Author

用了2.0.49 还是一样的
image

@liguotian
Copy link
Author

这个问题修复过,帮忙用2.0.49版本验证下是否问题还存在

现在我将版本降到 2.0.29 是可以的。只需要引入模块 requires transitive fastjson

@wenshao wenshao added this to the 2.0.50 milestone Apr 20, 2024
wenshao added a commit that referenced this issue May 2, 2024
wenshao added a commit that referenced this issue May 2, 2024
wenshao added a commit that referenced this issue May 2, 2024
@wenshao
Copy link
Member

wenshao commented May 2, 2024

https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.50-SNAPSHOT/
问题已修复,请帮忙用2.0.50-SNAPSHOT版本验证,2.0.50版本预计在5月12日前发布

@wenshao wenshao added the fixed label May 2, 2024
@wenshao
Copy link
Member

wenshao commented May 12, 2024

https://github.com/alibaba/fastjson2/releases/tag/2.0.50
2.0.50已发布,请用新版本

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

2 participants