- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我们使用 Spring ORM 4.2.1.RELEASE 通过 JPA 与 Hibernate 进行交互。 Hibernate 4.3.11.Final 一切正常,但是当我们尝试升级到 Hibernate 5 时,它在构造 SessionFactory 时出现 AbstractMethodError 中断。
根据发行说明,Spring 4.2.1 确实支持 Hibernate 5。检查 Maven 依赖关系树没有显示任何重复或过时的 Hibernate 或 Spring 版本。报告的特定行(https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java 第 278 行)正在迭代 Hibernate 积分器,但我们不使用任何积分器,因此积分器列表在逻辑上应该为空(因此不能迭代)。
有谁知道这是 Spring 中的错误(或缺乏支持),还是我们做错了什么?
从应用程序日志中提取:
2015-09-08 13:17:45,452 [main] INFO org.springframework.test.context.support.DefaultTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@20f0461e, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@7e8b6c76, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@737df7e1, org.springframework.test.context.support.DirtiesContextTestExecutionListener@531d1003, org.springframework.test.context.transaction.TransactionalTestExecutionListener@19065f96, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@716d7daf]
2015-09-08 13:17:45,460 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [dataContext.xml]
2015-09-08 13:17:45,689 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [systemContext.xml]
2015-09-08 13:17:45,779 [main] INFO org.springframework.context.support.GenericApplicationContext - Refreshing org.springframework.context.support.GenericApplicationContext@4b56a656: startup date [Tue Sep 08 13:17:45 AEST 2015]; root of context hierarchy
2015-09-08 13:17:45,846 [main] INFO org.springframework.context.support.PropertySourcesPlaceholderConfigurer - Loading properties file from class path resource [application.properties]
2015-09-08 13:17:45,900 [MLog-Init-Reporter] INFO com.mchange.v2.log.MLog - MLog clients using slf4j logging.
2015-09-08 13:17:45,921 [main] INFO com.mchange.v2.c3p0.C3P0Registry - Initializing c3p0-0.9.5.1 [built 16-June-2015 00:06:36 -0700; debug? true; trace: 10]
2015-09-08 13:17:46,046 [main] INFO org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean - Building JPA container EntityManagerFactory for persistence unit 'default'
2015-09-08 13:17:46,060 [main] INFO org.hibernate.jpa.internal.util.LogHelper - HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2015-09-08 13:17:46,136 [main] INFO org.hibernate.Version - HHH000412: Hibernate Core {5.0.1.Final}
2015-09-08 13:17:46,137 [main] INFO org.hibernate.cfg.Environment - HHH000206: hibernate.properties not found
2015-09-08 13:17:46,138 [main] INFO org.hibernate.cfg.Environment - HHH000021: Bytecode provider name : javassist
2015-09-08 13:17:46,166 [main] INFO org.hibernate.annotations.common.Version - HCANN000001: Hibernate Commons Annotations {5.0.0.Final}
2015-09-08 13:17:46,274 [main] INFO com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource - Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> z8kfsx9b1bfny2k11h75wx|4aa092d5, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> org.hsqldb.jdbcDriver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> z8kfsx9b1bfny2k11h75wx|4aa092d5, idleConnectionTestPeriod -> 30, initialPoolSize -> 3, jdbcUrl -> jdbc:hsqldb:mem:testDB, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 15, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> true, testConnectionOnCheckout -> true, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
2015-09-08 13:17:46,396 [main] INFO org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect
2015-09-08 13:17:46,429 [main] INFO org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl - HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
2015-09-08 13:17:46,592 [main] WARN org.springframework.context.support.GenericApplicationContext - Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [dataContext.xml]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) ~[spring-beans-4.2.1.RELEASE.jar:4.2.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-4.2.1.RELEASE.jar:4.2.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.1.RELEASE.jar:4.2.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305) ~[spring-beans-4.2.1.RELEASE.jar:4.2.1.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.1.RELEASE.jar:4.2.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301) ~[spring-beans-4.2.1.RELEASE.jar:4.2.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196) ~[spring-beans-4.2.1.RELEASE.jar:4.2.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1045) ~[spring-context-4.2.1.RELEASE.jar:4.2.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:824) ~[spring-context-4.2.1.RELEASE.jar:4.2.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537) [spring-context-4.2.1.RELEASE.jar:4.2.1.RELEASE]
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:125) [spring-test-4.2.1.RELEASE.jar:4.2.1.RELEASE]
... rows deleted
Caused by: java.lang.AbstractMethodError
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:278) ~[hibernate-core-5.0.1.Final.jar:5.0.1.Final]
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) ~[hibernate-core-5.0.1.Final.jar:5.0.1.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:802) ~[hibernate-entitymanager-5.0.1.Final.jar:5.0.1.Final]
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60) ~[spring-orm-4.2.1.RELEASE.jar:4.2.1.RELEASE]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343) ~[spring-orm-4.2.1.RELEASE.jar:4.2.1.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318) ~[spring-orm-4.2.1.RELEASE.jar:4.2.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) ~[spring-beans-4.2.1.RELEASE.jar:4.2.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ~[spring-beans-4.2.1.RELEASE.jar:4.2.1.RELEASE]
... 41 more
从 Spring 上下文中提取:
<bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"/>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="jpaVendorAdapter" ref="jpaVendorAdapter"/>
<property name="packagesToScan" value="au.gov.qld.ssq.cofa.domain"/>
<property name="jpaPropertyMap">
<map>
<entry key="hibernate.dialect" value="${hibernate.dialect}"/>
<entry key="hibernate.show_sql" value="${hibernate.show_sql}"/>
<entry key="hibernate.hbm2ddl.auto" value="${hibernate.hbm2ddl.auto}"/>
</map>
</property>
</bean>
最佳答案
此错误与 Spring 无关。您有一个不兼容的 Hibernate 5 Integrator在你的类路径中。这些是通过 ServiceRegistry 检测到的。
一个常见问题是 Jadira Usertype 的旧版本这与 Hibernate 5 不兼容。如果您的类路径中有 5.0.0 版本之前的 Jadira 用户类型,您将收到此异常。如果您不是这种情况,并且您不确定哪个库有问题,请设置断点 on line 278 of SessionFactoryImpl并检查导致异常的 Integrator 的类。
关于java - 升级到 Hibernate 5 时 SessionFactoryImpl 中的 AbstractMethodError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32448957/
我有一个使用 Spring 3.0.5、JPA2 和 Hibernate 3.6.7 的应用程序。 Maven 处理我的依赖管理。这是一个 pom 摘录: 3.0.5.RELEASE
我对配备 jboss 开发工作室的 Eclipse IDE (Juno RE 2) 有问题。我有几个使用 JPA 的 Maven 项目。在这些项目中,Eclipse 报错“ 此项目具有 JPA 方面,
我正在尝试使用 java 代码向 postgres 插入一个数组,但我总是收到此错误: SEVERE [http-nio-8080-exec-2]org.apache.catalina.core.St
让我首先总结一下我到底想做什么。基本上,我使用 JavaCompiler 包在运行时编译一个扩展我的父类(super class)“Player”的类。我唯一知道的是,它将在子类中扩展 Player
我的电脑中的 Web 服务程序出现错误,但相同的代码在其他电脑上运行正常。有什么解决办法吗? SEVERE: Servlet.service() for servlet [ServletAdaptor
当我在 ant 中运行 junit 测试时出现以下错误。测试类需要调用web service API。 有人可以帮忙解决吗? java.lang.AbstractMethodError: javax.
我刚刚尝试关注 this为我的 Web 服务实现基于 token 的身份验证的教程,刚刚完成了“保护 REST 端点”步骤,但现在在调用端点时我总是收到 AbstractMethodError。 我已
我正在 tomcat 8.5 中构建一个简单的 JSF 2.3 应用程序。我让 websocket 正常工作,然后添加了 Pretty Faces。 如果我单独使用它们,它们都可以工作。我的意思是,如
考虑以下代码: object Impls { trait ConcreteImpl { type Foo = Int def foo = 1 } } trait Base {
我正在部署一个在我自己的机器上运行的 war 并收到错误: java.lang.AbstractMethodError: com.mchange.v2.c3p0.impl.NewProxyPrepar
将 hibernate(在 JBoss 7.2.0 中)从 4.2.14 更新到 5.3.7 后,出现 AbstractMethodError 异常。这可能是一些依赖性问题,但我不知道应该在哪里寻找。
在尝试启动 SpringApplication 时,使用 Maven 添加 Jadira 依赖项会导致 AbstractMethodError。堆栈跟踪中没有任何帮助;它没有引用我自己的任何类(cla
我正在尝试制作一个 Elasticsearch 传输客户端,但出现以下错误 Caused by: java.lang.AbstractMethodError: org.elasticsearch.tr
我刚刚将应用程序的 GCM 更改为 FCM,并向其中添加了 OneSignal。完全遵循指南,甚至创建了一个新的监听器服务来处理推送通知。 然而,即使没有监听器,每当我收到推送时,应用程序都会崩溃并显
我在 android studio bumblebee 2021.1.1 上工作,并在创建 compose 项目时出现此错误 java.lang.AbstractMethodError: abstra
我是网络服务新手。我尝试将 jax.ws.. Web 服务与 jersey 和 spring 一起使用。当我尝试在 Windows 中使用 Chrome Post Client 或 CURL 发送请求
我正在项目中将 newrelic 版本从 2.x.x 更新到 5.x.x。我按照 newrelic 文档中提到的步骤进行操作(我更新了 pom 文件中的依赖项版本,更新了代理 jar 文件和配置文件)
我最近开始使用 Jackon 和 SmileFactory API's 来序列化 JSON 文档,但不知何故,每当我尝试使用 SmileFactory properties = new HashMap
我正在尝试从 Apache Spark 示例 mlib 推荐器 http://spark.apache.org/docs/1.2.1/mllib-collaborative-filtering.htm
我在我的项目中使用atomikos Essentials 来管理交易。部署项目后出现以下异常。我陷入其中无法解决。谁能帮我解决这个问题。 Exception in thread "Atomikos:0
我是一名优秀的程序员,十分优秀!