解決IDEA中SpringBoot工程無法通過mainApplication啟動
阿新 • • 發佈:2019-01-09
報錯內容
在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.spring[email protected]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.hibernate.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.spring[email protected]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即可