将War发布到Tomcat7上遇到的问题及其解决
用MyEclipse做了一個(gè)app,在其自帶的Tomcat里運(yùn)行正常,做成war后卻出現(xiàn)如下錯(cuò)誤:
[ServletException in:/page/jsp/template/block.jsp] org.apache.jsp.page.jsp.template.block_jsp' java.lang.ClassNotFoundException: org.apache.jsp.page.jsp.template.block_jsp at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:132) at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:63) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:143) at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:172) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:605) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:544) at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:954) at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:652) at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:138) at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:152) at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:138) at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756) at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:881) at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473) at org.apache.jsp.page.jsp.user.login.index_jsp._jspx_meth_tiles_005finsert_005f0(index_jsp.java:132) at org.apache.jsp.page.jsp.user.login.index_jsp._jspService(index_jsp.java:77) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)?
以上錯(cuò)誤密密麻麻的,讓人心驚,仔細(xì)一看吧,還看不出頭緒。心一急就有點(diǎn)亂投醫(yī)的意思了,發(fā)帖,網(wǎng)上搜,沒(méi)找到對(duì)癥的。
后來(lái)想想,是不是用了STURTS的TILES的問(wèn)題,找了個(gè)基本是固定信息的近靜態(tài)頁(yè)面,問(wèn)題還是差不多。
覺(jué)得奇怪,打開(kāi)一看,靜態(tài)頁(yè)面里除了一句<%@?taglib?prefix="c"?uri="http://java.sun.com/jsp/jstl/core"%>就沒(méi)有其它非HTML代碼了,難道這句話在作怪。
于是,用VI刪掉這句話,再輸入靜態(tài)網(wǎng)頁(yè)URL,正常顯示了!!
再找了/page/jsp/template/block.jsp,也刪掉這句話,它也正常了。這證明STURTS的TILES沒(méi)有問(wèn)題。
本地一查,大約四分之一的頁(yè)面都有<%@?taglib?prefix="c"?uri="http://java.sun.com/jsp/jstl/core"%>這句話,但實(shí)際上我是沒(méi)有用JSTL的,頁(yè)面除了HTML就是JS。于是全刪掉。
再運(yùn)行,所有頁(yè)面都正常了。這證明MyEclipse的導(dǎo)出war包也是可以信賴(lài)的。
究其原因,這四分之一的頁(yè)面估計(jì)都是一個(gè)母本,這個(gè)母本又是用MyEclipse生成的,生成時(shí)就帶了<%@?taglib?prefix="c"?uri="http://java.sun.com/jsp/jstl/core"%>這句話。首頁(yè)又在這四分之一里面,出的錯(cuò)又沒(méi)點(diǎn)中要害,所以一開(kāi)始讓人丈二和尚摸不著頭腦。后來(lái)從靜態(tài)頁(yè)面測(cè)試起是走在正道上了,在瀏覽器的地址欄輸入jsp地址,先從最簡(jiǎn)頁(yè)面開(kāi)始,逐漸測(cè)試復(fù)雜的頁(yè)面,最后查清確認(rèn)了真相。
<完>
?
轉(zhuǎn)載于:https://www.cnblogs.com/xiandedanteng/p/3329888.html
總結(jié)
以上是生活随笔為你收集整理的将War发布到Tomcat7上遇到的问题及其解决的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: MySQL的IFNULL函数
- 下一篇: 玩转SmartQQ之登录