Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring注释示例服务器加载时间显示错误_Spring - Fatal编程技术网

Spring注释示例服务器加载时间显示错误

Spring注释示例服务器加载时间显示错误,spring,Spring,我是春天的新手,我在eclipse中做spring注释示例luna同样的示例在myeclipse中工作,但不在eclipse中工作 得到这个错误有人能帮我吗 org.springframework.beans.factory.BeanCreationException:创建名为“studentController”的bean时出错:自动连线依赖项的注入失败;嵌套异常为org.springframework.beans.factory.BeanCreationException:无法自动连接字段:

我是春天的新手,我在eclipse中做spring注释示例luna同样的示例在myeclipse中工作,但不在eclipse中工作

得到这个错误有人能帮我吗

org.springframework.beans.factory.BeanCreationException:创建名为“studentController”的bean时出错:自动连线依赖项的注入失败;嵌套异常为org.springframework.beans.factory.BeanCreationException:无法自动连接字段:private com.vcs.service.StudentService com.vcs.controller.StudentController.StudentService;嵌套异常为org.springframework.beans.factory.BeanCreationException:创建名为“studentServiceImpl”的bean时出错:自动连线依赖项的注入失败;嵌套异常为org.springframework.beans.factory.BeanCreationException:无法自动关联字段:private com.vcs.dao.StudentDao com.vcs.service.studentserviceinpl.StudentDao;嵌套异常为org.springframework.beans.factory.BeanCreationException:创建名为“studentdaoImpl”的bean时出错:自动连线依赖项的注入失败;嵌套异常为org.springframework.beans.factory.BeanCreationException:无法自动关联字段:private org.hibernate.SessionFactory com.vcs.dao.StudentdaoImpl.SessionFactory;嵌套异常为org.springframework.beans.factory.BeanCreationException:创建名为“sessionFactory”的bean时出错,该bean在ServletContext资源[/WEB-INF/DispatcherServlet.xml]中定义:调用init方法失败;嵌套的异常是java.lang.NoClassDefFoundError:org/hibernate/context/CurrentSessionContext
在org.springframework.beans.factory.annotation.AutowiredNotationBeanPostProcessor.postProcessPropertyValues(AutowiredNotationBeanPostProcessor.java:286)

查看上一个错误“java.lang.NoClassDefFoundError”,您似乎缺少hibernate依赖项(hibernate core)包含CurrentSessionContext的。

您将获得org.hibernate.context.CurrentSessionContext的NoClassDefFoundError异常

我的猜测是,在eclipse设置下,所需的依赖项不在类路径中

检查eclipse构建的war归档文件中的lib文件夹。我假设这是一个来自WEB-INF的战争档案


我还建议您将代码格式化为代码块,以便于阅读

如果仔细阅读错误,您会发现缺少一个包含类
org/hibernate/context/CurrentSessionContext