2014-10-10 92 views
0

我正在嘗試創建我的第一個Tiles網頁。 我使用this tutorial和所有CONFIGS完成後,我得到這個異常:創建Apache Tiles簡單應用程序時出現異常

java.lang.NullPointerException 
    at org.apache.tiles.access.TilesAccess.getContainer(TilesAccess.java:124) 
    at org.apache.tiles.access.TilesAccess.getContainer(TilesAccess.java:107) 
    at org.apache.tiles.access.TilesAccess.getCurrentContainer(TilesAccess.java:174) 
    at org.apache.tiles.template.InsertDefinitionModel.execute(InsertDefinitionModel.java:95) 
    at org.apache.tiles.jsp.taglib.InsertDefinitionTag.doTag(InsertDefinitionTag.java:254) 
    at org.apache.jsp.menu.menu_jsp._jspx_meth_tiles_005finsertDefinition_005f0(menu_jsp.java:92) 
    at org.apache.jsp.menu.menu_jsp._jspService(menu_jsp.java:65) 
    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.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) 
    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:100) 
    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:1041) 
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603) 
    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) 

我創建了瓷磚,defs.xml並添加所有的configs到我的web.xml。

+0

看起來不像你的TilesInitializer(或初始配置)正在工作... – mck 2014-10-13 20:01:23

回答

0

我走相同的教程,發現缺少配置。這種加入web.xml

<listener> 
    <listener-class>org.apache.tiles.web.startup.simple.SimpleTilesListener</listener-class> 
</listener> 

此偵聽器將跟蹤應用程序啓動和將配置與默認方式瓷磚(瓷磚主要配置應該是隻在這裏:/WEB-INF/tiles.xml)就這是在默認配置硬編碼。

相關問題