I have a strange issue with Apache Tiles 3. It was setup and working fine before but the project under went some refactoring and now it's completely broken. It always returns a 500 internal server error with a stack trace (included below). The project name, folder structure, some folder names, and some file names were changed, to meet standards handed down for the project.
What is strange is the paths are absolutely correct, which seems to be what it's complaining about. The following line I don't understand at all. Any ideas?
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)
layout file
<!-- 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 -->
stack trace
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
From the exception stack trace
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)
It seems like the compiled class file for the header.jsp
JSP file is missing. This can mean that the Servlet container failed to generate it and that can happen for a number of reasons.
From hints in your comments, it seems that it might just be a file naming issue. You can probably resolve it by cleaning tomcat's working directory and your web application's working directory.