sofa-ark
sofa-ark copied to clipboard
install biz: class com.alipay.sofa.ark.springboot.listener.ArkApplicationStartListener is not assignable to interface org.springframework.context.ApplicationListener
Your question
版本:2.0.3
通过命令行 biz -i file:///xxx部署新的biz包报错:
2022-09-22 15:19:00,181 ERROR SOFA-ARK-telnet-command-1-T1 - Install Biz: ark-biz-slave:1.0.0 fail,cost: 290 ms, started at: 15:18:59,889
java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.alipay.sofa.ark.bootstrap.MainMethodRunner.run(MainMethodRunner.java:48)
at com.alipay.sofa.ark.container.model.BizModel.start(BizModel.java:283)
at com.alipay.sofa.ark.api.ArkClient.installBiz(ArkClient.java:172)
at com.alipay.sofa.ark.api.ArkClient.installOperation(ArkClient.java:348)
at com.alipay.sofa.ark.api.ArkClient.installOperation(ArkClient.java:333)
at com.alipay.sofa.ark.container.service.biz.BizCommandProvider$BizCommand$1.run(BizCommandProvider.java:249)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.ApplicationListener : com.alipay.sofa.ark.springboot.listener.ArkApplicationStartListener
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:456)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:438)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:431)
at org.springframework.boot.SpringApplication.
Environment
- SOFAArk version: 2.0.3
- JVM version (e.g.
java -version
): 1.8 - OS version (e.g.
uname -a
): macOS - Maven version: 3.6.3
- IDE version: 2021.1.3
应该是嵌入式方式造成的.
需要检查下 biz 包中是否设置了 <declaredMode>true</declaredMode> 以及 spring 依赖下沉到 master-biz 中,设置
@alexBaiJW 请问下这个问题你是怎么解决的,我也遇到相同的报错
需要检查下 biz 包中是否设置了 true 以及 spring 依赖下沉到 master-biz 中,设置 provided
找到原因了,如 @gaosaroma 所说, 确实需要把 ark-biz 的Spring依赖下层到master biz后就没有这个问题了。
@gaosaroma 有个问题顺便请教下,如果Springboot 的starter都放到了 master biz,那master biz启动时岂不是会激活很多bean,有些自动装配只想某些 ark-biz 启动才装配呢?
@nisiyong 可否举个例子呢;如果是 ark-biz 内的自动装配,会在ark-biz启动时再装配;如果是 ark-biz 依赖,但 master-biz 不依赖的依赖包需要装配的bean,那么也是在 ark-biz 启动时再装配。
如果没有别的问题,这个issue就先关闭了哈~ 有问题再开~