时间的法外狂徒

导航

org.apache.catalina.core.StandardService - Stopping service [Tomcat]

今天在启动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级别的日志,所以无法显示。

 

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

posted on 2019-05-30 15:23  抄手砚  阅读(6113)  评论(0编辑  收藏  举报