Error creating bean with name 'mySessionFactory' defined in class path resource

Error creating bean with name 'mySessionFactory' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/support/SQLExceptionTranslator

Caused by: java.lang.NoClassDefFoundError: org/springframework/jdbc/support/SQLExceptionTranslator

这是什么错误,是不是包得问题,如果是到底需要那些包不需要哪些包,请指教

[quote]是加applicationContext.xml里面吗,怎么加进去报错啊! [/quote]
楼上说的是加到maven的pom.xml,如果你的项目是用maven做管理的话。

[quote]
Cannot find class [org.apache.commons.dbcp.BasicDataSource] for bean with name 'dataSource' defined in class path resource [applicationContext.xml];
[/quote]
其实看日志,很清楚了,确实相应的jar包。如果你的项目是用maven管理,把楼上的
[code="java"]

commons-dbcp
commons-dbcp
20030825.184428
jar
compile


commons-pool
commons-pool
20030825.183949
jar
compile

[/code]
加到pom.xml中,如果不是,自己去下载commons-dbcp和commons-pool包,然后放到classpath里就可以了

spring-jdbc这个包没有加到classpath里面。


org.springframework
spring-jdbc
3.0.5.RELEASE

把这个依赖添加到你的pom文件中去。

还是包的问题

commons-dbcp
commons-dbcp
20030825.184428
jar
compile


commons-pool
commons-pool
20030825.183949
jar
compile

把这个添加上。

加到pom.xml文件中,那个怎么能加到application-context配置文件中去呢,肯定要报错的啊。看似楼主对项目构建不是很了解,我有篇博客上有一个spring+hibernate配置的模板项目,你可以去参考下 http://dreamzhong.iteye.com/blog/1128375