使用最新版的打包系统部分Class丢失导致无法使用
-
刚刚开始学,有些地方不懂,听说是最新打包系统包压缩特性会把部分Class给去掉,请问怎么强制性加回去?
缺失Class:org.bson.BsonObjectIdval result = collection.insertOne(data) NewGroupEvent(result.insertedId).broadcast()
class NewGroupEvent(var id: BsonValue?) : AbstractEvent()
GlobalEventChannel.subscribeAlways<NewGroupEvent> {event -> val data = Document() .append("group_id", event.id) .append("state", "enable") MAIN_COLLECTION.insertOne(data) }
7月 30 03:09:29 instance-1 java[1154777]: 2022-07-30 03:09:29 W/SafeListener: An exception occurred when processing event. Subscriber scope: '<unnamed>'. Broadcaster scope: 'Plugin net.mamoe.mirai.console.chat-command' 7月 30 03:09:29 instance-1 java[1154777]: org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class org.bson.BsonObjectId. 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//org.bson.internal.CodecCache.lambda$getOrThrow$1(CodecCache.java:52) 7月 30 03:09:29 instance-1 java[1154777]: at java.base/java.util.Optional.orElseThrow(Optional.java:408) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//org.bson.internal.CodecCache.getOrThrow(CodecCache.java:51) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//org.bson.internal.OverridableUuidRepresentationCodecRegistry.get(OverridableUuidRepresentationCodecRegistry.java:72) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//org.bson.internal.ChildCodecRegistry.get(ChildCodecRegistry.java:52) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:209) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:168) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:44) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:63) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:29) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.connection.SplittablePayload$WriteRequestEncoder.encode(SplittablePayload.java:200) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.connection.SplittablePayload$WriteRequestEncoder.encode(SplittablePayload.java:187) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:63) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:29) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.connection.BsonWriterHelper.writeDocument(BsonWriterHelper.java:77) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.connection.BsonWriterHelper.writePayload(BsonWriterHelper.java:59) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.connection.CommandMessage.encodeMessageBodyWithMetadata(CommandMessage.java:170) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.connection.RequestMessage.encode(RequestMessage.java:138) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.connection.CommandMessage.encode(CommandMessage.java:63) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:325) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.connection.UsageTrackingInternalConnection.sendAndReceive(UsageTrackingInternalConnection.java:116) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.sendAndReceive(DefaultConnectionPool.java:643) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.connection.CommandProtocolImpl.execute(CommandProtocolImpl.java:71) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:240) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:226) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.connection.DefaultServerConnection.command(DefaultServerConnection.java:126) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.connection.DefaultServer$OperationCountTrackingConnection.command(DefaultServer.java:354) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.operation.MixedBulkWriteOperation.executeCommand(MixedBulkWriteOperation.java:517) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.operation.MixedBulkWriteOperation.executeBulkWriteBatch(MixedBulkWriteOperation.java:379) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.operation.MixedBulkWriteOperation.lambda$execute$2(MixedBulkWriteOperation.java:300) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.operation.OperationHelper.lambda$withSourceAndConnection$2(OperationHelper.java:575) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.operation.OperationHelper.withSuppliedResource(OperationHelper.java:600) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.operation.OperationHelper.lambda$withSourceAndConnection$3(OperationHelper.java:574) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.operation.OperationHelper.withSuppliedResource(OperationHelper.java:600) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.operation.OperationHelper.withSourceAndConnection(OperationHelper.java:573) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.operation.MixedBulkWriteOperation.lambda$execute$3(MixedBulkWriteOperation.java:272) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.async.function.RetryingSyncSupplier.get(RetryingSyncSupplier.java:65) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:308) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.internal.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:85) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:212) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.client.internal.MongoCollectionImpl.executeSingleWriteRequest(MongoCollectionImpl.java:1025) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.client.internal.MongoCollectionImpl.executeInsertOne(MongoCollectionImpl.java:476) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.client.internal.MongoCollectionImpl.insertOne(MongoCollectionImpl.java:459) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar[shared]//com.mongodb.client.internal.MongoCollectionImpl.insertOne(MongoCollectionImpl.java:453) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar//com.king250.bot.qq.link.Plugin$onEnable$1.invokeSuspend(Plugin.kt:60) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar//com.king250.bot.qq.link.Plugin$onEnable$1.invoke(Plugin.kt) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-link-1.0.0.mirai2.jar//com.king250.bot.qq.link.Plugin$onEnable$1.invoke(Plugin.kt) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.event.EventChannel$subscribeAlways$1.invokeSuspend(EventChannel.kt:511) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.event.EventChannel$subscribeAlways$1.invoke(EventChannel.kt) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.event.EventChannel$subscribeAlways$1.invoke(EventChannel.kt) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.internal.event.SafeListener$onEvent$2.invokeSuspend(SafeListener.kt:58) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.internal.event.SafeListener$onEvent$2.invoke(SafeListener.kt) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.internal.event.SafeListener$onEvent$2.invoke(SafeListener.kt) 7月 30 03:09:29 instance-1 java[1154777]: at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89) 7月 30 03:09:29 instance-1 java[1154777]: at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:166) 7月 30 03:09:29 instance-1 java[1154777]: at kotlinx.coroutines.BuildersKt.withContext(Unknown Source) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.internal.event.SafeListener.onEvent(SafeListener.kt:58) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.internal.event.EventListeners.process(EventListeners.kt:125) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.internal.event.EventListeners.callListeners$mirai_core(EventListeners.kt:73) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.internal.event.EventChannelImpl.callListeners(EventChannelImpl.kt:85) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.internal.event.EventChannelImpl.broadcastEventImpl(EventChannelImpl.kt:75) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.internal.MiraiImpl.broadcastEvent$suspendImpl(MiraiImpl.kt:325) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.internal.MiraiImpl.broadcastEvent(MiraiImpl.kt) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.event.EventKt.broadcast(Event.kt:156) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-admin-1.0.0.mirai2.jar//com.king250.bot.qq.admin.command.GroupManager.initGroup(GroupManager.kt:38) 7月 30 03:09:29 instance-1 java[1154777]: at mirai-admin-1.0.0.mirai2.jar//com.king250.bot.qq.admin.command.GroupManager.register(GroupManager.kt:63) 7月 30 03:09:29 instance-1 java[1154777]: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 7月 30 03:09:29 instance-1 java[1154777]: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 7月 30 03:09:29 instance-1 java[1154777]: at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 7月 30 03:09:29 instance-1 java[1154777]: at java.base/java.lang.reflect.Method.invoke(Method.java:566) 7月 30 03:09:29 instance-1 java[1154777]: at kotlin.reflect.jvm.internal.calls.CallerImpl$Method.callMethod(CallerImpl.kt:97) 7月 30 03:09:29 instance-1 java[1154777]: at kotlin.reflect.jvm.internal.calls.CallerImpl$Method$Instance.call(CallerImpl.kt:113) 7月 30 03:09:29 instance-1 java[1154777]: at kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:108) 7月 30 03:09:29 instance-1 java[1154777]: at kotlin.reflect.jvm.internal.KCallableImpl.callDefaultMethod$kotlin_reflection(KCallableImpl.kt:159) 7月 30 03:09:29 instance-1 java[1154777]: at kotlin.reflect.full.KCallables.callSuspendBy(KCallables.kt:74) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.console.internal.command.CommandReflector$findSubCommands$6$1.invokeSuspend(CommandReflector.kt:337) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.console.internal.command.CommandReflector$findSubCommands$6$1.invoke(CommandReflector.kt) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.console.internal.command.CommandReflector$findSubCommands$6$1.invoke(CommandReflector.kt) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.console.command.descriptor.CommandSignatureFromKFunctionImpl.call$suspendImpl(CommandSignature.kt:88) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.console.command.descriptor.CommandSignatureFromKFunctionImpl.call(CommandSignature.kt) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.console.internal.command.CommandManagerImplKt.executeCommandImpl(CommandManagerImpl.kt:168) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.console.command.CommandManager.executeCommand$suspendImpl(CommandManager.kt:130) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.console.command.CommandManager.executeCommand(CommandManager.kt) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.console.command.CommandManager$INSTANCE.executeCommand(CommandManager.kt) 7月 30 03:09:29 instance-1 java[1154777]: at net.mamoe.mirai.console.command.CommandManager.executeCommand$default(CommandManager.kt:125) 7月 30 03:09:29 instance-1 java[1154777]: at chat-command-0.5.1.jar//net.mamoe.mirai.console.plugins.chat.command.PluginMain.handleCommand(PluginMain.kt:86) 7月 30 03:09:29 instance-1 java[1154777]: at chat-command-0.5.1.jar//net.mamoe.mirai.console.plugins.chat.command.PluginMain$onEnable$2$1.invokeSuspend(PluginMain.kt:69) 7月 30 03:09:29 instance-1 java[1154777]: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) 7月 30 03:09:29 instance-1 java[1154777]: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) 7月 30 03:09:29 instance-1 java[1154777]: at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) 7月 30 03:09:29 instance-1 java[1154777]: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749) 7月 30 03:09:29 instance-1 java[1154777]: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) 7月 30 03:09:29 instance-1 java[1154777]: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
-
给出你的打包方式
也就是 build.gradle(.kts) 文件
不然无法分析 -
plugins { val kotlinVersion = "1.7.0" kotlin("jvm") version kotlinVersion kotlin("plugin.serialization") version kotlinVersion id("net.mamoe.mirai-console") version "2.12.0" } group = "com.king250.bot.qq" version = "1.0.0" dependencies { implementation(files("lib/mirai-admin-1.0.0.mirai2.jar")) implementation("org.mongodb:mongodb-driver-sync:4.7.0") implementation("com.squareup.okhttp3:okhttp:4.10.0") implementation("com.alibaba:fastjson:2.0.7") } repositories { mavenLocal() maven("https://maven.aliyun.com/repository/public") mavenCentral() }
-
-
This post is deleted! -
@cssxsh 阅读了一天资料,现在已经大概了解怎么弄法。添加了
dependsOn("com.king250.bot.qq.admin")
,但紧接着又出现以下问题2022-07-31 00:51:07 E/main: Failed to init MiraiConsole. net.mamoe.mirai.console.internal.util.ServiceLoadException: Could not load service com.king250.bot.qq.link.Plugin. at net.mamoe.mirai.console.internal.util.PluginServiceHelper.loadService(PluginServiceHelper.kt:60) at net.mamoe.mirai.console.internal.util.PluginServiceHelper.loadAllServices(PluginServiceHelper.kt:42) at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl$extractPlugins$findAllInstances$2.invoke(BuiltInJvmPluginLoaderImpl.kt:170) at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl$extractPlugins$findAllInstances$2.invoke(BuiltInJvmPluginLoaderImpl.kt:165) at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:210) at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:314) at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:303) at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:214) at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:214) at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:307) at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:303) at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:786) at kotlin.sequences.SequencesKt___SequencesKt.toSet(_Sequences.kt:827) at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl.extractPlugins(BuiltInJvmPluginLoaderImpl.kt:191) at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl.listPlugins(BuiltInJvmPluginLoaderImpl.kt:66) at net.mamoe.mirai.console.plugin.jvm.JvmPluginLoader$BuiltIn.listPlugins(JvmPluginLoader.kt) at net.mamoe.mirai.console.internal.plugin.PluginManagerImpl.listAndSortAllPlugins(PluginManagerImpl.kt:192) at net.mamoe.mirai.console.internal.plugin.PluginManagerImpl.findAndSortAllPluginsUsingBuiltInLoaders(PluginManagerImpl.kt:138) at net.mamoe.mirai.console.internal.plugin.PluginManagerImpl.loadAllPluginsUsingBuiltInLoaders$mirai_console(PluginManagerImpl.kt:148) at net.mamoe.mirai.console.internal.MiraiConsoleImplementationBridge.doStart$mirai_console(MiraiConsoleImplementationBridge.kt:178) at net.mamoe.mirai.console.MiraiConsoleImplementation$Companion.start(MiraiConsoleImplementation.kt:464) at net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader.startAsDaemon(MiraiConsoleTerminalLoader.kt:168) at net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader.startAsDaemon$default(MiraiConsoleTerminalLoader.kt:167) at net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader.main(MiraiConsoleTerminalLoader.kt:52) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.itxtech.mcl.Utility.bootJars(Utility.java:89) at org.itxtech.mcl.Utility.bootJars(Utility.java:79) at org.itxtech.mcl.Utility.bootMirai(Utility.java:101) at org.itxtech.mcl.module.builtin.Boot.boot(Boot.java:109) at org.itxtech.mcl.module.ModuleManager.phaseBoot(ModuleManager.java:148) at org.itxtech.mcl.Loader.lambda$start$4(Loader.java:189) at org.itxtech.mcl.Loader.tryCatching(Loader.java:146) at org.itxtech.mcl.Loader.start(Loader.java:189) at org.itxtech.mcl.Loader.main(Loader.java:79) Caused by: java.lang.NoClassDefFoundError: Lcom/mongodb/client/MongoClient; at java.base/java.lang.Class.getDeclaredFields0(Native Method) at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3061) at java.base/java.lang.Class.getDeclaredField(Class.java:2409) at kotlin.reflect.jvm.internal.KClassImpl$Data$objectInstance$2.invoke(KClassImpl.kt:115) at kotlin.reflect.jvm.internal.ReflectProperties$LazyVal.invoke(ReflectProperties.java:63) at kotlin.reflect.jvm.internal.ReflectProperties$Val.getValue(ReflectProperties.java:32) at kotlin.reflect.jvm.internal.KClassImpl$Data.getObjectInstance(KClassImpl.kt:108) at kotlin.reflect.jvm.internal.KClassImpl.getObjectInstance(KClassImpl.kt:242) at net.mamoe.mirai.console.internal.util.PluginServiceHelper.loadService(PluginServiceHelper.kt:52) ... 36 more Caused by: java.lang.ClassNotFoundException: com.mongodb.client.MongoClient at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) at net.mamoe.mirai.console.internal.plugin.JvmPluginClassLoaderN.loadClass(JvmPluginClassLoader.kt:385) ... 45 more
经检查dependencies-private.txt是有相关依赖的
-
Caused by: java.lang.ClassNotFoundException: com.mongodb.client.MongoClient
不要在 <init> 就启动 MongoClient
你应该在 onEnable 方法中 启动