启动springboot报错 Application run failed

在启动springboot项目通过实体类自动生成表时,报如下错误:

2019-06-11 10:06:44.673 [main] INFO  com.zyb.blog.CoreApplication - Starting CoreApplication on MicroWin10-1550 with PID 5520 (C:\Users\Administrator\workspace\boot-solo\target\classes started by Administrator in C:\Users\Administrator\workspace\boot-solo)
2019-06-11 10:06:44.675 [main] DEBUG com.zyb.blog.CoreApplication - Running with Spring Boot v2.0.3.RELEASE, Spring v5.0.7.RELEASE
2019-06-11 10:06:44.676 [main] INFO  com.zyb.blog.CoreApplication - No active profile set, falling back to default profiles: default
2019-06-11 10:06:45.370 [main] DEBUG org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration - Searching for mappers annotated with @Mapper
2019-06-11 10:06:45.373 [main] DEBUG org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration - Using auto-configuration base package 'com.zyb.blog'
2019-06-11 10:06:45.382 [main] DEBUG org.mybatis.spring.mapper.ClassPathMapperScanner - Identified candidate component class: file [C:\Users\Administrator\workspace\boot-solo\target\classes\com\zyb\blog\mapper\CategoryMapper.class]
2019-06-11 10:06:45.383 [main] DEBUG org.mybatis.spring.mapper.ClassPathMapperScanner - Creating MapperFactoryBean with name 'categoryMapper' and 'com.zyb.blog.mapper.CategoryMapper' mapperInterface
2019-06-11 10:06:45.384 [main] DEBUG org.mybatis.spring.mapper.ClassPathMapperScanner - Enabling autowire by type for MapperFactoryBean with name 'categoryMapper'.
2019-06-11 10:06:45.582 [main] DEBUG org.mybatis.spring.mapper.ClassPathMapperScanner - Identified candidate component class: URL [jar:file:/C:/Users/Administrator/.m2/repository/com/gitee/sunchenbin/mybatis/actable/mybatis-enhance-actable/1.0.1/mybatis-enhance-actable-1.0.1.jar!/com/gitee/sunchenbin/mybatis/actable/dao/common/BaseMysqlCRUDMapper.class]
2019-06-11 10:06:45.583 [main] DEBUG org.mybatis.spring.mapper.ClassPathMapperScanner - Identified candidate component class: URL [jar:file:/C:/Users/Administrator/.m2/repository/com/gitee/sunchenbin/mybatis/actable/mybatis-enhance-actable/1.0.1/mybatis-enhance-actable-1.0.1.jar!/com/gitee/sunchenbin/mybatis/actable/dao/system/CreateMysqlTablesMapper.class]
2019-06-11 10:06:45.584 [main] DEBUG org.mybatis.spring.mapper.ClassPathMapperScanner - Creating MapperFactoryBean with name 'baseMysqlCRUDMapper' and 'com.gitee.sunchenbin.mybatis.actable.dao.common.BaseMysqlCRUDMapper' mapperInterface
2019-06-11 10:06:45.584 [main] DEBUG org.mybatis.spring.mapper.ClassPathMapperScanner - Creating MapperFactoryBean with name 'createMysqlTablesMapper' and 'com.gitee.sunchenbin.mybatis.actable.dao.system.CreateMysqlTablesMapper' mapperInterface
2019-06-11 10:06:45.585 [main] WARN  org.springframework.context.annotation.ConfigurationClassPostProcessor - Cannot enhance @Configuration bean definition 'myBatisMapperScannerConfig' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
2019-06-11 10:06:46.314 [main] DEBUG org.mybatis.spring.SqlSessionFactoryBean - Property 'configuration' or 'configLocation' not specified, using default MyBatis Configuration
2019-06-11 10:06:46.390 [main] DEBUG org.mybatis.spring.SqlSessionFactoryBean - Scanned package: 'com.zyb.blog.entity.*' for aliases
2019-06-11 10:06:46.519 [main] DEBUG org.mybatis.spring.SqlSessionFactoryBean - Parsed mapper file: 'URL [jar:file:/C:/Users/Administrator/.m2/repository/com/gitee/sunchenbin/mybatis/actable/mybatis-enhance-actable/1.0.1/mybatis-enhance-actable-1.0.1.jar!/com/gitee/sunchenbin/mybatis/actable/mapping/common/BaseMysqlCRUDMapper.xml]'
2019-06-11 10:06:46.712 [main] DEBUG org.mybatis.spring.SqlSessionFactoryBean - Parsed mapper file: 'URL [jar:file:/C:/Users/Administrator/.m2/repository/com/gitee/sunchenbin/mybatis/actable/mybatis-enhance-actable/1.0.1/mybatis-enhance-actable-1.0.1.jar!/com/gitee/sunchenbin/mybatis/actable/mapping/system/CreateMysqlTablesMapper.xml]'
2019-06-11 10:06:46.909 [main] INFO  com.gitee.sunchenbin.mybatis.actable.manager.handler.StartUpHandlerImpl - databaseType=mysql,开始执行mysql的处理方法
2019-06-11 10:06:47.362 [main] INFO  com.alibaba.druid.pool.DruidDataSource - {dataSource-1} inited
file类型的扫描
2019-06-11 10:06:47.399 [main] WARN  org.springframework.context.annotation.AnnotationConfigApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'startUpHandlerImpl': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/lang/ArrayUtils
2019-06-11 10:06:47.406 [main] INFO  com.alibaba.druid.pool.DruidDataSource - {dataSource-1} closed
2019-06-11 10:06:47.427 [main] ERROR org.springframework.boot.SpringApplication - Application run failed

 

关键点看报错最终原因:

Error creating bean with name 'startUpHandlerImpl': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/lang/ArrayUtils

到项目里找一下是否缺少了有关org.apache.commmons的JAR包,如果找不到如下图: 

就引入改Jar包:

<dependency>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <version>2.4</version>
            <classifier>jdk15</classifier>
            <exclusions>
                <exclusion>
                    <artifactId>commons-logging</artifactId>
                    <groupId>commons-logging</groupId>
                </exclusion>
            </exclusions>
        </dependency>
 

 

这就不会报错了,从新启动即可。

注意:我这里不需要引入日志包,故排除了logging 

 

转载请注明出处。

转载:http://javasourceshare.cn/article/11

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值