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

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个回答

图片说明,报错信息提示的很明显呀,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这个类。

programer_yan
programer_yan 正解 估计是xml里的配置和真实的类对不上 不是类不存在 就是路径写错了 或错别字等 导致找不到
接近 2 年之前 回复

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

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

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

可能是JAR包的版本不对

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

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

Qiang89416
有趣的 你的spring和jdk都是什么版本
接近 2 年之前 回复

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

兄弟,你这个映射出问题了啊 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

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

共17条数据 1 尾页
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!