HTTP 500 的错误原因

本文记录了两个典型的Tomcat启动时遇到的500错误案例:dispatcherServlet初始化异常及JSP编译失败,并分析了相应的日志文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

错误1

HTTP Status 500 - Servlet.init() for servlet dispatcherServlet threw exception


type Exception report

message Servlet.init() for servlet dispatcherServlet threw exception

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet.init() for servlet dispatcherServlet threw exception
	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.lang.Thread.run(Thread.java:722)



错误2

HTTP Status 500 - Unable to compile class for JSP:


type Exception report

message Unable to compile class for JSP:

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 27 in the jsp file: /WEB-INF/view/DB.jsp
Syntax error on token "%", delete this token
24: <%
25: //JSP页面直接访问数据库
26: 
27: <%
28: out.println("<h1>Hello World!<br>世界,你好!</h1>");
29: %>


提示我看一下TOMCAT 日志


catalina.2014-12-29,

host-manager.2014-12-29,里面是空的。

localhost.2014-12-29,

localhost_access_log.2014-12-29

manager.2014-12-29


------------------------------

localhost.2014-12-29

2014-12-29 9:02:34 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2014-12-29 9:02:34 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2014-12-29 9:02:34 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@d6b059')
2014-12-29 9:14:35 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextDestroyed()
2014-12-29 9:14:35 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextDestroyed()

------------------------------



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值