Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NoSuchMethodError: org.hibernate.SessionFactory.openSession()Lorg/hibernate/classic/Session; [SPR-8776] #13419

Closed
spring-projects-issues opened this issue Oct 13, 2011 · 5 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Oct 13, 2011

chun ping wang opened SPR-8776 and commented

Hi when i ran a unit test with hibernate 4 i get this error.

java.lang.NoSuchMethodError: org.hibernate.SessionFactory.openSession()Lorg/hibernate/classic/Session;
at org.springframework.orm.hibernate4.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:328)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)
at org.springframework.test.context.transaction.TransactionalTestExecutionListener$TransactionContext.startTransaction(TransactionalTestExecutionListener.java:513)
at org.springframework.test.context.transaction.TransactionalTestExecutionListener.startNewTransaction(TransactionalTestExecutionListener.java:271)
at org.springframework.test.context.transaction.TransactionalTestExecutionListener.beforeTestMethod(TransactionalTestExecutionListener.java:164)
at org.springframework.test.context.TestContextManager.beforeTestMethod(TestContextManager.java:358)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:73)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:119)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:101)

Here is my xml configuration:
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="coreDataSource" />
<property name="configLocation" value="classpath:hibernate.cfg.xml" />
<property name="hibernateProperties" ref="hibernateProperties" />
<property name="packagesToScan" value="com.user.domain" />
</bean>

<bean id="transactionManager"
	class="org.springframework.orm.hibernate4.HibernateTransactionManager">
	<property name="sessionFactory" ref="sessionFactory" />
</bean>

Affects: 3.1 RC1

Issue Links:

Referenced from: commits 0dfb617, 439b775

0 votes, 5 watchers

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Oct 20, 2011

Juergen Hoeller commented

Good catch! This is caused by signature differences between Hibernate 3.x and Hibernate 4.x which we have to bridge in our cross-compilation scenario. Fixed for 3.1 RC2.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Nov 14, 2011

John Kroubalkian commented

We have the situation described here (java.lang.NoSuchMethodError: org.hibernate.SessionFactory.openSession()Lorg/hibernate/classic/Session;).

I took Juergen's changes (6 classes) and deployed them in my project. All works well.

Q: What is the best way to keep local code up to date with related RC2 changes?

Q: Where to pull source for RC2?

Q: How to build source for RC2?

Q: Will multiple .jar(s) need building and deployment?

Q: When is RC2 scheduled for general availability?

Thanks :-)

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Nov 18, 2011

Chris Beams commented

Q: What is the best way to keep local code up to date with related RC2 changes?

Assuming you use Maven, add the following to your POM:

<repository>
    <id>spring-snapshot</id>
    <url>http://maven.springframework.org/snapshot</url>
</repository>
...
<dependency>
 <groupId>org.springframework</groupId>
 <artifactId>spring-orm</artifactId>
 <version>3.1.0.BUILD-SNAPSHOT</version>
</dependency> 

Q: Where to pull source for RC2?

svn checkout https://src.springframework.org/svn/spring-framework/trunk spring-framework

Q: How to build source for RC2?

http://blog.springsource.org/2009/03/03/building-spring-3

Q: When is RC2 scheduled for general availability?

Shortly. Within the next 1-2 weeks.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Nov 26, 2011

Crummy Nickname commented

How do we download a zip file of all spring artifacts form RC2 ? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants