Closed Flock-YT closed 1 year ago
因为 mirai
在 mirai-core-jvm
的依赖中存在对于 Ktor OkHttp
引擎的标记,但是实际上 mirai 并未依赖,因此导致 Ktor 尝试自动寻找并加载引擎时出现问题。
添加依赖 io.ktor:ktor-client-okhttp:2.3.0
来补上此缺失的依赖应当可以解决此问题。
在添加io.ktor:ktor-client-okhttp:2.3.0依赖后依旧出现报错
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2023-05-17T22:03:14.245+08:00 ERROR 43020 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'insertAuditResults_SQL': Unsatisfied dependency expressed through field 'botManagers': Error creating bean with name 'simbotApplicationBotManagers' defined in love.forte.simboot.spring.autoconfigure.SimbotSpringBootApplicationConfiguration: Unsatisfied dependency expressed through method 'simbotApplicationBotManagers' parameter 1: Error creating bean with name 'simbotApplicationAfterApplication' defined in love.forte.simboot.spring.autoconfigure.SimbotSpringBootApplicationConfiguration: Failed to instantiate [love.forte.simboot.spring.autoconfigure.AutoConfigureMarker$AfterApplicationPostProcessor]: Factory method 'simbotApplicationAfterApplication' threw exception with message: io.ktor.client.HttpClientEngineContainer: Provider io.ktor.client.engine.okhttp.OkHttpEngineContainer not found
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:713) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:693) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:133) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:482) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1416) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:597) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:917) ~[spring-context-6.0.8.jar:6.0.8]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[spring-context-6.0.8.jar:6.0.8]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.0.6.jar:3.0.6]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) ~[spring-boot-3.0.6.jar:3.0.6]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-3.0.6.jar:3.0.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:310) ~[spring-boot-3.0.6.jar:3.0.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1304) ~[spring-boot-3.0.6.jar:3.0.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1293) ~[spring-boot-3.0.6.jar:3.0.6]
at me.lele.qqguildbot.QqGuildBotApplication.main(QqGuildBotApplication.java:14) ~[classes/:na]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'simbotApplicationBotManagers' defined in love.forte.simboot.spring.autoconfigure.SimbotSpringBootApplicationConfiguration: Unsatisfied dependency expressed through method 'simbotApplicationBotManagers' parameter 1: Error creating bean with name 'simbotApplicationAfterApplication' defined in love.forte.simboot.spring.autoconfigure.SimbotSpringBootApplicationConfiguration: Failed to instantiate [love.forte.simboot.spring.autoconfigure.AutoConfigureMarker$AfterApplicationPostProcessor]: Factory method 'simbotApplicationAfterApplication' threw exception with message: io.ktor.client.HttpClientEngineContainer: Provider io.ktor.client.engine.okhttp.OkHttpEngineContainer not found
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:550) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1332) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1162) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1417) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:710) ~[spring-beans-6.0.8.jar:6.0.8]
... 20 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'simbotApplicationAfterApplication' defined in love.forte.simboot.spring.autoconfigure.SimbotSpringBootApplicationConfiguration: Failed to instantiate [love.forte.simboot.spring.autoconfigure.AutoConfigureMarker$AfterApplicationPostProcessor]: Factory method 'simbotApplicationAfterApplication' threw exception with message: io.ktor.client.HttpClientEngineContainer: Provider io.ktor.client.engine.okhttp.OkHttpEngineContainer not found
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:659) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:647) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1332) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1162) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1417) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) ~[spring-beans-6.0.8.jar:6.0.8]
... 33 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [love.forte.simboot.spring.autoconfigure.AutoConfigureMarker$AfterApplicationPostProcessor]: Factory method 'simbotApplicationAfterApplication' threw exception with message: io.ktor.client.HttpClientEngineContainer: Provider io.ktor.client.engine.okhttp.OkHttpEngineContainer not found
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:171) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:655) ~[spring-beans-6.0.8.jar:6.0.8]
... 47 common frames omitted
Caused by: java.util.ServiceConfigurationError: io.ktor.client.HttpClientEngineContainer: Provider io.ktor.client.engine.okhttp.OkHttpEngineContainer not found
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593) ~[na:na]
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1219) ~[na:na]
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1228) ~[na:na]
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273) ~[na:na]
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309) ~[na:na]
at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393) ~[na:na]
at kotlin.collections.CollectionsKt___CollectionsKt.toCollection(_Collections.kt:1295) ~[kotlin-stdlib-1.7.22.jar:1.7.22-release-288(1.7.22)]
at kotlin.collections.CollectionsKt___CollectionsKt.toMutableList(_Collections.kt:1328) ~[kotlin-stdlib-1.7.22.jar:1.7.22-release-288(1.7.22)]
at kotlin.collections.CollectionsKt___CollectionsKt.toList(_Collections.kt:1319) ~[kotlin-stdlib-1.7.22.jar:1.7.22-release-288(1.7.22)]
at io.ktor.client.HttpClientJvmKt.<clinit>(HttpClientJvm.kt:39) ~[ktor-client-core-jvm-2.3.0.jar:2.3.0]
at love.forte.simbot.qguild.internal.BotImpl.<init>(BotImpl.kt:97) ~[simbot-component-qq-guild-stdlib-jvm-3.0.0.0-alpha.7.jar:na]
at love.forte.simbot.qguild.BotFactory.create(BotConfiguration.kt:46) ~[simbot-component-qq-guild-stdlib-jvm-3.0.0.0-alpha.7.jar:na]
at love.forte.simbot.component.qguild.internal.QQGuildBotManagerImpl.register(QQGuildBotManagerImpl.kt:137) ~[simbot-component-qq-guild-core-3.0.0.0-alpha.7.jar:na]
at love.forte.simbot.component.qguild.BaseQQGuildBotManager.register(BaseQQGuildBotManager.kt:75) ~[simbot-component-qq-guild-core-common-3.0.0.0-alpha.7.jar:na]
at love.forte.simbot.component.qguild.BaseQQGuildBotManager.register(BaseQQGuildBotManager.kt:46) ~[simbot-component-qq-guild-core-common-3.0.0.0-alpha.7.jar:na]
at love.forte.simboot.spring.autoconfigure.SimbotSpringBootBotAutoRegisterBuildConfigure$SimbotSpringBootBotAutoRegisterPostProcessor.register(SimbotSpringBootBotAutoRegisterBuildConfigure.kt:164) ~[simboot-core-spring-boot-starter-3.0.0.jar:na]
at love.forte.simboot.spring.autoconfigure.SimbotSpringBootBotAutoRegisterBuildConfigure$SimbotSpringBootBotAutoRegisterPostProcessor.config(SimbotSpringBootBotAutoRegisterBuildConfigure.kt:115) ~[simboot-core-spring-boot-starter-3.0.0.jar:na]
at love.forte.simboot.spring.autoconfigure.SimbotSpringBootBotAutoRegisterBuildConfigure$SimbotSpringBootBotAutoRegisterPostProcessor.access$config(SimbotSpringBootBotAutoRegisterBuildConfigure.kt:46) ~[simboot-core-spring-boot-starter-3.0.0.jar:na]
at love.forte.simboot.spring.autoconfigure.SimbotSpringBootBotAutoRegisterBuildConfigure$SimbotSpringBootBotAutoRegisterPostProcessor$config$1.invokeSuspend(SimbotSpringBootBotAutoRegisterBuildConfigure.kt) ~[simboot-core-spring-boot-starter-3.0.0.jar:na]
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[kotlin-stdlib-1.7.22.jar:1.7.22-release-288(1.7.22)]
at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:178) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:166) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:397) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:431) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(CancellableContinuationImpl.kt:420) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:328) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.ResumeOnCompletion.invoke(JobSupport.kt:1398) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.notifyCompletion(JobSupport.kt:1520) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.completeStateFinalization(JobSupport.kt:323) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.finalizeFinishingState(JobSupport.kt:240) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.continueCompleting(JobSupport.kt:935) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.access$continueCompleting(JobSupport.kt:27) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport$ChildCompletion.invoke(JobSupport.kt:1155) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.notifyCompletion(JobSupport.kt:1520) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.completeStateFinalization(JobSupport.kt:323) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.finalizeFinishingState(JobSupport.kt:240) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath(JobSupport.kt:906) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:863) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(JobSupport.kt:828) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:100) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) ~[kotlin-stdlib-1.7.22.jar:1.7.22-release-288(1.7.22)]
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
进程已结束,退出代码1
本地未复现,检查项目依赖中确实出现了 ktor-client-okhttp 的依赖
复现方式更正,经过测试我发现即使不使用@Autowired注入BotManagers 仅仅是加载Mirai组件就会触发这个报错
以下是最新报错日志
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2023-05-17T22:08:05.925+08:00 ERROR 36896 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'simbotApplicationAfterApplication' defined in love.forte.simboot.spring.autoconfigure.SimbotSpringBootApplicationConfiguration: Failed to instantiate [love.forte.simboot.spring.autoconfigure.AutoConfigureMarker$AfterApplicationPostProcessor]: Factory method 'simbotApplicationAfterApplication' threw exception with message: io.ktor.client.HttpClientEngineContainer: Provider io.ktor.client.engine.okhttp.OkHttpEngineContainer not found
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:659) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:647) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1332) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1162) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:917) ~[spring-context-6.0.8.jar:6.0.8]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[spring-context-6.0.8.jar:6.0.8]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.0.6.jar:3.0.6]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) ~[spring-boot-3.0.6.jar:3.0.6]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-3.0.6.jar:3.0.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:310) ~[spring-boot-3.0.6.jar:3.0.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1304) ~[spring-boot-3.0.6.jar:3.0.6]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1293) ~[spring-boot-3.0.6.jar:3.0.6]
at me.lele.qqguildbot.QqGuildBotApplication.main(QqGuildBotApplication.java:14) ~[classes/:na]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [love.forte.simboot.spring.autoconfigure.AutoConfigureMarker$AfterApplicationPostProcessor]: Factory method 'simbotApplicationAfterApplication' threw exception with message: io.ktor.client.HttpClientEngineContainer: Provider io.ktor.client.engine.okhttp.OkHttpEngineContainer not found
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:171) ~[spring-beans-6.0.8.jar:6.0.8]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:655) ~[spring-beans-6.0.8.jar:6.0.8]
... 19 common frames omitted
Caused by: java.util.ServiceConfigurationError: io.ktor.client.HttpClientEngineContainer: Provider io.ktor.client.engine.okhttp.OkHttpEngineContainer not found
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593) ~[na:na]
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1219) ~[na:na]
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1228) ~[na:na]
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273) ~[na:na]
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309) ~[na:na]
at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393) ~[na:na]
at kotlin.collections.CollectionsKt___CollectionsKt.toCollection(_Collections.kt:1295) ~[kotlin-stdlib-1.7.22.jar:1.7.22-release-288(1.7.22)]
at kotlin.collections.CollectionsKt___CollectionsKt.toMutableList(_Collections.kt:1328) ~[kotlin-stdlib-1.7.22.jar:1.7.22-release-288(1.7.22)]
at kotlin.collections.CollectionsKt___CollectionsKt.toList(_Collections.kt:1319) ~[kotlin-stdlib-1.7.22.jar:1.7.22-release-288(1.7.22)]
at io.ktor.client.HttpClientJvmKt.<clinit>(HttpClientJvm.kt:39) ~[ktor-client-core-jvm-2.3.0.jar:2.3.0]
at love.forte.simbot.qguild.internal.BotImpl.<init>(BotImpl.kt:97) ~[simbot-component-qq-guild-stdlib-jvm-3.0.0.0-alpha.7.jar:na]
at love.forte.simbot.qguild.BotFactory.create(BotConfiguration.kt:46) ~[simbot-component-qq-guild-stdlib-jvm-3.0.0.0-alpha.7.jar:na]
at love.forte.simbot.component.qguild.internal.QQGuildBotManagerImpl.register(QQGuildBotManagerImpl.kt:137) ~[simbot-component-qq-guild-core-3.0.0.0-alpha.7.jar:na]
at love.forte.simbot.component.qguild.BaseQQGuildBotManager.register(BaseQQGuildBotManager.kt:75) ~[simbot-component-qq-guild-core-common-3.0.0.0-alpha.7.jar:na]
at love.forte.simbot.component.qguild.BaseQQGuildBotManager.register(BaseQQGuildBotManager.kt:46) ~[simbot-component-qq-guild-core-common-3.0.0.0-alpha.7.jar:na]
at love.forte.simboot.spring.autoconfigure.SimbotSpringBootBotAutoRegisterBuildConfigure$SimbotSpringBootBotAutoRegisterPostProcessor.register(SimbotSpringBootBotAutoRegisterBuildConfigure.kt:164) ~[simboot-core-spring-boot-starter-3.0.0.jar:na]
at love.forte.simboot.spring.autoconfigure.SimbotSpringBootBotAutoRegisterBuildConfigure$SimbotSpringBootBotAutoRegisterPostProcessor.config(SimbotSpringBootBotAutoRegisterBuildConfigure.kt:115) ~[simboot-core-spring-boot-starter-3.0.0.jar:na]
at love.forte.simboot.spring.autoconfigure.SimbotSpringBootBotAutoRegisterBuildConfigure$SimbotSpringBootBotAutoRegisterPostProcessor.access$config(SimbotSpringBootBotAutoRegisterBuildConfigure.kt:46) ~[simboot-core-spring-boot-starter-3.0.0.jar:na]
at love.forte.simboot.spring.autoconfigure.SimbotSpringBootBotAutoRegisterBuildConfigure$SimbotSpringBootBotAutoRegisterPostProcessor$config$1.invokeSuspend(SimbotSpringBootBotAutoRegisterBuildConfigure.kt) ~[simboot-core-spring-boot-starter-3.0.0.jar:na]
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[kotlin-stdlib-1.7.22.jar:1.7.22-release-288(1.7.22)]
at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:178) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:166) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:397) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:431) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(CancellableContinuationImpl.kt:420) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:328) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.ResumeOnCompletion.invoke(JobSupport.kt:1398) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.notifyCompletion(JobSupport.kt:1520) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.completeStateFinalization(JobSupport.kt:323) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.finalizeFinishingState(JobSupport.kt:240) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.continueCompleting(JobSupport.kt:935) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.access$continueCompleting(JobSupport.kt:27) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport$ChildCompletion.invoke(JobSupport.kt:1155) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.notifyCompletion(JobSupport.kt:1520) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.completeStateFinalization(JobSupport.kt:323) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.finalizeFinishingState(JobSupport.kt:240) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath(JobSupport.kt:906) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:863) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(JobSupport.kt:828) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:100) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) ~[kotlin-stdlib-1.7.22.jar:1.7.22-release-288(1.7.22)]
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
进程已结束,退出代码1
这个我知道,因为这是HttpClient加载引擎时产生的,跟SpringBoot应当没关系。检查依赖、尝试清理、重新编译,或者简单一点的试试看IDE中能够获取到 ( 作用域临时改成非 runtime
) :
System.out.println(io.ktor.client.engine.okhttp.OkHttp.INSTANCE);
重启IDE 清理编译 检查完依赖后依旧有报错,最后尝试在IDE里获取,发现不行.
那就是你依赖没引进来。Engine 相关说明可以参考 Ktor 官方文档
问题已解决原来是引错版本了要用-jvm
OkHttp
依赖
版本号
Simbot版本:3.0.0
附加版本
QQ频道组件版本:3.0.0-alpha.7 Mirai组件版本: 3.0.0.0-RC.2
涉及的编程语言
Java
项目构建工具
Maven
涉及的组件库
mirai (QQ), QQ频道
问题描述
测试环境为Springboot 在QQ频道机器人和Mirai组件同时加载时使用@Autowired获取botManagers时出现异常
后面经过测试,不加载QQ频道机器人组件只加载Mirai组件的时候可以正常运行
复现方式
@Autowired private BotManagers botManagers;
相关日志
其他补充
No response