最近修改了tomcat配置导致项目异常
HTTP Status 500 - Request processing failed; nested exception is org.apache.tiles.request.render.CannotRenderException: ServletException including path '/WEB-INF/layout/page.jsp'. type Exception report message Request processing failed; nested exception is org.apache.tiles.request.render.CannotRenderException: ServletException including path '/WEB-INF/layout/page.jsp'. description The server encountered an internal error that prevented it from fulfilling this request. exception org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.apache.tiles.request.render.CannotRenderException: ServletException including path '/WEB-INF/layout/page.jsp'. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) javax.servlet.http.HttpServlet.service(HttpServlet.java:622) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause org.apache.tiles.request.render.CannotRenderException: ServletException including path '/WEB-INF/layout/page.jsp'. org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:399) org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238) org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:221) org.apache.tiles.renderer.DefinitionRenderer.render(DefinitionRenderer.java:59) org.springframework.web.servlet.view.tiles3.TilesView.renderMergedOutputModel(TilesView.java:132) org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303) org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1257) org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1037) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:980) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) javax.servlet.http.HttpServlet.service(HttpServlet.java:622) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause java.io.IOException: ServletException including path '/WEB-INF/layout/page.jsp'. org.apache.tiles.request.servlet.ServletUtil.wrapServletException(ServletUtil.java:63) org.apache.tiles.request.servlet.ServletRequest.forward(ServletRequest.java:267) org.apache.tiles.request.servlet.ServletRequest.doForward(ServletRequest.java:228) org.apache.tiles.request.AbstractClientRequest.dispatch(AbstractClientRequest.java:57) org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47) org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259) org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397) org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238) org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:221) org.apache.tiles.renderer.DefinitionRenderer.render(DefinitionRenderer.java:59) org.springframework.web.servlet.view.tiles3.TilesView.renderMergedOutputModel(TilesView.java:132) org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303) org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1257) org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1037) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:980) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) javax.servlet.http.HttpServlet.service(HttpServlet.java:622) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause org.apache.jasper.JasperException: The absolute uri: http://www.springframework.org/tags cannot be resolved in either web.xml or the jar files deployed with this application org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:55) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:277) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:75) org.apache.jasper.compiler.TagLibraryInfoImpl.generateTldResourcePath(TagLibraryInfoImpl.java:243) org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:124) org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:421) org.apache.jasper.compiler.Parser.parseDirective(Parser.java:479) org.apache.jasper.compiler.Parser.parseElements(Parser.java:1435) org.apache.jasper.compiler.Parser.parse(Parser.java:139) org.apache.jasper.compiler.ParserController.doParse(ParserController.java:227) org.apache.jasper.compiler.ParserController.parse(ParserController.java:100) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199) org.apache.jasper.compiler.Compiler.compile(Compiler.java:356) org.apache.jasper.compiler.Compiler.compile(Compiler.java:336) org.apache.jasper.compiler.Compiler.compile(Compiler.java:323) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:585) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:363) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.apache.tiles.request.servlet.ServletRequest.forward(ServletRequest.java:265) org.apache.tiles.request.servlet.ServletRequest.doForward(ServletRequest.java:228) org.apache.tiles.request.AbstractClientRequest.dispatch(AbstractClientRequest.java:57) org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47) org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259) org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397) org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238) org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:221) org.apache.tiles.renderer.DefinitionRenderer.render(DefinitionRenderer.java:59) org.springframework.web.servlet.view.tiles3.TilesView.renderMergedOutputModel(TilesView.java:132) org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303) org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1257) org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1037) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:980) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) javax.servlet.http.HttpServlet.service(HttpServlet.java:622) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) note The full stack trace of the root cause is available in the Apache Tomcat/8.0.32 logs. Apache Tomcat/8.0.32
page.jsp的内容
<%@ taglib uri="http://www.springframework.org/tags" prefix="s" %> <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="t" %> <%@ page session="false" %> <html> <head> <title>Spittr</title> <link rel="stylesheet" type="text/css" href="<s:url value="/resources/style.css" />" > </head> <body> <div id="header"> <t:insertAttribute name="header" /> </div> <div id="content"> <t:insertAttribute name="body" /> </div> <div id="footer"> <t:insertAttribute name="footer" /> </div> </body> </html>
下图为tomcat配置选项
出现异常后,发现C:\apache-tomcat-8.0.32\webapps里根本没有那个项目文件.
解决方案:取消掉第一个选项 server modules without publishing.其它两个也可以取消.
下面是对tomcat server options的研究.
1.
因为勾选了Server modules without publishing,所以项目不会部署到C:\apache-tomcat-8.0.32\webapps,直接在开发环境里访问,可能是因为哪个环节没有配置好,导致在浏览器里访问的时候不能获取到http://www.springframework.org/tags.
下面这个链接对Server modules without publishing有解释.
虽然勾选了有些好处,但是还是不要勾选Server modules without publishing,为好
2. 对于选项
publish module contexts to separate XML files的解释
勾选 上后会修改Servers/Tomcat v6.0 Server at localhost-config/servers.xml中的saveSeparateContextFiles=true
同时将tmp0/conf/server.xml中关于该app的<Context>元素
移动到tmp0/conf/Catalina/localhost/appName.xml中..
勾选上后,再部署会在C:\apache-tomcat-8.0.32\conf\Catalina\localhost目录里有个项目的配置文件,名为<项目名>.xml,内容为
<?xml version="1.0" encoding="UTF-8"?> <Context docBase="C:\apache-tomcat-8.0.32\webapps\_7AdvancedSpringMVC" path="/_7AdvancedSpringMVC" reloadable="false" source="org.eclipse.jst.jee.server:_7AdvancedSpringMVC"/>
这个选项是不是可以避免当tomcat中部署多个实例的时候配置文件相互干扰??不太了解
3. 对于选项modules auto reload by default,这个勾选后会导致修改代码时,tomcat自动publish并重启.建议不要勾选,避免修改了代码后,保存一下,tomcat就重启一次,手动重启最好.
4. 右上角还有一个Publishing选项,
建议勾选Automatically publish when resources change,这样修改了JSP文件之后,代码可以自动publish,这个选项对java代码没有用啊.勾不勾这个选项在修改了java代码后,都会自动publish.如果对这个选项不放心,可以选择第一个nerver publish automatically,这样每次修改了自己手动publish再重启服务器即可.
最后建议的选项
还参考了下面的网页
https://my.oschina.net/uniquejava/blog/80945 这里面也解释了三个选项.
http://www.myexception.cn/eclipse/1867578.html