product项目启动报错org.springframework.boot.web.context.WebServerInitializedEvent

来源:4-7 商品服务编码(下)

Kelvin_Song

2019-12-11

java.lang.ClassCastException: org.springframework.boot.context.event.ApplicationFailedEvent cannot be cast to org.springframework.boot.web.context.WebServerInitializedEvent
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:157) [spring-context-5.0.0.RC2.jar:5.0.0.RC2]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:137) [spring-context-5.0.0.RC2.jar:5.0.0.RC2]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:125) [spring-context-5.0.0.RC2.jar:5.0.0.RC2]
at org.springframework.boot.context.event.EventPublishingRunListener.finished(EventPublishingRunListener.java:114) [spring-boot-2.0.0.M3.jar:2.0.0.M3]
at org.springframework.boot.SpringApplicationRunListeners.callFinishedListener(SpringApplicationRunListeners.java:79) [spring-boot-2.0.0.M3.jar:2.0.0.M3]
at org.springframework.boot.SpringApplicationRunListeners.finished(SpringApplicationRunListeners.java:72) [spring-boot-2.0.0.M3.jar:2.0.0.M3]
at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:803) [spring-boot-2.0.0.M3.jar:2.0.0.M3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) [spring-boot-2.0.0.M3.jar:2.0.0.M3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1245) [spring-boot-2.0.0.M3.jar:2.0.0.M3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1233) [spring-boot-2.0.0.M3.jar:2.0.0.M3]
at com.imooc.product.ProductApplication.main(ProductApplication.java:13) [classes/:na]

2019-12-11 19:15:05.553 INFO 8212 — [ main] utoConfigurationReportLoggingInitializer :

Error starting ApplicationContext. To display the auto-configuration report re-run your application with ‘debug’ enabled.
2019-12-11 19:15:05.564 ERROR 8212 — [ main] o.s.boot.SpringApplication : Application startup failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘entityManagerFactory’ defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1716) ~[spring-beans-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:499) ~[spring-beans-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312) ~[spring-beans-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) ~[spring-beans-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1075) ~[spring-context-5.0.0.RC2.jar:5.0.0.RC2]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:851) ~[spring-context-5.0.0.RC2.jar:5.0.0.RC2]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) ~[spring-context-5.0.0.RC2.jar:5.0.0.RC2]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:122) ~[spring-boot-2.0.0.M3.jar:2.0.0.M3]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.0.0.M3.jar:2.0.0.M3]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) [spring-boot-2.0.0.M3.jar:2.0.0.M3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.0.M3.jar:2.0.0.M3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1245) [spring-boot-2.0.0.M3.jar:2.0.0.M3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1233) [spring-boot-2.0.0.M3.jar:2.0.0.M3]
at com.imooc.product.ProductApplication.main(ProductApplication.java:13) [classes/:na]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:967) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:892) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:57) ~[spring-orm-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:358) ~[spring-orm-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:384) ~[spring-orm-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:373) ~[spring-orm-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1776) ~[spring-beans-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1712) ~[spring-beans-5.0.0.RC3.jar:5.0.0.RC3]
… 16 common frames omitted
Caused by: org.hibernate.MappingException: Could not determine type for: lombok.Data, at table: product_category, for columns: [org.hibernate.mapping.Column(create_time)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:455) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:422) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.hibernate.mapping.Property.isValid(Property.java:226) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:597) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.hibernate.mapping.RootClass.validate(RootClass.java:265) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.hibernate.boot.internal.MetadataImpl.validate(MetadataImpl.java:329) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:451) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:889) ~[hibernate-core-5.2.10.Final.jar:5.2.10.Final]
… 22 common frames omitted

Disconnected from the target VM, address: ‘127.0.0.1:52664’, transport: ‘socket’

Process finished with exit code 1

请大佬看一下问题出现在哪里。

git@github.com:xiaowenqing/spring-cloud.git

写回答

1回答

廖师兄

2019-12-11

以后错误要格式化,不然看不清楚。

错误原因在这里

Caused by: org.hibernate.MappingException: Could not determine type for: lombok.Data, at table: product_category, for columns: [org.hibernate.mapping.Column(create_time)]

检查数据库和实体类

0
3
廖师兄
回复
Kelvin_Song
private Data createTime; 大哥。。。是date 不是 data。。。
2019-12-13
共3条回复

SpringCloud Finchley(M2+RELEASE+SR2)微服务实战

SpringCloud组件实现微服务,【已升级Finchley.Release】

5672 学习 · 2489 问题

查看课程