Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/364.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
JavaSpring:创建bean时出错_Java_Eclipse_Spring_Hibernate_Spring Mvc - Fatal编程技术网

JavaSpring:创建bean时出错

JavaSpring:创建bean时出错,java,eclipse,spring,hibernate,spring-mvc,Java,Eclipse,Spring,Hibernate,Spring Mvc,我在Eclipse中添加了一个spring项目。从eclipse在服务器上运行project时,会出现以下错误: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/myprojectwebsite-servlet.xml]: Invocation of init method failed; nested exception is org.hibernate.Ma

我在Eclipse中添加了一个spring项目。从eclipse在服务器上运行project时,会出现以下错误:

Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/myprojectwebsite-servlet.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Unable to load class declared as <mapping class="com.test.myproject.data.User"/> in the configuration:

Caused by: org.hibernate.MappingException: Unable to load class declared as <mapping class="com.test.myproject.data.User"/> in the configuration:
创建在ServletContext资源[/WEB-INF/myprojectwebsite servlet.xml]中定义了名为“sessionFactory”的bean时出错:调用init方法失败;嵌套异常为org.hibernate.MappingException:无法加载配置中声明的类:
原因:org.hibernate.MappingException:无法加载在配置中声明为的类:
myprojectwebsite-servlet.xml具有:

...
<property name="configLocation">
   <value>classpath:hibernate.cfg.xml</value>
</property>
...
。。。
类路径:hibernate.cfg.xml
...
hibernate.cfg.xml中有引发错误的代码:

<mapping class="com.test.myproject.data.User"/>


知道可能出了什么问题吗?

运行时是否可以访问
用户
类?有没有办法检查?(我粘贴的错误来自eclipse控制台)在eclipse放置编译器输出的目录中,该类存在吗?单击
ctrl+shift+t
并键入
User
查看它显示了什么?您的代码是在GitHub上还是什么?