Struts2 не найдет определенное действие
Прежде всего, чтобы избежать дублирования тега вопроса, моя проблема заключается в том, что у меня есть 4 разных вызова действий struts2. 3 из них работают отлично, но четвертый просто не может найти диспетчера. Теперь оригинальный вопрос:
У меня есть динамический веб-проект, работающий с Struts2 в качестве бэкэнда. Я также использую плитки для заголовка и навигационной панели. На карте 4 кнопки, и 3 из них работают отлично. Но когда дело доходит до четвертого, диспетчер терпит неудачу, и даже пользовательская страница 404 не появляется.
Мой struts.xml выглядит так:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" />
<constant name="struts.custom.i18n.resources" value="ApplicationResources" />
<package name="default" extends="struts-default" namespace="/">
<result-types>
<result-type name="tiles"
class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<action name="main" method="gotoMain" class="controller.NavActions">
<result name="main" type="tiles">/tiles.main</result>
<result name="error">/utils/error.jsp</result>
</action>
<action name="arrive" method="gotoArrive" class="controller.NavActions">
<result name="arrive" type="tiles">/tiles.arrive</result>
<result name="error">/utils/error.jsp</result>
</action>
<action name="depart" method="gotoDepart" class="controller.NavActions">
<result name="depart" type="tiles">/tiles.depart</result>
<result name="error">/utils/error.jsp</result>
</action>
<action name="finder" method="gotoFinder" class="controller.NavActions">
<result name="finder" type="tiles">/tiles.finder</result>
<result name="error">/utils/error.jsp</result>
</action>
<action name="find_flight" method="findFlight" class="controller.NavActions">
<result name="find" type="tiles">/tiles.find.flight</result>
<result name="error">/utils/error.jsp</result>
</action>
</package>
</struts>
Html навигатора следующий, с префиксом Struts 's':
<ul class="nav nav-pills nav-stacked custom-nav">
<li id="main" class="nav-item"><s:a action="main">
<i class="fa fa-play"></i>
<span>Dashboard</span>
</s:a></li>
<li id="depart" class="nav-item"><s:a action="depart">
<i class="fa fa-plane" aria-hidden="true"></i>
<span>Departures</span>
</s:a></li>
<li id="arrive" class="nav-item"><s:a action="arrive">
<i class="fa fa-plane fa-rotate-90" aria-hidden="true"></i>
<span>Arrivals</span>
</s:a></li>
<li id="finder" class="nav-item"><s:a action="finder">
<i class="lnr lnr-magnifier"></i>
<span>Finder</span>
</s:a></li>
</ul>
Диспетчер терпит неудачу где-то здесь, не достигает метода Java. Я не публикую код Java, потому что он просто возвращает необходимую строку и изменяет поле. Ошибка консоли tomcat следующая:
GRAVE: El Servlet.service() para servlet jsp lanzó una excepción
The Struts dispatcher cannot be found. This is usually caused by using
Struts tags without the associated filter. Struts tags are only usable
when the request has passed through its servlet filter, which
initializes the Struts dispatcher needed for this tag. - [unknown
location]
at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:58)
at org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:44)
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:48)
at org.apache.jsp.utils.error_jsp._jspx_meth_s_005fproperty_005f0(error_jsp.java:193)
at org.apache.jsp.utils.error_jsp._jspService(error_jsp.java:153)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:720)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:468)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)
at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:442)
at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:301)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:178)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1100)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:687)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
ene 15, 2017 12:12:41 PM org.apache.catalina.core.StandardHostValve custom
GRAVE: Exception Processing ErrorPage[errorCode=404, location=/utils/error.jsp]
org.apache.jasper.JasperException: The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:560)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:720)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:468)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)
at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:442)
at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:301)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:178)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1100)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:687)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]
at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:58)
at org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:44)
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:48)
at org.apache.jsp.utils.error_jsp._jspx_meth_s_005fproperty_005f0(error_jsp.java:193)
at org.apache.jsp.utils.error_jsp._jspService(error_jsp.java:153)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
... 24 more
Набор действий дырки работает нормально, но когда дело доходит до поиска, диспетчер падает. Если я снова введу действие в URL, оно будет работать, но при повторной попытке снова появится сообщение об ошибке.