您的位置:首页 > 移动开发

解决IDEA中SpringBoot工程无法通过mainApplication启动

2017-12-27 15:17 645 查看

报错内容

在idea中创建完SpringBoot项目后,通过启动mainApplication不能启动成功报错如下:

.   ____          _            __ _ _
/\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/  ___)| |_)| | | | | || (_| |  ) ) ) )
'  |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot ::        (v1.5.9.RELEASE)

2017-12-27 15:24:31.291  INFO 4584 --- [           main] com.lpl.Springcloud1Application          : Starting Springcloud1Application on lpl-PC with PID 4584 (D:\learn\idea\springcloud-1\target\classes started by lpl in D:\learn\idea\springcloud-1)
2017-12-27 15:24:31.295  INFO 4584 --- [           main] com.lpl.Springcloud1Application          : No active profile set, falling back to default profiles: default
2017-12-27 15:24:31.423  INFO 4584 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@27d415d9: startup date [Wed Dec 27 15:24:31 CST 2017]; root of context hierarchy
2017-12-27 15:24:32.835  WARN 4584 --- [           main] o.h.v.m.ParameterMessageInterpolator     : HV000184: ParameterMessageInterpolator has been chosen, EL interpolation will not be supported
2017-12-27 15:24:33.272  INFO 4584 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executing SQL script from class path resource [schema.sql]
2017-12-27 15:24:33.304  INFO 4584 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executed SQL script from class path resource [schema.sql] in 32 ms.
2017-12-27 15:24:33.306  INFO 4584 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executing SQL script from class path resource [data.sql]
2017-12-27 15:24:33.313  INFO 4584 --- [           main] o.s.jdbc.datasource.init.ScriptUtils     : Executed SQL script from class path resource [data.sql] in 7 ms.
2017-12-27 15:24:33.425  INFO 4584 --- [           main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2017-12-27 15:24:33.529  INFO 4584 --- [           main] o.hibe
c43b
rnate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2017-12-27 15:24:33.597  INFO 4584 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {5.0.12.Final}
2017-12-27 15:24:33.599  INFO 4584 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2017-12-27 15:24:33.600  INFO 4584 --- [           main] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist
2017-12-27 15:24:33.641  INFO 4584 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2017-12-27 15:24:33.753  INFO 4584 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2017-12-27 15:24:34.302  INFO 4584 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2017-12-27 15:24:34.537  WARN 4584 --- [           main] o.h.v.m.ParameterMessageInterpolator     : HV000184: ParameterMessageInterpolator has been chosen, EL interpolation will not be supported
2017-12-27 15:24:34.791  INFO 4584 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2017-12-27 15:24:34.803  INFO 4584 --- [           main] com.lpl.Springcloud1Application          : Started Springcloud1Application in 3.847 seconds (JVM running for 4.389)
2017-12-27 15:24:34.804  INFO 4584 --- [       Thread-3] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@27d415d9: startup date [Wed Dec 27 15:24:31 CST 2017]; root of context hierarchy
2017-12-27 15:24:34.805  INFO 4584 --- [       Thread-3] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown
2017-12-27 15:24:34.805  INFO 4584 --- [       Thread-3] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'

Process finished with exit code 0


解决方法

选择 File -> Project Structure->Modules->Dependencies

找到 tomcat-embed-core 的jar包 作用域默认是provided ,把它改为 compile即可

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: