Closed aaacde closed 1 year ago
Caused by: java.lang.ClassNotFoundException: net.mamoe.mirai.internal.deps.io.ktor.client.engine.okhttp.OkHttp
see https://github.com/orgs/simple-robot/discussions/23, this is caused by the mirai version problem, consider temporarily reducing the version to v3.0.0.0-beta.3
The Entry of my java program of boot simbot is :
In my Maven project, the corresponding dependencies in Pom.xml is :
Then, a ClassNotFoundException will show up:
Exception in thread "main" love.forte.simboot.core.SimbootApplicationException: Run boot app failure: net.mamoe.mirai.IMirai: Provider net.mamoe.mirai.internal.MiraiImpl could not be instantiated at love.forte.simboot.core.SimbootAppKt.runApp(SimbootApp.kt:211) at love.forte.simboot.core.SimbootAppKt.access$runApp(SimbootApp.kt:1) at love.forte.simboot.core.SimbootApp$run4J$1.invokeSuspend(SimbootApp.kt:153) at love.forte.simboot.core.SimbootApp$run4J$1.invoke(SimbootApp.kt) at love.forte.simboot.core.SimbootApp$run4J$1.invoke(SimbootApp.kt) at love.forte.simbot.application.ApplicationLauncherImpl.launch(ApplicationLauncher.kt:89) at love.forte.simbot.application.ApplicationLauncher$launchBlocking$1.invoke(ApplicationLauncher.kt) at love.forte.simbot.application.ApplicationLauncher$launchBlocking$1.invoke(ApplicationLauncher.kt) at kotlin.coroutines.intrinsics.IntrinsicsKtIntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKtIntrinsicsJvmKt$2.invokeSuspend(IntrinsicsJvm.kt:205) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:115) at love.forte.simbot.utils.DefaultRunInNoScopeBlockingStrategy.invoke(BlockingRunner.kt:359) at love.forte.simbot.utils.BlockingRunnerKt.runInNoScopeBlocking(BlockingRunner.kt:423) at love.forte.simbot.utils.BlockingRunnerKt.runInNoScopeBlocking$default(BlockingRunner.kt:420) at love.forte.simbot.utils.BlockingRunnerKt.$$runInBlocking(BlockingRunner.kt:464) at love.forte.simbot.application.ApplicationLauncher.launchBlocking(ApplicationLauncher.kt) at org.example.SimBotBootApp.main(SimBotBootApp.java:15) Caused by: java.util.ServiceConfigurationError: net.mamoe.mirai.IMirai: Provider net.mamoe.mirai.internal.MiraiImpl could not be instantiated at java.util.ServiceLoader.fail(ServiceLoader.java:232) at java.util.ServiceLoader.access$100(ServiceLoader.java:185) at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384) at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) at java.util.ServiceLoader$1.next(ServiceLoader.java:480) at kotlin.collections.CollectionsKt_CollectionsKt.firstOrNull(_Collections.kt:272) at net.mamoe.mirai.utils.ServicesKt.loadService(Services.kt:18) at net.mamoe.mirai.Mirai.findMiraiInstance(IMirai.kt:357) at net.mamoe.mirai.MiraiInstance.get(IMirai.kt:348) at net.mamoe.mirai.Mirai.getInstance(IMirai.kt:39) at net.mamoe.mirai.internal.message.MessageSerializersImpl.getSerializersModule(MessageSerializersImpl.kt:65) at net.mamoe.mirai.message.MessageSerializers$INSTANCE.getSerializersModule(MessageSerializers.kt) at love.forte.simbot.component.mirai.MiraiComponent.(MiraiComponent.kt:174)
at love.forte.simbot.component.mirai.MiraiComponentAutoRegistrarFactory.getRegistrar(MiraiComponent.kt:196)
at love.forte.simbot.component.mirai.MiraiComponentAutoRegistrarFactory.getRegistrar(MiraiComponent.kt:193)
at love.forte.simbot.Components.installAllComponents(Component.kt:130)
at love.forte.simboot.core.application.BootApplicationBuilderImpl.build(BootApplication.kt:406)
at love.forte.simboot.core.application.Boot.create(BootApplication.kt:89)
at love.forte.simbot.application.Applications.createSimbotApplication(Applications.kt:61)
at love.forte.simboot.core.SimbootAppKt.runApp(SimbootApp.kt:210)
... 16 more
Caused by: java.util.ServiceConfigurationError: net.mamoe.mirai.IMirai: Provider net.mamoe.mirai.internal.MiraiImpl could not be instantiated
at java.util.ServiceLoader.fail(ServiceLoader.java:232)
at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at kotlin.collections.CollectionsKt CollectionsKt.firstOrNull(_Collections.kt:272)
at net.mamoe.mirai.utils.ServicesKt.loadService(Services.kt:18)
at net.mamoe.mirai.Mirai.findMiraiInstance(IMirai.kt:357)
at net.mamoe.mirai._MiraiInstance.get(IMirai.kt:348)
at net.mamoe.mirai.Mirai.getInstance(IMirai.kt:39)
at net.mamoe.mirai.internal.message.MessageSerializersImpl.getSerializersModule(MessageSerializersImpl.kt:65)
at net.mamoe.mirai.internal.message.MessageSerializersImpl.registerSerializers(MessageSerializersImpl.kt:76)
at net.mamoe.mirai.message.MessageSerializers$INSTANCE.registerSerializers(MessageSerializers.kt)
at net.mamoe.mirai.internal.message.protocol.MessageProtocolFacade.(MessageProtocolFacade.kt:165)
at net.mamoe.mirai.internal.MiraiImplKt._MiraiImpl_static_init(MiraiImpl.kt:25)
at net.mamoe.mirai.internal.MiraiImpl.(MiraiImpl.kt:87)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
... 33 more
Caused by: java.lang.NoClassDefFoundError: net/mamoe/mirai/internal/deps/io/ktor/client/engine/okhttp/OkHttp
at net.mamoe.mirai.internal.MiraiImplKt.createDefaultHttpClient(MiraiImpl.kt:29)
at net.mamoe.mirai.internal.MiraiImpl.(MiraiImpl.kt:97)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
... 52 more
Caused by: java.lang.ClassNotFoundException: net.mamoe.mirai.internal.deps.io.ktor.client.engine.okhttp.OkHttp
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 60 more
After I changed the version such that the Pom.xml becomes:
The java program can run normally for the older version 3.0.0.0-beta.2 .