simple-robot / simbot-mirai-demo

原生simbot框架的mirai组件demo。
29 stars 15 forks source link

这个报错不知道为什么qwq 求解惑 #3

Closed h3rrr closed 3 years ago

h3rrr commented 3 years ago

| love.simbot.example.SimbotExampleApplication : Active resources: [simbot.yml] Exception in thread "main" love.forte.common.ioc.exception.NoSuchDependException: interface love.forte.simbot.bot.BotManager at love.forte.common.ioc.DependCenter.get(DependCenter.kt:945) at love.forte.simbot.core.SimbotApp.createSimbotContext(SimbotApp.kt:411) at love.forte.simbot.core.SimbotApp.run$core(SimbotApp.kt:250) at love.forte.simbot.core.SimbotApp$Run.run(SimbotApp.kt:471) at love.forte.simbot.core.SimbotApp$Run.run$default(SimbotApp.kt:434) at love.forte.simbot.core.SimbotApp$Run.run(SimbotApp.kt) at love.forte.simbot.core.SimbotApp.run(SimbotApp.kt) at love.simbot.example.SimbotExampleApplication.main(SimbotExampleApplication.java:36)

运行之后就爆错这个

ForteScarlet commented 3 years ago

是否对代码做了修改? 如果是,提供修改的内容; 如果不是,提供完整日志:从启动到报错的全部 debug 日志

h3rrr commented 3 years ago

ubuntu@VM-4-6-ubuntu:~$ java -jar simbot-mirai-demo.jar

 _           _           _
(_)         | |         | |

_ _ | | __ | | / | | ' ` | ' \ / | | _ \ | | | | | | |) | () | | |__/|| || ||./ _/ \| @ForteScarlet D

Tips: 你知道吗?simbot开发团队一直希望拥有一个活跃的社区。因此它们将文档的团队讨论区定义为社区,并期待着人们的讨论。

[2021-08-08T22:51:38.484201]-[INFO ] | love.simbot.example.SimbotExampleApplication : Active resources: [simbot.yml] Exception in thread "main" love.forte.common.ioc.exception.NoSuchDependException: interface love.forte.simbot.bot.BotManager at love.forte.common.ioc.DependCenter.get(DependCenter.kt:945) at love.forte.simbot.core.SimbotApp.createSimbotContext(SimbotApp.kt:411) at love.forte.simbot.core.SimbotApp.run$core(SimbotApp.kt:250) at love.forte.simbot.core.SimbotApp$Run.run(SimbotApp.kt:471) at love.forte.simbot.core.SimbotApp$Run.run$default(SimbotApp.kt:434) at love.forte.simbot.core.SimbotApp$Run.run(SimbotApp.kt) at love.forte.simbot.core.SimbotApp.run(SimbotApp.kt) at love.simbot.example.SimbotExampleApplication.main(SimbotExampleApplication.java:36)

没有对代码进行修改除了我写的部分以外,其他部分没有改变

ForteScarlet commented 3 years ago

不打包,直接通过IDE启动会出现错误吗?如果不会,参考文档 打包

h3rrr commented 3 years ago

不打包的话启动是没有问题的,但是关于打包这一步我不是特别能看懂qwq,我将打包的内容放在了pom.xml之后一直出现报错 M17C}M10KJA02S ~PCUD22V

h3rrr commented 3 years ago

请问一下大大 这个怎么解决呀qwq 麻烦大大了

ForteScarlet commented 3 years ago
<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <!-- main方法所在类。 -->
                    <mainClass>simbot.example.SimbotExampleApplication</mainClass>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

其中 <mainClass>simbot.example.SimbotExampleApplication</mainClass> 的内容替换为你的main方法所在类的全限定路径,然后使用 mvn package 命令或者idea右侧maven工具栏中 Lifecycle -> package 进行打包

h3rrr commented 3 years ago

为什么我无论将这一段放在哪 都会出现报错呢呜呜

ForteScarlet commented 3 years ago

https://github.com/simple-robot/simbot-mirai-demo/blob/master/pom.xml

h3rrr commented 3 years ago

对不起对不起大大 我真的不知道为什么报错qwq 我按照你给的样式放上去 结果还是出现了报错 对不起对不起 又要麻烦你了qwq555 274XT_Q)GAFK2HXNXYETG5J

h3rrr commented 3 years ago

ZAX ~$~_9M`ATX`ZP%_T6U9 报错是这样的

ForteScarlet commented 3 years ago

提供完整的pom文件内容

h3rrr 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
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>11</source>
                <target>11</target>
            </configuration>
        </plugin>
    </plugins>
</build>
<!-- 使用simbot的parent -->
<parent>
    <groupId>love.forte.simple-robot</groupId>
    <artifactId>parent</artifactId>
    <version>2.1.1</version><!--vv-->
</parent>

<groupId>simbot.example</groupId>
<artifactId>simbot-mirai-demo</artifactId>

<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>

    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
        <version>4.4.8</version>
    </dependency>

    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.5.3</version>
    </dependency>

    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.11</version>
        <scope>test</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/link.zhangfei/zson -->
    <dependency>
        <groupId>link.zhangfei</groupId>
        <artifactId>zson</artifactId>
        <version>1.1</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.8.1</version>
    </dependency>

    <dependency>
        <groupId>redis.clients</groupId>
        <artifactId>jedis</artifactId>
        <version>3.6.1</version>
    </dependency>

    <dependency>
        <groupId>redis.clients</groupId>
        <artifactId>jedis</artifactId>
        <version>3.3.0</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.15</version>
    </dependency>
</dependencies>

h3rrr commented 3 years ago

这是没有添加大大给我的那一段的时候的pom

ForteScarlet commented 3 years ago

你在最上面有一个 build 标签了。

h3rrr commented 3 years ago

那我这个是需要怎么添加进去呢qwq Java小白

ForteScarlet commented 3 years ago

build - plugins 里面不是有 plugin 标签吗,把所有plugin标签都放在 build - plugins

h3rrr commented 3 years ago

谢谢大大,我成功的在pom里添加了 但是在服务器上运行的时候还是报错了qwq,一样的报错 LSN 59QV({%2X50X9U2TFY8

ForteScarlet commented 3 years ago

是通过maven打包的吗

h3rrr commented 3 years ago

是直接通过IDEA里面的这个打包的 %ZK03{X@0K9OWDZ3JXW{IH7

ForteScarlet commented 3 years ago
<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <!-- main方法所在类。 -->
                    <mainClass>simbot.example.SimbotExampleApplication</mainClass>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

其中 <mainClass>simbot.example.SimbotExampleApplication</mainClass> 的内容替换为你的main方法所在类的全限定路径,然后使用 mvn package 命令或者idea右侧maven工具栏中 Lifecycle -> package 进行打包

我上面说了,用maven打包

h3rrr commented 3 years ago

啊啊啊 对不起对不起 我没有注意到 我从新试一下

h3rrr commented 3 years ago

qwq 谢谢谢谢大大 真的谢谢大大 成功了 大大早点睡觉呀!!!