首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >500错误-- CannotLoadBeanClassException

500错误-- CannotLoadBeanClassException
EN

Stack Overflow用户
提问于 2021-07-19 07:02:17
回答 1查看 38关注 0票数 1

我从我的Spring web应用程序中得到一个500错误。提到的文件已正确命名,并且位于正确的包中。以下是错误消息。

代码语言:javascript
复制
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping': Invocation of init method failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.dao.CommentDAO] for bean with name 'commentDAO' defined in ServletContext resource [/WEB-INF/ghs1986-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.dao.CommentDAO
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.dao.CommentDAO] for bean with name 'commentDAO' defined in ServletContext resource [/WEB-INF/ghs1986-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.dao.CommentDAO
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.controller.PagesController] for bean with name 'pagesController' defined in ServletContext resource [/WEB-INF/ghs1986-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.controller.PagesController
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.controller.CommentController] for bean with name 'commentController' defined in ServletContext resource [/WEB-INF/ghs1986-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.controller.CommentController

下面是ghs1986-servlet.xml的相关部分。

代码语言:javascript
复制
<bean id="commentDAO" class="com.dao.CommentDAO">
        <property name="dataSource" ref="dataSource" />
    </bean>

    <bean id="pagesController" class="com.controller.PagesController" />

    <bean id="commentController" class="com.controller.CommentController">
        <property name="commentDAO" ref="commentDAO" />
    </bean>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-07-19 07:54:40

问题解决了。我需要CommentDAO上的@Component注解。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68433675

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档