I know this question and the Spring JIRA question, it is referenced, however I am using the latest versions of both Hibernate and Spring and still get the same error shown in the stacktrace table below when I run my unit tests:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [E:\business\projects\model\build\classes\test\testContext-model-hibernate.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.engine.spi.SessionFactoryImplementor.getProperties()Ljava/util/Properties;
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:756)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:128)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60)
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:108)
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:251)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116)
... 45 more
Caused by: java.lang.NoSuchMethodError: org.hibernate.engine.spi.SessionFactoryImplementor.getProperties()Ljava/util/Properties;
at org.jadira.usertype.spi.shared.AbstractUserTypeHibernateIntegrator.integrate(AbstractUserTypeHibernateIntegrator.java:192)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:275)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:483)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:707)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:723)
at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:372)
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:454)
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:439)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
... 60 more
Here is a snippet from my gradle build file containing the sleep mode and Spring jars versions that I use:
'org.hibernate.common:hibernate-commons-annotations:5.0.1.Final',
'org.hibernate:hibernate-core:5.2.1.Final',
'org.hibernate:hibernate-entitymanager:5.2.1.Final',
'org.hibernate:hibernate-orm-modules:5.2.1.Final',
'org.hibernate:hibernate-search:5.5.4.Final',
'org.hibernate:hibernate-search-orm:5.5.4.Final',
'org.hibernate:hibernate-search-engine:5.5.4.Final',
'org.springframework.security:spring-security-core:4.1.1.RELEASE',
'org.springframework:spring-aop:4.3.1.RELEASE',
'org.springframework:spring-aspects:4.3.1.RELEASE',
'org.springframework:spring-beans:4.3.1.RELEASE',
'org.springframework:spring-context:4.3.1.RELEASE',
'org.springframework:spring-context-support:4.3.1.RELEASE',
'org.springframework:spring-core:4.3.1.RELEASE',
'org.springframework:spring-expression:4.3.1.RELEASE',
'org.springframework:spring-orm:4.3.1.RELEASE',
'org.springframework:spring-tx:4.3.1.RELEASE',
Could this be caused by something else that I don’t know about?
EDIT : added the output of the gradle dependency task, check the execution lines:
testRuntime - Runtime dependencies for source set 'test'.
+
+
+
+
| +
| | +
| | \
| +
| +
| \
+
+
+
| +
| +
| +
| \
| \
+
+
| \
+
| +
| \
+
+
| +
| | \
| +
| | \
| | \
| \
+
+
| +
| \
+
+
| +
| | +
| | +
| | | +
| | | +
| | | +
| | | +
| | | +
| | | +
| | | +
| | | +
| | | +
| | | | \
| | | \
| | | +
| | | +
| | | +
| | | \
| | +
| | +
| | +
| | +
| | \
| +
| \
| \
+
+
+
+
+
+
+
+
| \
| +
| | +
| | +
| | +
| | | \
| | +
| | | \
| | +
| | | \
| | +
| | | +
| | | \
| | \
| \
+
+
+
| +
| +
| | +
| | | \
| | | \
| | \
| +
| +
| | +
| | +
| | +
| | \
| | \
| +
| \
+
+
| \
+
+
+
| +
| +
| \
+
+
+
| +
| +
| +
| | +
| | +
| | \
| | +
| | \
| \
+
+
+
| \
+
| \
\
(*) - dependencies omitted (listed previously)
BUILD SUCCESSFUL
source
share