问题描述
- 升级ssh整合出现错误java.lang.NoSuchMethodError:
-
下面是控制台打印的信息,麻烦看到的高手帮忙解决:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [cn/com/hope/framework/spring/applicationContext-datasource.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.tool.hbm2ddl.SchemaUpdate.(Lorg/hibernate/service/ServiceRegistry;Lorg/hibernate/cfg/Configuration;)V
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.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
... 28 more
Caused by: java.lang.NoSuchMethodError: org.hibernate.tool.hbm2ddl.SchemaUpdate.(Lorg/hibernate/service/ServiceRegistry;Lorg/hibernate/cfg/Configuration;)V
at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:522)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1859)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1930)
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)
... 35 more
解决方案
Spring配置文件里面注册action时出错,最大可能是class属性后面的地址不对 。你仔细看看
解决方案二:
最大的可能是你配置不对, bean没有指定到正确hibernate class导致事务配置失败
或者是你的maven/ant中引入的hibernate/spring的版本不对
只有这个原因才会出这个错误,而且你的对应Class中肯定没有这个方法, 办法就是改你的配置,或者升级你的hibernate / spring3 的版本
解决方案三:
你这是一启动就报错了么。 可以看看是不是jar包冲突或者没导入这jar包
解决方案四:
你是不是把Hibernate3改成了Hibernate4,如果是的话,Hibernate4没有HibernateDaoSupport这个类,你需要手动写的
解决方案五:
找到答案了,是因为在项目中自定义了个org.hibernate.tool.hbm2ddl.SchemaUpdate类而导致的,谢谢各位的耐心帮助。。。
解决方案六:
sessionFactory注入异常,一般是datasource是原因
时间: 2025-01-26 18:39:53