我在Spring 2.5上使用Hibernate3.jar,现在我已经升级到Spring 3.2.4并仍在使用Hibernate3.jar 但是在应用程序负载上我得到的误差低于误差,如果我遗漏任何东西,请帮助我。
2013-10-25 23:20:19,513 ERROR [org.springframework.web.servlet.DispatcherServlet] - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/eam/deploy/tfcc-admin.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/context/CurrentSessionContext
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1482)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
我在lib文件夹中添加了以下jar文件,
spring-aop-3.2.4.RELEASE.jar
spring-aspects-3.2.4.RELEASE.jar
spring-beans-3.2.4.RELEASE.jar
spring-context-3.2.4.RELEASE.jar
spring-context-support-3.2.4.RELEASE.jar
spring-core-3.2.4.RELEASE.jar
spring-expression-3.2.4.RELEASE.jar
spring-jdbc-3.2.4.RELEASE.jar
spring-orm-3.2.4.RELEASE.jar
spring-tx-3.2.4.RELEASE.jar
spring-web-3.2.4.RELEASE.jar
spring-webmvc-3.2.4.RELEASE.jar
SessionFactoryBean配置:
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="mappingResources">
<list>
<value>com/eam/hibernate/User.hbm.xml</value>
<value>com/eam/hibernate/Branch.hbm.xml</value>
<value>com/eam/hibernate/Address.hbm.xml</value>
</list>
</property>
</bean>
感谢。
答案 0 :(得分:1)
我通过做以下事情解决了这个问题, 1.删除旧的hibernate3.jar和hibernate-annotation.jar并添加两个新的jar
hibernate-commons-annotations-3.2.0.Final.jar
hibernate-core-3.6.10.Final.jar
persistence-api-1.0.jar
现在我在类路径中跟随弹簧相关的jar。
spring-aop-3.2.4.RELEASE.jar
spring-aspects-3.2.4.RELEASE.jar
spring-beans-3.2.4.RELEASE.jar
spring-context-3.2.4.RELEASE.jar
spring-context-support-3.2.4.RELEASE.jar
spring-core-3.2.4.RELEASE.jar
spring-expression-3.2.4.RELEASE.jar
spring-jdbc-3.2.4.RELEASE.jar
spring-orm-3.2.4.RELEASE.jar
spring-tx-3.2.4.RELEASE.jar
spring-web-3.2.4.RELEASE.jar
spring-webmvc-3.2.4.RELEASE.jar
谢谢,
答案 1 :(得分:0)
抱歉,我现在找不到信息,但我对此有记忆。 尝试将其替换为:
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
答案 2 :(得分:0)
org/hibernate/context/CurrentSessionContext
初始化。 (堆栈跟踪中可能有ExceptionInInitializerError
)我在这里列出了可能由NoClassDefFoundError引起的问题,可以帮到你: