NutzCN Logo
问答 如何在500上显示报错日志
发布于 2965天前 作者 老司机 2052 次浏览 复制 上一个帖子 下一个帖子
标签:

RT,@Fail("http:500"),只显示空的500,我想把日志那样的详细报错信息显示出来该怎么做?(在eclipse上是好的,放到服务器就崩,想知道为啥崩)

5 回复

web.xml里面配置个error-code=500的jsp

@wendal

方法代码

@Fail("jsp:jsp.500")
	public NutMap getCPU_USED() throws Exception {}

500.jsp页面

<H1>错误:</H1>
	<br>
	<H2>错误内容:</H2>
	<c:out value="${exception}"></c:out>
	<br>

但是exception为空,
我想把抛出的exception显示在jsp也面该怎么弄,要那种详细到哪个java第几行的那种

@qq_c1bab051

<%
exception.printStackTrace(response.getWriter());
%>

试了但是会报这种错误

java.lang.RuntimeException: org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/jsp/500.jsp at line 14

11: 	<br>
12: 	<H2>错误内容:</H2>
13: 	<%
14: 		exception.printStackTrace(response.getWriter());
15: 	%>
16: 	<br>
17: 


Stacktrace:
	org.nutz.lang.Lang.wrapThrow(Lang.java:182)
	org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:52)
	org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198)

root cause

org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/jsp/500.jsp at line 14

11: 	<br>
12: 	<H2>错误内容:</H2>
13: 	<%
14: 		exception.printStackTrace(response.getWriter());
15: 	%>
16: 	<br>
17: 


Stacktrace:
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:588)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:481)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	org.nutz.mvc.NutFilter.nextChain(NutFilter.java:226)
	org.nutz.mvc.NutFilter.doFilter(NutFilter.java:201)
	org.nutz.mvc.view.ForwardView.render(ForwardView.java:70)
	org.nutz.mvc.impl.processor.ViewProcessor.process(ViewProcessor.java:66)
	org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:30)
	org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:49)
	org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198)

root cause

java.lang.NullPointerException
	org.apache.jsp.WEB_002dINF.jsp._500_jsp._jspService(_500_jsp.java:126)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:443)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	org.nutz.mvc.NutFilter.nextChain(NutFilter.java:226)
	org.nutz.mvc.NutFilter.doFilter(NutFilter.java:201)
	org.nutz.mvc.view.ForwardView.render(ForwardView.java:70)
	org.nutz.mvc.impl.processor.ViewProcessor.process(ViewProcessor.java:66)
	org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:30)
	org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:49)
	org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198)

note The full stack trace of the root cause is available in the Apache Tomcat/9.0.0.M9 logs.
添加回复
请先登陆
回到顶部