simple-robot / simpler-robot

Simple Robot,一个bot风格的Kotlin多平台事件调度框架,异步高效、Java友好!/ A Bot-style Kotlin Multiplatform event scheduling framework, asynchronous and high-performance, java-friendly! 🐱😼😻😸
https://simbot.forte.love
GNU Lesser General Public License v3.0
512 stars 44 forks source link

当前QQ版本过低问题升级后 #496

Closed jinkaz closed 1 year ago

jinkaz commented 1 year ago

版本号

3.0.0-M2

附加版本

simboot-core-spring-boot-starter:3.0.0-M2 simbot-component-mirai-boot:3.0.0.0-beta.4 mirai-core-jvm:2.13.0-RC2

问题描述

最近机器人启动提示当前QQ版本过低,请升级至最新版本后再登录。点击进入下载页面。最近一直关注issue的记录。目前已经升级到最新版本。按照mirai的版本3.13.0 能解决这个问题,但是启动会出现okhttp缺失类。又看到提交记录是在版本2.13.0-RC2已经修复这个问题,所以手动引入了mirai-core-jvm。但是再次启动仍旧提示QQ版本过低的报错。。。想请问还是等待版本修复吗?以下是我的springboot工程引入的依赖:

    <dependency>
        <groupId>love.forte.simbot.boot</groupId>
        <artifactId>simboot-core-spring-boot-starter</artifactId>
        <version>3.0.0-M2</version>
    </dependency>
            <dependency>
        <groupId>love.forte.simbot.component</groupId>
        <artifactId>simbot-component-mirai-boot</artifactId>
        <version>3.0.0.0-beta.4</version>
        <exclusions>
            <exclusion>
                <groupId>net.mamoe</groupId>
                <artifactId>mirai-core-jvm</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>net.mamoe</groupId>
        <artifactId>mirai-core-jvm</artifactId>
        <version>2.13.0-RC2</version>
        <exclusions>
            <exclusion>
                <artifactId>kotlinx-serialization-core-jvm</artifactId>
                <groupId>org.jetbrains.kotlinx</groupId>
            </exclusion>
        </exclusions>
    </dependency>

补充:kotlinx-serialization-core-jvm 去掉依赖是因为启动会报类冲突,我这里这么处理就能启动今儿进行图形验证码链接后续的操作。

复现方式

服务启动即可出现。用两个qq好都试过了。

相关日志

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'simbotSpringBootApplication' defined in love.forte.simboot.spring.autoconfigure.SimbotSpringBootApplicationConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [love.forte.simboot.spring.autoconfigure.application.SpringBootApplication]: Factory method 'simbotSpringBootApplication' threw exception; nested exception is java.lang.IllegalStateException: Can't overwrite cause with a null
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) ~[spring-beans-5.3.23.jar:5.3.23]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) ~[spring-beans-5.3.23.jar:5.3.23]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.23.jar:5.3.23]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.23.jar:5.3.23]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.23.jar:5.3.23]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.23.jar:5.3.23]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.23.jar:5.3.23]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.23.jar:5.3.23]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.23.jar:5.3.23]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.23.jar:5.3.23]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955) ~[spring-beans-5.3.23.jar:5.3.23]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.23.jar:5.3.23]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.23.jar:5.3.23]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.5.jar:2.7.5]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-2.7.5.jar:2.7.5]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.5.jar:2.7.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.5.jar:2.7.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-2.7.5.jar:2.7.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-2.7.5.jar:2.7.5]
    at com.example.simbottest.SimbottestApplication.main(SimbottestApplication.java:11) ~[classes/:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.7.5.jar:2.7.5]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [love.forte.simboot.spring.autoconfigure.application.SpringBootApplication]: Factory method 'simbotSpringBootApplication' threw exception; nested exception is java.lang.IllegalStateException: Can't overwrite cause with a null
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.3.23.jar:5.3.23]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.23.jar:5.3.23]
    ... 24 common frames omitted
Caused by: java.lang.IllegalStateException: Can't overwrite cause with a null
    at java.base/java.lang.Throwable.initCause(Throwable.java:463) ~[na:na]
    at love.forte.simbot.component.mirai.internal.MiraiBotImpl.start(MiraiBotImpl.kt:244) ~[simbot-component-mirai-core-3.0.0.0-beta.4.jar:na]
    at love.forte.simbot.component.mirai.internal.MiraiBotImpl$start$1.invokeSuspend(MiraiBotImpl.kt) ~[simbot-component-mirai-core-3.0.0.0-beta.4.jar:na]
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[kotlin-stdlib-1.6.21.jar:1.6.21-release-334(1.6.21)]
    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.ResumeAwaitOnCompletion.invoke(JobSupport.kt:1409) ~[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 kotlinx.coroutines.debug.internal.DebugProbesImpl$CoroutineOwner.resumeWith(DebugProbesImpl.kt:545) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) ~[kotlin-stdlib-1.6.21.jar:1.6.21-release-334(1.6.21)]
    at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:33) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
    at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102) ~[kotlinx-coroutines-core-jvm-1.6.4.jar:na]
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) ~[kotlin-stdlib-1.6.21.jar:1.6.21-release-334(1.6.21)]
    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]
Caused by: net.mamoe.mirai.network.WrongPasswordException: Error(bot=Bot(2213121165), code=235, title=温馨提示, message=当前QQ版本过低,请升级至最新版本后再登录。点击进入下载页面, errorInfo= )
    at net.mamoe.mirai.internal.network.components.SsoProcessorImpl$SlowLoginImpl.doLogin(SsoProcessor.kt:309) ~[mirai-core-jvm-2.13.0-RC2.jar:2.13.0-RC2]
    at net.mamoe.mirai.internal.network.components.SsoProcessorImpl$SlowLoginImpl$doLogin$1.invokeSuspend(SsoProcessor.kt) ~[mirai-core-jvm-2.13.0-RC2.jar:2.13.0-RC2]
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[kotlin-stdlib-1.6.21.jar:1.6.21-release-334(1.6.21)]
    ... 8 common frames omitted

Disconnected from the target VM, address: '127.0.0.1:12090', transport: 'socket'

Process finished with exit code -1

其他补充

No response

ForteScarlet commented 1 year ago

我记得 v2.13.0-RC2 需要修改登录协议为 IPAD 或者 ANDROID_PAD 并配置设备信息类型,参考 https://github.com/orgs/simple-robot/discussions/24

jinkaz commented 1 year ago

我记得 v2.13.0-RC2 需要修改登录协议为 IPAD 或者 ANDROID_PAD 并配置设备信息类型,参考 https://github.com/orgs/simple-robot/discussions/24

两个qq号,两个协议都试过了依然是同样的报错。参考其他帖子的办法,比如device.json每次启动都删除,也保持机器人账号手机登录。都不行。。。。

ForteScarlet commented 1 year ago

提供一下你的bot配置文件和pom文件内容

ForteScarlet commented 1 year ago

设备信息配置有没有调整为 file_based 类型

jinkaz commented 1 year ago

bot配置内容: { "component": "simbot.mirai", "code": 123, "password": "xxx", "protocol": "ANDROID_PAD", "config": { "deviceInfo": { "type": "file_based", "file": "device.json", "fromResource": null } } }

jinkaz commented 1 year ago

提供一下你的bot配置文件和pom文件内容

pom 内容: <?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.7.5</version>
</parent>
<groupId>com.example</groupId>
<artifactId>simbottest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>simbottest</name>
<description>simbottest</description>

<properties>
    <java.version>11</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>com.github.jedis-lock</groupId>
        <artifactId>jedis-lock</artifactId>
        <version>1.0.0</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-configuration-processor</artifactId>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>com.github.binarywang</groupId>
        <artifactId>wx-java-mp-spring-boot-starter</artifactId>
        <version>4.4.0</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-redis</artifactId>
    </dependency>

    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>fastjson</artifactId>
        <version>1.2.83</version>
    </dependency>
    <dependency>
        <groupId>cn.hutool</groupId>
        <artifactId>hutool-all</artifactId>
        <version>5.8.3</version>
    </dependency>
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>easyexcel</artifactId>
        <version>3.1.1</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <!-- simbot Spring Boot Starter -->
    <dependency>
        <groupId>love.forte.simbot.boot</groupId>
        <artifactId>simboot-core-spring-boot-starter</artifactId>
        <version>3.0.0-M2</version>
    </dependency>
    <!-- mirai组件 -->
    <dependency>
        <groupId>love.forte.simbot.component</groupId>
        <artifactId>simbot-component-mirai-boot</artifactId>
        <version>3.0.0.0-beta.4</version>
        <exclusions>
            <exclusion>
                <groupId>net.mamoe</groupId>
                <artifactId>mirai-core-jvm</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>net.mamoe</groupId>
        <artifactId>mirai-core-jvm</artifactId>
        <version>2.13.0-RC2</version>
        <exclusions>
            <exclusion>
                <artifactId>kotlinx-serialization-core-jvm</artifactId>
                <groupId>org.jetbrains.kotlinx</groupId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-configuration-processor</artifactId>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <addResources>true</addResources>
                <excludes>
                    <exclude>
                        <groupId>org.projectlombok</groupId>
                        <artifactId>lombok</artifactId>
                    </exclude>
                </excludes>
            </configuration>
        </plugin>
    </plugins>
</build>

ForteScarlet commented 1 year ago

协议配置 protocol 应该在 config

jinkaz commented 1 year ago

协议配置 protocol 应该在 config

这么设置居然登录成功了!!!万分感谢!!!!