我在Spring 2.5上並且使用Hibernate3.jar現在我已經升級到Spring 3.2.4並仍然使用Hibernate3.jar 但是在應用程序加載時出現錯誤,如果我缺少任何東西,請幫助我。升級到Spring 3.2.4後出現錯誤NoClassDefFoundError
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>
感謝。
什麼是你在SessionFactory的bean類? ?
baltov
更新原來的職位 –
Usualy有2此異常的原因更多鈔票:1)你錯過包含類的JAR或2)你有兩瓶不同版本。檢查在類路徑中的一些老春罐子。我不是在Hibernate中使用配置文件註釋 –