mamoe / mirai

高效率 QQ 机器人支持库
https://mirai.mamoe.net
GNU Affero General Public License v3.0
14.48k stars 2.54k forks source link

启动第一次时候没问题 第二次出现这个错误 #1336

Closed lzyacg closed 3 years ago

lzyacg commented 3 years ago

Exception in thread "main" java.lang.reflect.InvocationTargetException 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 love.forte.common.ioc.MethodDependPass.invoke(DependPass.kt:76) at love.forte.common.ioc.DependCenter.init(DependCenter.kt:99) at love.forte.simbot.core.SimbotApp.initDependCenter(SimbotApp.kt:351) at love.forte.simbot.core.SimbotApp.run$core(SimbotApp.kt:199) at love.forte.simbot.core.SimbotApp$Run.run(SimbotApp.kt:416) at love.forte.simbot.core.SimbotApp$Run.run$default(SimbotApp.kt:384) at love.forte.simbot.core.SimbotApp.run(SimbotApp.kt) at com.rebot.RebotRunApplication.main(RebotRunApplication.java:14) Caused by: java.lang.IllegalStateException: Cannot verifier bot code: 1176379676 at love.forte.simbot.component.mirai.MiraiBotVerifier.verity(MiraiBotVerifier.kt:99) at love.forte.simbot.core.bot.CoreBotManager.registerBot(CoreBotManager.kt:91) at love.forte.simbot.core.configuration.CoreBotRegistrar.registerBots(CoreBotRegistrar.kt:54) ... 12 more Caused by: java.lang.IllegalStateException: 在 Bot login 时遇到了意料之中的问题. 请完整复制此日志提交给 mirai: https://github.com/mamoe/mirai/issues/new 调试信息: kotlin.UninitializedPropertyAccessException: lateinit property nick has not been initialized at net.mamoe.mirai.internal.message.ContextualBugReportExceptionKt.contextualBugReportException(contextualBugReportException.kt:23) at net.mamoe.mirai.internal.message.ContextualBugReportExceptionKt.contextualBugReportException$default(contextualBugReportException.kt:21) at net.mamoe.mirai.internal.AbstractBot$Login.doLogin(AbstractBot.kt:297) at net.mamoe.mirai.internal.AbstractBot$Login$doLogin$1.invokeSuspend(AbstractBot.kt) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274) at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:86) at kotlinx.coroutines.BuildersKtBuildersKt.runBlocking(Builders.kt:61) at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source) at kotlinx.coroutines.BuildersKtBuildersKt.runBlocking$default(Builders.kt) at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source) at love.forte.simbot.component.mirai.MiraiBotVerifier.verity(MiraiBotVerifier.kt:74) ... 14 more Caused by: kotlin.UninitializedPropertyAccessException: lateinit property nick has not been initialized at net.mamoe.mirai.internal.QQAndroidBot.getNick(QQAndroidBot.kt:121) at net.mamoe.mirai.internal.AbstractBot$Login.doLogin(AbstractBot.kt:295) ... 24 more [2021-06-15T11:06:49.427]-[WARN ] | love.f.s.c.m.b.1176379676 : null

Him188 commented 3 years ago

版本号

Karlatemp commented 3 years ago

更新

lzyacg commented 3 years ago

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0
<!-- 使用simbot的parent -->
<parent>
    <groupId>love.forte.simple-robot</groupId>
    <artifactId>parent</artifactId>
    <version>2.1.0-M1</version><!--vv-->
</parent>

<groupId>org.example</groupId>
<artifactId>rebot</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
    <maven.compiler.source>8</maven.compiler.source>
    <maven.compiler.target>8</maven.compiler.target>
</properties>

<dependencies>
    <!-- 使用 mirai 组件。 -->
    <dependency>
        <groupId>love.forte.simple-robot</groupId>
        <artifactId>component-mirai</artifactId>
    </dependency>

    <!-- 定时任务模块 -->
    <!--<dependency>-->
    <!--    <groupId>love.forte.simple-robot.time-task</groupId>-->
    <!--    <artifactId>time-task-quartz</artifactId>-->
    <!--</dependency>-->

</dependencies>

<build>
    <plugins>
        <!-- 编译插件 plugin. -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>8</source>
                <target>8</target>
                <compilerArgs>
                    <arg>-parameters</arg>
                </compilerArgs>
            </configuration>
        </plugin>
        <!-- 打包插件 -->
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>2.3.4.RELEASE</version>
            <configuration>
                <mainClass>test.Test</mainClass>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

lzyacg commented 3 years ago

版本是最新的了吧 也不行

Karlatemp commented 3 years ago

你都没显示添加 mirai 依赖, 请问你说使用的 framework 的作者, 或者自行搜索 maven 相关资料

lzyacg commented 3 years ago
love.forte.simple-robot component-mirai

这个不是吗... 我用的 https://github.com/simple-robot/simbot-mirai-demo 这个demo里面的

sandtechnology commented 3 years ago

这不属于mamoe维护的项目 请询问该项目的开发者。

ForteScarlet commented 3 years ago

这里对应的mirai版本号为 v2.6.6

Karlatemp commented 3 years ago

这个错误都2月份的东西了,早就在2.4修了

lzyacg commented 3 years ago

love.forte.simple-robot
    <artifactId>component-mirai</artifactId>
</dependency> 这个指定版本号嘛
ForteScarlet commented 3 years ago

我也记着这个问题很久之前就修复过,但是上文里提到的依赖中的 v2.1.0-M1 版本对应的mirai版本确实应该是 v2.6.6, 可以从 https://repo1.maven.org/maven2/love/forte/simple-robot/component-mirai/2.1.0-M1/component-mirai-2.1.0-M1.pom 中看到,properties里

lzyacg commented 3 years ago

可以启动了 用的2.0.6 版本 2.1.0-M1 这个没法使用maven下载