ver 2.1.2. Running under jdev 10.1.3
Here's the original web.xml snippet
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
<servlet>
<servlet-name>TestServlet</servlet-name>
<servlet-class>wf.feed.servlet.TestServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>/testservlet</url-pattern>
</servlet-mapping>
When I try to access http://localhost:7779/app/testservlet, the struts2
dispatcher is getting invoked, and returns an error that it cannot find the
action:
There is no Action mapped for namespace / and action name testservlet. -
[unknown location]
at com.opensymphony.xwork2.XWorkException.<init>(XWorkException.java:35)
at
com.opensymphony.xwork2.config.ConfigurationException.<init>(ConfigurationException.java:30)
at
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:178)
at
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
at
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
at
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
at
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:467)
at
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:467)
So I ended up with modifying the <filter-mapping>, and this takes care of the
problem
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*.action</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*.jsp</url-pattern>
<dispatcher>REQUEST</dispatcher><!-- i guess this can be removed -->
<dispatcher>ERROR</dispatcher><!-- i guess this can be removed -->
</filter-mapping>
Has anybody faced this issue, and found a different resolution?
Thanks,
-Ranjan