Struts 2.5 с Tiles 3 вызывает ошибки (TilesResult.java)

Я создаю простую веб-страницу, используя Struts2.5 с тайлами 3. Код работает без тайлов, но как только я перенаправляю результат своего действия на тайлы

[2/22/19 16:26:18:244 IST] 000000bf SystemErr     R java.lang.NullPointerException
[2/22/19 16:26:18:244 IST] 000000bf SystemErr     R     at org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:136)
[2/22/19 16:26:18:245 IST] 000000bf SystemErr     R     at org.apache.struts2.result.StrutsResultSupport.execute(StrutsResultSupport.java:206)
[2/22/19 16:26:18:245 IST] 000000bf SystemErr     R     at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:375)
[2/22/19 16:26:18:245 IST] 000000bf SystemErr     R     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:279)
[2/22/19 16:26:18:245 IST] 000000bf SystemErr     R     at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:250)
[2/22/19 16:26:18:245 IST] 000000bf SystemErr     R     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
[2/22/19 16:26:18:245 IST] 000000bf SystemErr     R     at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:179)
[2/22/19 16:26:18:245 IST] 000000bf SystemErr     R     at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
[2/22/19 16:26:18:245 IST] 000000bf SystemErr     R     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
[2/22/19 16:26:18:246 IST] 000000bf SystemErr     R     at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
[2/22/19 16:26:18:246 IST] 000000bf SystemErr     R     at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:49)
[2/22/19 16:26:18:246 IST] 000000bf SystemErr     R     at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
[2/22/19 16:26:18:246 IST] 000000bf SystemErr     R     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
[2/22/19 16:26:18:246 IST] 000000bf SystemErr     R     at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.doIntercept(ConversionErrorInterceptor.java:142)
[2/22/19 16:26:18:246 IST] 000000bf SystemErr     R     at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
[2/22/19 16:26:18:246 IST] 000000bf SystemErr     R     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
[2/22/19 16:26:18:246 IST] 000000bf SystemErr     R     at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:137)
[2/22/19 16:26:18:247 IST] 000000bf SystemErr     R     at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
[2/22/19 16:26:18:247 IST] 000000bf SystemErr     R     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)

Вот мой web.xml:

   <?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5" 
xmlns="http://java.sun.com/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">


    <display-name>Struts2Working</display-name>


    <context-param>
      <param-name>
         org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
      </param-name>

      <param-value>
         /WEB-INF/tiles.xml
      </param-value>
   </context-param>

   <listener>
      <listener-class>
         org.apache.struts2.tiles.StrutsTilesListener
      </listener-class>
   </listener>

    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>*.action</url-pattern>
    </filter-mapping>



    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>

    </welcome-file-list>

</web-app>

struts.xml:

<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
        "http://struts.apache.org/dtds/struts-2.5.dtd">



<struts>

    <constant name="struts.devMode" value="true" />

    <constant name="struts.enable.DynamicMethodInvocation" value="true" />





    <package name="default" namespace="/" extends="struts-default">


    <result-types>
            <result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
        </result-types>



        <action name="randomm" class="com.workHelp.actions.HelloAction">
            <result name="success">/WEB-INF/pages/login.jsp</result>
        </action>

        <action name="login" class="com.workHelp.actions.LoginAction">


            <result name="success" type="tiles">successLog</result>
            <result name="error">/WEB-INF/pages/error.jsp</result>

        </action>


    </package>

</struts>

tiles.xml:

<!DOCTYPE tiles-definitions PUBLIC
       "-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
       "http://tiles.apache.org/dtds/tiles-config_3_0.dtd">

 <tiles-definitions>

    <definition name="baseLayout" template="/baseLayout.jsp">
      <put-attribute name="title"  value="Template"/>
      <put-attribute name="header" value="/header.jsp"/>
      <put-attribute name="menu"   value="/menu.jsp"/>
      <put-attribute name="body"   value="/body.jsp"/>
      <put-attribute name="footer"   value="/footer.jsp"/>
  </definition>

  <definition name="successLog" extends="baseLayout">
      <put-attribute name="title"  value="Welcome"/>
      <put-attribute name="body"   value="/WEB-INF/pages/success.jsp"/>      
  </definition>



 </tiles-definitions>

Я добавил все банки, необходимые для плитки. Списки банок в папке lib

Списки зависимостей jar в classpath

Может кто-нибудь, пожалуйста, помогите мне в этом. Я видел все учебные пособия, но не смог найти решение этой проблемы.

0 ответов

Другие вопросы по тегам