-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Problem with 2.1.7 setNamingStrategy
PostPosted: Tue Nov 23, 2004 4:56 pm 
Beginner
Beginner

Joined: Wed Nov 19, 2003 6:46 pm
Posts: 41
Location: Auckland, New Zealand
I just downloaded Hibernate 2.1.7 after previously using 2.1.6.

Now, when I start up my app, I get the exception below.

We're using the Spring framework (1.1) and we have a custom NamingStrategy for our tables and columns. The problem occurs when the LocalSessionFactoryBean is trying to call the setNamingStrategy method on the Hibernate Configuration object - gives a NoSuchMethodError

I've looked at the Hibernate source code, and the API docs, and the method exists. The Configuration class in the hibernate2.jar file has the method.

I really don't understand what the problem can be. Can anybody shed any light on this... or is anybody else experiencing the same problem? If all else fails, I'll have to go back to 2.1.6.

TIA

Craig


Hibernate version: 2.1.7

Full stack trace of any exception that occurs:

java.lang.NoSuchMethodError: net.sf.hibernate.cfg.Configuration.setNamingStrategy(Lnet/sf/hibernate/cfg/NamingStrategy;)V
at org.springframework.orm.hibernate.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:342)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:991)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:208)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:136)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveReference(AbstractAutowireCapableBeanFactory.java:903)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveValueIfNecessary(AbstractAutowireCapableBeanFactory.java:844)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:785)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:271)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:208)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:136)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveReference(AbstractAutowireCapableBeanFactory.java:903)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveValueIfNecessary(AbstractAutowireCapableBeanFactory.java:844)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:785)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:271)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:208)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:136)

etc...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 23, 2004 5:24 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
best guess - you have two different versions of hibernate in your classpath and spring get's confused.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 23, 2004 6:32 pm 
Beginner
Beginner

Joined: Wed Nov 19, 2003 6:46 pm
Posts: 41
Location: Auckland, New Zealand
Thanks for the reply Max, but alas, that is not the case. I only have one hibernate2.jar in my classpath.

I think it's a Spring problem as I can create a Configuration object in my own code and call the setNamingStrategy method on it, yet when I get Spring to configure itself from my XML config file, it encounters the problem.

I've even created a Configuration object in my code, called setNamingStrategy on it, then let Spring do its thing, and the Spring code encounters the problem. So, it doesn't seem to be a class loading problem (as far as I can tell in my (limited) java experience).

I have tried the latest release of Spring too - 1.1.2, to no avail.

For now, I'm going to go back to 2.1.6, having wasted the whole morning trying to find the solution to this. :-(

Any other suggestions most welcome!

Craig


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 24, 2004 1:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
try to recompile spring with 2.1.7

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 24, 2004 5:29 am 
Beginner
Beginner

Joined: Wed Nov 19, 2003 6:46 pm
Posts: 41
Location: Auckland, New Zealand
Hi Max

Thanks for the suggestion. I downloaded the spring-framework-1.1.2-with-dependencies, replaced the hibernate2.jar with the 2.1.7 version and built Spring from the source, and this has corrected the problem.

Very happy... especially now that SchemaExport and SchemaUpdate seem to work much better with MySQL.

Thanks :-)

Craig


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.