You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Dasgupta, Ranjan" <Ra...@ps.net> on 2008/12/11 21:24:10 UTC
[Struts2] cannot access a mapped servlet when using
/* for the struts filter
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
RE: [Struts2] cannot access a mapped servlet when using
/* for the struts filter
Posted by "Dasgupta, Ranjan" <Ra...@ps.net>.
Hi Nils-H,
Thanks for pointing that out. So the only resolution is to provide multiple mappings for the same filter?
Thanks,
-Ranjan
-----Original Message-----
From: Nils-Helge Garli Hegvik [mailto:nilsga@gmail.com]
Sent: Thursday, December 11, 2008 4:05 PM
To: Struts Users Mailing List
Subject: Re: [Struts2] cannot access a mapped servlet when using <url-pattern>/*</url-pattern> for the struts filter
Considering your filter mapping says to intercept all requests, I'm not surprised that it's invoked... Check section SRV.6.2.4 in the Servlet spec [1]
Nils-H
[1] - http://jcp.org/aboutJava/communityprocess/final/jsr154/index.html
On Thu, Dec 11, 2008 at 9:24 PM, Dasgupta, Ranjan <Ra...@ps.net> wrote:
> 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(FilterDispatch
> er.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
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [Struts2] cannot access a mapped servlet when using /* for the struts filter
Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
Considering your filter mapping says to intercept all requests, I'm
not surprised that it's invoked... Check section SRV.6.2.4 in the
Servlet spec [1]
Nils-H
[1] - http://jcp.org/aboutJava/communityprocess/final/jsr154/index.html
On Thu, Dec 11, 2008 at 9:24 PM, Dasgupta, Ranjan
<Ra...@ps.net> wrote:
> 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
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org