我有一个非常简单的Spring Boot 1.3应用程序,我正在尝试升级到1.4 RC1.没有什么不是开箱即用的配置.当我尝试启动应用程序或运行测试时,我得到以下内容:
12:06:27.237 [QUIET] [system.out] 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 java.lang.AbstractMethodError
12:06:27.237 [QUIET] [system.out] at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.initializeBean(AbstractAutowireCapablebeanfactory.java:1578) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
12:06:27.237 [QUIET] [system.out] at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.doCreateBean(AbstractAutowireCapablebeanfactory.java:545) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
12:06:27.237 [QUIET] [system.out] at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.createBean(AbstractAutowireCapablebeanfactory.java:482) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
12:06:27.237 [QUIET] [system.out] at org.springframework.beans.factory.support.Abstractbeanfactory$1.getobject(Abstractbeanfactory.java:306) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
12:06:27.237 [QUIET] [system.out] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
12:06:27.238 [QUIET] [system.out] at org.springframework.beans.factory.support.Abstractbeanfactory.doGetBean(Abstractbeanfactory.java:302) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
12:06:27.238 [QUIET] [system.out] at org.springframework.beans.factory.support.Abstractbeanfactory.getBean(Abstractbeanfactory.java:197) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
12:06:27.238 [QUIET] [system.out] at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1076) ~[spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE]
12:06:27.238 [QUIET] [system.out] at org.springframework.context.support.AbstractApplicationContext.finishbeanfactoryInitialization(AbstractApplicationContext.java:851) ~[spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE]
12:06:27.238 [QUIET] [system.out] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) ~[spring-context-4.3.1.RELEASE.jar:4.3.1.RELEASE]
12:06:27.238 [QUIET] [system.out] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.0.RC1.jar:1.4.0.RC1]
12:06:27.238 [QUIET] [system.out] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-1.4.0.RC1.jar:1.4.0.RC1]
12:06:27.238 [QUIET] [system.out] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369) [spring-boot-1.4.0.RC1.jar:1.4.0.RC1]
12:06:27.238 [QUIET] [system.out] at org.springframework.boot.SpringApplication.run(SpringApplication.java:313) [spring-boot-1.4.0.RC1.jar:1.4.0.RC1]
12:06:27.238 [QUIET] [system.out] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185) [spring-boot-1.4.0.RC1.jar:1.4.0.RC1]
12:06:27.238 [QUIET] [system.out] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174) [spring-boot-1.4.0.RC1.jar:1.4.0.RC1]
12:06:27.239 [QUIET] [system.out] at com.hightouchinc.notifications.NotificationsApplication.main(NotificationsApplication.java:17) [main/:na]
12:06:27.239 [QUIET] [system.out] Caused by: java.lang.AbstractMethodError: null
12:06:27.239 [QUIET] [system.out] at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:278) ~[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
12:06:27.239 [QUIET] [system.out] at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) ~[hibernate-core-5.0.9.Final.jar:5.0.9.Final]
12:06:27.239 [QUIET] [system.out] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:879) ~[hibernate-entitymanager-5.0.9.Final.jar:5.0.9.Final]
12:06:27.239 [QUIET] [system.out] at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60) ~[spring-orm-4.3.1.RELEASE.jar:4.3.1.RELEASE]
12:06:27.239 [QUIET] [system.out] at org.springframework.orm.jpa.LocalContainerEntityManagerfactorybean.createNativeEntityManagerFactory(LocalContainerEntityManagerfactorybean.java:338) ~[spring-orm-4.3.1.RELEASE.jar:4.3.1.RELEASE]
12:06:27.239 [QUIET] [system.out] at org.springframework.orm.jpa.AbstractEntityManagerfactorybean.buildNativeEntityManagerFactory(AbstractEntityManagerfactorybean.java:373) ~[spring-orm-4.3.1.RELEASE.jar:4.3.1.RELEASE]
12:06:27.239 [QUIET] [system.out] at org.springframework.orm.jpa.AbstractEntityManagerfactorybean.afterPropertiesSet(AbstractEntityManagerfactorybean.java:362) ~[spring-orm-4.3.1.RELEASE.jar:4.3.1.RELEASE]
12:06:27.239 [QUIET] [system.out] at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.invokeInitMethods(AbstractAutowireCapablebeanfactory.java:1637) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
12:06:27.239 [QUIET] [system.out] at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.initializeBean(AbstractAutowireCapablebeanfactory.java:1574) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
12:06:27.240 [QUIET] [system.out] ... 16 common frames omitted
我的入口点类看起来像这样:
@SpringBootApplication
public class NotificationsApplication {
public static void main(String[] args) {
SpringApplication.run(NotificationsApplication.class, args);
}
}
我的数据库配置如下所示:
spring:
datasource:
url: jdbc:postgresql://localhost:5432/notifications
username: ----
password: ----
driverClassName: org.postgresql.Driver
jpa:
properties:
hibernate:
format_sql: true
database-platform: org.hibernate.dialect.PostgresqlDialect
hibernate:
ddl-auto: create-drop
generate-ddl: true
我已经阅读了1.4里程碑和RC1的所有更改日志,我找不到任何暗示我已经改变的东西,导致它无法启动.
build.gradle的依赖关系:
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework:spring-tx')
compile('javax.el:javax.el-api:3.0.0')
compile('com.google.guava:guava:19.0')
compile('com.fasterxml.jackson.datatype:jackson-datatype-hibernate5:2.8.1')
compile("com.fasterxml.jackson.datatype:jackson-datatype-joda:2.7.5")
compile('joda-time:joda-time:2.9.4')
compile('org.jadira.usertype:usertype.core:4.0.0.GA')
compile('com.h2database:h2')
runtime('org.postgresql:postgresql:9.4.1208')
testCompile('junit:junit')
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('com.jayway.jsonpath:json-path')
}
解决方法:
我认为问题是这种依赖:
compile('org.jadira.usertype:usertype.core:4.0.0.GA')
它包含3个实现org.hibernate.integrator.spi.Integrator的类:
> UserTypeJodaTimeHibernateIntegrator
> UserTypeJodamoneyHibernateIntegrator
> UserTypeLegacyJdkMoneyHibernateIntegrator
Jadira contains a change的5.0.0.GA版本“修复了Hibernate 5下的集成器行为”,所以它看起来像升级将解决问题:
compile('org.jadira.usertype:usertype.core:5.0.0.GA')
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。