今天在启动springboot项目突然启动失败,但是在测试日志文件,以为是日志出错,下面这个是logback打印的异常信息。

2019-05-30 15:09:10.686 [restartedMain] INFO com.alibaba.druid.pool.DruidDataSource - {dataSource-2} inited
2019-05-30 15:09:10.831 [restartedMain] INFO com.alibaba.druid.pool.DruidDataSource - {dataSource-2} closed
2019-05-30 15:09:10.833 [restartedMain] INFO org.apache.catalina.core.StandardService - Stopping service [Tomcat]

但其实错误在使用逆向工程时,重复运行导致mapper.xml文件错误。但是logback打印不出这个错误。闪电logback配置文件之后(当然有备份),springboot的默认日志(部分):

2019-05-30 15:19:25.261 INFO 12340 --- [ restartedMain] c.a.d.s.b.a.DruidDataSourceAutoConfigure : Init DruidDataSource
2019-05-30 15:19:25.857 INFO 12340 --- [ restartedMain] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} inited
2019-05-30 15:19:26.369 WARN 12340 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [tk/mybatis/mapper/autoconfigure/MapperAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\java\workspace\dbzx-navigate\target\classes\mapper\TxStudentMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.dbzx.mapper.TxStudentMapper.BaseResultMap
2019-05-30 15:19:26.373 INFO 12340 --- [ restartedMain] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closed
2019-05-30 15:19:26.378 INFO 12340 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2019-05-30 15:19:26.404 INFO 12340 --- [ restartedMain] utoConfigurationReportLoggingInitializer :

看我标红的地方,这就指向很清晰了,后来发现是因为我在logback配置文件中加了:

<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>utf-8</charset>
</encoder>
<!-- 日志级别的配置 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter"><!-- 只打印DEBUG日志 -->
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>

日志的配置过滤掉了这个error级别的日志,所以无法显示。

因为之前也查了百度上关于这个异常的信息,出错的地方各不相同,所以还是要仔细查看日志。

最新文章

  1. ASP.NET Identity入门系列教程(一) 初识Identity
  2. C# 一段绘图代码 在form_load事件不能显示图
  3. 解决Ehcache缓存警告问题
  4. [WP8.1UI控件编程]Windows Phone自定义布局规则
  5. Maven学习笔记-02-Maven项目打包配置与测试
  6. js中的类GET方法
  7. 01.Redis安装
  8. js倒计时 重发 效果
  9. 本地化SilverLight应用程序(多语言支持)
  10. HTML5培训哪里靠谱
  11. JAVA WEB之Spring4.x JdbcTemplate
  12. MinHash 原理
  13. Python量化交易
  14. memge和saveOrUpdate的区别
  15. curl 命令 从文件读取参数
  16. Python笔记(三)继承和多态、动态语言
  17. ip转城市接口,ip转省份接口,ip转城市PHP方法
  18. centos7安装redmine3.4
  19. linux下正则表达式学习
  20. MMCM与PLL

热门文章

  1. 1-PLC基础入门系列(PLC介绍,连接下载说明)
  2. flex布局整理以及demo
  3. vue CSS使用/deep/
  4. 在centos系统的/etc/hosts添加了 当前主机的 ‘ NAT分配的IP controller’,RabbitMQ添加用户报错。
  5. linux shell 写swoole重启脚本
  6. Jmeter之Bean shell使用(二)(转载)
  7. 最小生成树 --- 求最小权值、MST
  8. 射频IC设计的六边形法则
  9. 【转】潜说js对象和数组
  10. Prometheus 基于文件的服务发现