skyrocketingHong / FuyaoBot

A QQ bot bases on Mirai, Spring Boot, MySQL and Mybatis Plus.
https://github.com/skyrocketingHong/FuyaoBot
GNU Affero General Public License v3.0
28 stars 2 forks source link

请问如何打包使用? #3

Open NealLemonade opened 1 year ago

NealLemonade commented 1 year ago

使用了IDEA内置的MAVEN工具构建,然而启动后闪一段文字后闪退

NealLemonade commented 1 year ago

打扰大佬了!

NealLemonade commented 1 year ago

2023-01-16 01:43:12.345 INFO 308 --- [ main] n.s.fuyao.FuyaoBotApplication : Starting FuyaoBotApplication v4.5.20.86 using Java 17.0.5 on Lemonsuda with PID 308 (E:\TestBot\uyao\fuyao-bot-4.5.20.86.jar started by Neal in E:\TestBot\uyao) 2023-01-16 01:43:12.347 INFO 308 --- [ main] n.s.fuyao.FuyaoBotApplication : The following 1 profile is active: "dev" 2023-01-16 01:43:13.044 INFO 308 --- [ main] c.a.d.s.b.a.DruidDataSourceAutoConfigure : Init DruidDataSource 2023-01-16 01:43:13.163 WARN 308 --- [ main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'miraiBotConfig' defined in URL [jar:file:/E:/TestBot/uyao/fuyao-bot-4.5.20.86.jar!/BOOT-INF/classes!/ninja/skyrocketing/fuyao/bot/config/MiraiBotConfig.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'botConfigServiceImpl' defined in URL [jar:file:/E:/TestBot/uyao/fuyao-bot-4.5.20.86.jar!/BOOT-INF/classes!/ninja/skyrocketing/fuyao/bot/service/impl/bot/BotConfigServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'botConfigMapper' defined in URL [jar:file:/E:/TestBot/uyao/fuyao-bot-4.5.20.86.jar!/BOOT-INF/classes!/ninja/skyrocketing/fuyao/bot/mapper/bot/BotConfigMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [com/alibaba/druid/spring/boot/autoconfigure/DruidDataSourceAutoConfigure.class]: Invocation of init method failed; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine suitable jdbc url 2023-01-16 01:43:13.169 INFO 308 --- [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2023-01-16 01:43:13.197 ERROR 308 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine suitable jdbc url

Action:

Consider the following: If you want an embedded database (H2, HSQL or Derby), please put it on the classpath. If you have database settings to be loaded from a particular profile you may need to activate it (the profiles dev are currently active).

NealLemonade commented 1 year ago

如果方便的话希望大佬更新到mirai 2.13.3 感激不尽

skyrocketingHong commented 1 year ago

@NealLemonade 你建了数据库没?

NealLemonade commented 1 year ago

Reference in ne

后来有摸索着糊里糊涂建了一个但还是报错

NealLemonade commented 1 year ago

@NealLemonade 你建了数据库没?

是不是要去改Application-dev.yml啊,我改了以后还是报错,感觉可能是没改对

NealLemonade commented 1 year ago

@NealLemonade 你建了数据库没?

2023-01-16 12:54:53.570 WARN 29464 --- [ main] c.b.m.core.metadata.TableInfoHelper : Can not find table primary key in Class: "ninja.skyrocketing.fuyao.bot.pojo.group.GroupMemberMessageCount". 2023-01-16 12:54:53.570 WARN 29464 --- [ main] c.b.m.core.injector.DefaultSqlInjector : class ninja.skyrocketing.fuyao.bot.pojo.group.GroupMemberMessageCount ,Not found @TableId annotation, Cannot use Mybatis-Plus 'xxById' Method. 2023-01-16 12:54:53.571 WARN 29464 --- [ main] c.b.m.core.injector.AbstractMethod : [ninja.skyrocketing.fuyao.bot.mapper.group.GroupMemberMessageCountMapper.insert] Has been loaded by XML or SqlProvider or Mybatis's Annotation, so ignoring this injection for [class com.baomidou.mybatisplus.core.injector.methods.Insert] 2023-01-16 12:54:53.573 WARN 29464 --- [ main] c.b.m.core.injector.AbstractMethod : [ninja.skyrocketing.fuyao.bot.mapper.group.GroupMemberMessageCountMapper.update] Has been loaded by XML or SqlProvider or Mybatis's Annotation, so ignoring this injection for [class com.baomidou.mybatisplus.core.injector.methods.Update] 2023-01-16 12:54:53.740 WARN 29464 --- [ main] c.b.m.core.metadata.TableInfoHelper : Can not find table primary key in Class: "ninja.skyrocketing.fuyao.bot.pojo.group.GroupFunctionSettings". 2023-01-16 12:54:53.741 WARN 29464 --- [ main] c.b.m.core.injector.DefaultSqlInjector : class ninja.skyrocketing.fuyao.bot.pojo.group.GroupFunctionSettings ,Not found @TableId annotation, Cannot use Mybatis-Plus 'xxById' Method. 2023-01-16 12:54:53.830 WARN 29464 --- [ main] c.b.m.core.metadata.TableInfoHelper : Can not find table primary key in Class: "ninja.skyrocketing.fuyao.bot.mapper.user.UserCoinMapper". 2023-01-16 12:54:53.830 WARN 29464 --- [ main] c.b.m.core.injector.DefaultSqlInjector : interface ninja.skyrocketing.fuyao.bot.mapper.user.UserCoinMapper ,Not found @TableId annotation, Cannot use Mybatis-Plus 'xxById' Method. 2023-01-16 12:54:53.874 INFO 29464 --- [ main] n.s.fuyao.FuyaoBotApplication : Started FuyaoBotApplication in 1.962 seconds (JVM running for 2.378) 2023-01-16 12:54:54.152 DEBUG 29464 --- [ main] n.s.f.b.m.b.BotConfigMapper.selectById : ==> Preparing: SELECT config_name,config_value,add_date FROM bot_config WHERE config_name=? 2023-01-16 12:54:54.167 DEBUG 29464 --- [ main] n.s.f.b.m.b.BotConfigMapper.selectById : ==> Parameters: qq_id(String) 2023-01-16 12:54:54.177 DEBUG 29464 --- [ main] n.s.f.b.m.b.BotConfigMapper.selectById : <== Total: 0 2023-01-16 12:54:54.180 INFO 29464 --- [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2023-01-16 12:54:54.206 ERROR 29464 --- [ main] o.s.boot.SpringApplication : Application run failed

java.lang.IllegalStateException: Failed to execute CommandLineRunner at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:774) ~[spring-boot-2.7.5.jar!/:2.7.5] at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:755) ~[spring-boot-2.7.5.jar!/:2.7.5] at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.7.5.jar!/:2.7.5] at ninja.skyrocketing.fuyao.FuyaoBotApplication.main(FuyaoBotApplication.java:38) ~[classes!/:4.5.20.86] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[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:568) ~[na:na] at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[fuyao-bot-4.5.20.86.jar:4.5.20.86] at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) ~[fuyao-bot-4.5.20.86.jar:4.5.20.86] at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[fuyao-bot-4.5.20.86.jar:4.5.20.86] at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) ~[fuyao-bot-4.5.20.86.jar:4.5.20.86] Caused by: java.lang.NullPointerException: Cannot invoke "ninja.skyrocketing.fuyao.bot.pojo.bot.BotConfig.getConfigValue()" because the return value of "ninja.skyrocketing.fuyao.bot.mapper.bot.BotConfigMapper.selectById(java.io.Serializable)" is null at ninja.skyrocketing.fuyao.bot.service.impl.bot.BotConfigServiceImpl.getConfigValueByKey(BotConfigServiceImpl.java:29) ~[classes!/:4.5.20.86] at ninja.skyrocketing.fuyao.bot.config.MiraiBotConfig.runBot(MiraiBotConfig.java:44) ~[classes!/:4.5.20.86] at ninja.skyrocketing.fuyao.FuyaoBotApplication.run(FuyaoBotApplication.java:47) ~[classes!/:4.5.20.86] at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:771) ~[spring-boot-2.7.5.jar!/:2.7.5] ... 11 common frames omitted

2023-01-16 12:54:54.209 INFO 29464 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closing ... 2023-01-16 12:54:54.211 INFO 29464 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closed

鼓捣了一通以后这样,实在尽力了