gpt4 book ai didi

java - Apache Tiles 3 JSP 异常

转载 作者:行者123 更新时间:2023-11-29 03:24:23 30 4
gpt4 key购买 nike

我在使用 Apache Tiles 3 时遇到了一个奇怪的问题。它之前的设置和工作都很好,但是下面的项目进行了一些重构,现在它完全坏了。它总是返回带有堆栈跟踪的 500 内部服务器错误(包括在下面)。更改了项目名称、文件夹结构、一些文件夹名称和一些文件名称,以满足项目的标准。

奇怪的是路径是绝对正确的,这似乎就是它所提示的。下面这行我完全不明白。有什么想法吗?

java.lang.NoClassDefFoundError: org/apache/jsp/WEB_002dINF/views/tiles/shared/header_jsp (wrong name: org/apache/jsp/WEB_002dINF/Views/Tiles/Shared/Header_jsp)

布局文件

<!-- standard template -->
<definition name="base" template="/WEB-INF/views/templates/default.jsp">
<put-attribute name="title" value=""></put-attribute>
<put-attribute name="header"
value="/WEB-INF/views/tiles/shared/header.jsp"></put-attribute>
<put-attribute name="content" value=""></put-attribute>
<put-attribute name="footer"
value="/WEB-INF/views/tiles/shared/footer.jsp"></put-attribute>
</definition>

<!-- Dashboard -->
<definition name="home/index" extends="base">
<put-attribute name="title" value="Home"></put-attribute>
<put-attribute name="content" value="/WEB-INF/views/tiles/home/home.jsp"></put-attribute>
</definition>
<!-- End Dashboard -->

<!-- User -->
<definition name="user/login" extends="base">
<put-attribute name="title" value="Login"></put-attribute>
<put-attribute name="header" value=""></put-attribute>
<put-attribute name="content"
value="/WEB-INF/views/tiles/user/login.jsp"></put-attribute>
<put-attribute name="footer" value=""></put-attribute>
</definition>

<definition name="user/index" extends="base">
<put-attribute name="title" value="Users"></put-attribute>
<put-attribute name="content"
value="/WEB-INF/views/tiles/user/index.jsp"></put-attribute>
</definition>

<definition name="user/add" extends="base">
<put-attribute name="title" value="Users - Add"></put-attribute>
<put-attribute name="content" value="/WEB-INF/views/tiles/user/add.jsp"></put-attribute>
</definition>
<!-- End User -->

堆栈跟踪

2014-02-16 23:01:57,777 DEBUG [DispatcherServlet] - Could not complete request
org.apache.tiles.request.render.CannotRenderException: ServletException including path '/WEB-INF/views/templates/default.jsp'.
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:399)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:221)
at org.apache.tiles.renderer.DefinitionRenderer.render(DefinitionRenderer.java:59)
at org.springframework.web.servlet.view.tiles3.TilesView.renderMergedOutputModel(TilesView.java:145)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:263)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1208)
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:992)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:939)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
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.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:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: ServletException including path '/WEB-INF/views/templates/default.jsp'.
at org.apache.tiles.request.servlet.ServletUtil.wrapServletException(ServletUtil.java:61)
at org.apache.tiles.request.servlet.ServletRequest.forward(ServletRequest.java:267)
at org.apache.tiles.request.servlet.ServletRequest.doForward(ServletRequest.java:228)
at org.apache.tiles.request.AbstractClientRequest.dispatch(AbstractClientRequest.java:57)
at org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397)
... 30 more
Caused by: java.io.IOException: JSPException including path '/WEB-INF/views/tiles/shared/header.jsp'.
at org.apache.tiles.request.servlet.ServletUtil.wrapServletException(ServletUtil.java:61)
at org.apache.tiles.request.jsp.JspRequest.doInclude(JspRequest.java:125)
at org.apache.tiles.request.AbstractViewRequest.dispatch(AbstractViewRequest.java:47)
at org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)
at org.apache.tiles.request.render.ChainedDelegateRenderer.render(ChainedDelegateRenderer.java:68)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)
at org.apache.tiles.template.InsertAttributeModel.renderAttribute(InsertAttributeModel.java:188)
at org.apache.tiles.template.InsertAttributeModel.execute(InsertAttributeModel.java:132)
at org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:299)
at org.apache.jsp.WEB_002dINF.views.templates.default_jsp._jspx_meth_tiles_005finsertAttribute_005f1(default_jsp.java:261)
at org.apache.jsp.WEB_002dINF.views.templates.default_jsp._jspService(default_jsp.java:105)
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.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
at org.apache.tiles.request.servlet.ServletRequest.forward(ServletRequest.java:265)
... 35 more
Caused by: java.lang.NoClassDefFoundError: org/apache/jsp/WEB_002dINF/views/tiles/shared/header_jsp (wrong name: org/apache/jsp/WEB_002dINF/Views/Tiles/Shared/Header_jsp)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
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.doInclude(PageContextImpl.java:684)
at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:678)
at org.apache.tiles.request.jsp.JspRequest.doInclude(JspRequest.java:123)
... 57 more

最佳答案

来自异常堆栈跟踪

Caused by: java.lang.NoClassDefFoundError: org/apache/jsp/WEB_002dINF/views/tiles/shared/header_jsp (wrong name: org/apache/jsp/WEB_002dINF/Views/Tiles/Shared/Header_jsp)

header.jsp JSP 文件的编译类文件似乎丢失了。这可能意味着 Servlet 容器未能生成它,并且可能由于多种原因而发生。

从您评论中的提示来看,这似乎只是一个文件命名问题。您可能可以通过清理 tomcat 的工作目录和您的 Web 应用程序的工作目录来解决它。

关于java - Apache Tiles 3 JSP 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21820651/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com