我参考了网上的一个实例,用springmvc+hibernate做了一个例子,把原来它配的oracle换成了SQLserver出错

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\win7-myeclipse\apache-tomcat-7.0.62\wtpwebapps\springmvc12\WEB-INF\classes\config\springAnnotation-hibernate.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in file [D:\win7-myeclipse\apache-tomcat-7.0.62\wtpwebapps\springmvc12\WEB-INF\classes\config\springAnnotation-hibernate.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.driver.OracleDriver]
org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions

进入路径D:\win7-myeclipse\apache-tomcat-7.0.62\wtpwebapps\springmvc12\WEB-INF\classes\config\看看配置文件是否正确,若不正确更新一下,右键点击tomcat server先clear一下在publish,更新成正确的配置即可
温馨提示:答案为网友推荐,仅供参考