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

使用了外部依赖的插件在开发模式下出现 NoClassDefFoundError 问题 #3107

Closed
guqing opened this issue Jan 6, 2023 · 2 comments · Fixed by #3108
Closed

使用了外部依赖的插件在开发模式下出现 NoClassDefFoundError 问题 #3107

guqing opened this issue Jan 6, 2023 · 2 comments · Fixed by #3108
Assignees
Labels
kind/improvement Categorizes issue or PR as related to a improvement.
Milestone

Comments

@guqing
Copy link
Member

guqing commented Jan 6, 2023

What is version of Halo has the issue?

latest

What database are you using?

H2

What is your deployment method?

Docker

Your site address.

No response

What happened?

此问题仅开发模式存在,导致无法使用开发模式,jar 包可以正常使用。

Relevant log output

异常示例:

Caused by: java. lang. NoClassDefFoundEenon: Create breakpoint : com/wechat/pay/java/core/Config
at java. base/java.Lang. Class. getDeclaredMethods0 (Native Method) -[na:na]
at java. base/java. Lang. Class.privateGetDeclaredMethods (Class, java: 3402) -[na:na]
at java. base/java. lang. Class. getDeclaredMethods(Class. java:2504) ~ [na:na]
at
org. springframework.utit.ReflectionUtils.getDeclaredMethods(Reflectionlitils.java:465)-[spring-core-6.0.3.jar:6.0.3]
32 common frames omitted
Caused by: java. Lang. ClassNotFoundExcention Create breakpoint com.wechat.pay-java.core.Config
Caused by: java.lang.NoClassDefFoundError: com/aliyun/oss/OSSException
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method) ~[na:na]
	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402) ~[na:na]
	at java.base/java.lang.Class.getDeclaredMethods(Class.java:2504) ~[na:na]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:465) ~[spring-core-6.0.3.jar:6.0.3]
	... 33 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.aliyun.oss.OSSException
	at org.pf4j.PluginClassLoader.loadClass(PluginClassLoader.java:144) ~[pf4j-3.8.0.jar:3.8.0]
	... 37 common frames omitted

Additional information

/kind improvement
/milestone 2.2.x
/assign

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Jan 6, 2023

@guqing: The label(s) kind/imporovement cannot be applied, because the repository doesn't have them.

In response to this:

What is version of Halo has the issue?

latest

What database are you using?

H2

What is your deployment method?

Docker

Your site address.

No response

What happened?

此问题仅开发模式存在,导致无法使用开发模式,jar 包可以正常使用。

Relevant log output

异常示例:

Caused by: java. lang. NoClassDefFoundEenon: Create breakpoint : com/wechat/pay/java/core/Config
at java. base/java.Lang. Class. getDeclaredMethods0 (Native Method) -[na:na]
at java. base/java. Lang. Class.privateGetDeclaredMethods (Class, java: 3402) -[na:na]
at java. base/java. lang. Class. getDeclaredMethods(Class. java:2504) ~ [na:na]
at
org. springframework.utit.ReflectionUtils.getDeclaredMethods(Reflectionlitils.java:465)-[spring-core-6.0.3.jar:6.0.3]
32 common frames omitted
Caused by: java. Lang. ClassNotFoundExcention Create breakpoint com.wechat.pay-java.core.Config
Caused by: java.lang.NoClassDefFoundError: com/aliyun/oss/OSSException
  at java.base/java.lang.Class.getDeclaredMethods0(Native Method) ~[na:na]
  at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402) ~[na:na]
  at java.base/java.lang.Class.getDeclaredMethods(Class.java:2504) ~[na:na]
  at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:465) ~[spring-core-6.0.3.jar:6.0.3]
  ... 33 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.aliyun.oss.OSSException
  at org.pf4j.PluginClassLoader.loadClass(PluginClassLoader.java:144) ~[pf4j-3.8.0.jar:3.8.0]
  ... 37 common frames omitted


### Additional information

/kind imporovement
/milestone 2.2.x
/assign

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@f2c-ci-robot f2c-ci-robot bot added this to the 2.2.x milestone Jan 6, 2023
@guqing
Copy link
Member Author

guqing commented Jan 6, 2023

/kind improvement

@f2c-ci-robot f2c-ci-robot bot added the kind/improvement Categorizes issue or PR as related to a improvement. label Jan 6, 2023
f2c-ci-robot bot pushed a commit that referenced this issue Jan 9, 2023
…3108)

#### What type of PR is this?
/kind improvement
/area core
/milestone 2.2.x

#### What this PR does / why we need it:
修复引入外部依赖的插件以开发模式启动时会出现 NoClassDefFoundError 的问题
see #3107 for more detail.

#### Which issue(s) this PR fixes:
Fixes #3107

#### Special notes for your reviewer:
how to test it?
以插件 development 模式启动以下两个插件观察是否正常启动:
- https://github.com/halo-sigs/plugin-s3
- https://github.com/halo-sigs/plugin-alioss

期望没有 `Caused by: java. lang. NoClassDefFoundEenon` 错误,且插件正确启动。

/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?
```release-note
修复引入外部依赖的插件以开发模式启动时会出现 NoClassDefFoundError 的问题
```
@ruibaby ruibaby modified the milestones: 2.2.x, 2.2.0 Jan 12, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
kind/improvement Categorizes issue or PR as related to a improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants