启动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包:


            net.sf.json-lib
            json-lib
            2.4
            jdk15
            
                
                    commons-logging
                    commons-logging
                

            

        

 

 

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

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

 

转载请注明出处。

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

你可能感兴趣的:(启动springboot报错 Application run failed)