renshen4322
renshen4322
采纳率0%
2018-01-02 07:40 阅读 1.1k

spring mvc hibernate eclipse报如下错误,怎么回事?

10

HTTP Status 500 – Internal Server Error
Type Exception Report

Message Servlet.init() for servlet [spring-mvc] threw exception

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

javax.servlet.ServletException: Servlet.init() for servlet [spring-mvc] threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:651)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:501)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1376)
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Unknown Source)
Root Cause

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping': Initialization of bean failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.alibaba.dao.DAONewsByHibernate] for bean with name 'daoNews' defined in ServletContext resource [/WEB-INF/spring-mvc-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.alibaba.dao.DAONewsByHibernate
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.alibaba.dao.DAONewsByHibernate] for bean with name 'daoNews' defined in ServletContext resource [/WEB-INF/spring-mvc-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.alibaba.dao.DAONewsByHibernate
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.alibaba.services.NewsService] for bean with name 'newsService' defined in ServletContext resource [/WEB-INF/spring-mvc-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.alibaba.services.NewsService
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.alibaba.controllers.NewsController] for bean with name 'newsController' defined in ServletContext resource [/WEB-INF/spring-mvc-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.alibaba.controllers.NewsController
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:563)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

17条回答 默认 最新

  • xiaomage1314 人称小马哥 2018-01-02 07:55

    图片说明,报错信息提示的很明显呀,ClassNotFoundException:
    Cannot find class [com.alibaba.dao.DAONewsByHibernate] for bean with name 'daoNews' defined in ServletContext resource
    [/WEB-INF/spring-mvc-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.alibaba.dao.DAONewsByHibernate,看一下
    是不是缺少了DAONewsByHibernate这个类。

    点赞 3 评论 复制链接分享
  • bdmh bdmh 2018-01-02 07:41

    报500错误了,是不是代码有问题,看看日志信息

    点赞 评论 复制链接分享
  • quancao4469 Torres-Chen 2018-01-02 07:45

    这种错误不是网页问题,应该是你的后端代码出错了,一种情况是连接数据库不成功,其中包括你的jdbc中的用户密码不正确,还有一种情况是你后端代码有逻辑错误,编译不通过

    点赞 评论 复制链接分享
  • Qiang89416 有趣的 2018-01-02 07:48

    应该是jar的问题,缺少jar包或者jar包冲突

    点赞 评论 复制链接分享
  • lianzhiqiann 软虫 2018-01-02 07:50

    可能是JAR包的版本不对

    点赞 评论 复制链接分享
  • qq_38151011 婧待花开 2018-01-02 07:50

    应该是代码有问题,出现了编译错误

    点赞 评论 复制链接分享
  • Qiang89416 有趣的 2018-01-02 07:53

    或者你把jdk版本换一下,换成1.7的

    点赞 评论 复制链接分享
  • qq_23920831 qq_23920831 2018-01-02 07:56

    兄弟,你这个映射出问题了啊 BeanNameUrlHandler**Mapping**': Initialization of bean failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.alibaba.dao.DAONewsByHibernate] for bean with name 'daoNews' defined in ServletContext resource [/WEB-INF/spring-mvc-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.alibaba.dao.DAONewsByHibernate

    点赞 评论 复制链接分享
  • qq_30429741 qq_30429741 2018-01-02 07:56

    一方面 有可能你eclipse的安装包里面 有一个文本文件 里面有些 配置 与你 安装的路径或者环境变量不一致

    点赞 评论 复制链接分享
  • qq_34614587 思不凡的人生 2018-01-02 07:59

    把servlet-api.jar这个jar去掉试一下,该jar包可能会与eclipse自带tomcat中该jar冲突,导致500,望采纳

    点赞 评论 复制链接分享
  • qq_37913816 仙石1994 2018-01-02 07:59

    servlet 初始化时错误,检查配置文件和是数据库连接

    点赞 评论 复制链接分享
  • huanxiang0117 huanxiang0117 2018-01-02 08:02

    bean 配错了吧图片说明

    点赞 评论 复制链接分享
  • lmmzsn 浪里渔夫 2018-01-02 08:08

    看错误里都是:java.lang.ClassNotFoundException,估计是缺少com.alibaba的jar包。

    点赞 评论 复制链接分享
  • qq_41224289 qq_41224289 2018-01-02 08:40

    大兄弟,你检查一下配置文件,如果没问题的话就是映射的问题了

    点赞 评论 复制链接分享
  • m0_37692472 紫梦小缘 2018-01-02 10:25

    应该是jar包没有导入

    点赞 评论 复制链接分享
  • ZzHong12138 ZzHong12138 2018-01-02 12:54

    报500一般是参数不对或请求非法,看一下参数是不是写错了

    点赞 评论 复制链接分享
  • qq_38397400 qq_38397400 2018-01-03 09:06

    推测:1.xml配置文件路径不对,2.没有那个类和方法

    点赞 评论 复制链接分享

相关推荐