Stripes

DynamicMappingFilter fails with FileNotFoundException when <jsp:include> is used to include an action

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: Release 1.5.1
  • Fix Version/s: Release 1.5.2, Release 1.6
  • Component/s: ActionBean Dispatching
  • Labels:
    None
  • Environment:
    Probably the bug is platform independent, but it might be Glassfish-specific, I don't have resources to test it in other app servers

Description

Using code like

<s:url var="url" beanclass="package.MyAction" prependContext="false"/>
<jsp:include page="${url}"/>

when DynamicMappingFilter is used instead of ServletDispatcher, results in FileNotFoundException being thrown.

It is because ErrorTrappingResponseWrapper, as documented in line 343 comment "// Wrap the response in a wrapper that catches errors (but not exceptions)", does NOT catch any exceptions. When jsp:include is used to include an action URL instead a JSP file, the include request goes down to the default servlet which doesn't return SC_NOT_FOUND error code but throws a FileNotFoundException.

I have worked around the issue by changing

chain.doFilter(request, wrapper);

in DynamicMappingFilter.doFilter() method to

try { chain.doFilter(request, wrapper); } catch (FileNotFoundException fnfex) { fnfthrown = true; }

and manually overriding wrapper's errorCode to SC_NOT_FOUND in case the above exception is caught. I do not post entire patch because it's ugly and am hoping someone more knowledgeable with Stripes will be able to fix it better.

Activity

Hide
Frederic Daoud added a comment - 24/Sep/09 1:56 PM

Hmm. I'm not sure this is a bug. I think it is higher up, i.e. why is a FileNotFoundException being thrown in the first place? The sample code from
the Stripes book uses DynamicMappingFilter instead of ServletDispatcher along with <s:url> and <jsp:include> to include an action, just like you described, and it works fine.

Any chance you could try it out with Tomcat? I know you said "I don't have resources to test it in other app servers" but Tomcat is free And if by resources you mean time, well, if you don't have time to help out with the issue that you filed, then who does?

Show
Frederic Daoud added a comment - 24/Sep/09 1:56 PM Hmm. I'm not sure this is a bug. I think it is higher up, i.e. why is a FileNotFoundException being thrown in the first place? The sample code from the Stripes book uses DynamicMappingFilter instead of ServletDispatcher along with <s:url> and <jsp:include> to include an action, just like you described, and it works fine. Any chance you could try it out with Tomcat? I know you said "I don't have resources to test it in other app servers" but Tomcat is free And if by resources you mean time, well, if you don't have time to help out with the issue that you filed, then who does?
Hide
Grzegorz Krugły added a comment - 24/Sep/09 2:17 PM

Perhaps You are right and Glassfish should not throw the exception – that would be Glassfish's bug then and not the first of its annoyances.

By lack of resources I meant mainly time for learning different app servers, etc, because I'm in a middle of a project right now. That said, I have downloaded Apache Geronimo (my app uses EJBs so Tomcat alone wouldn't be enough) and have tried to deploy, but have no idea how to port data sources from Glassfish to Geronimo If someone suggests me how I can go about deploying sun-resources.xml to Geronimo, I will try it.

I'll be able to play with it all on my own no earlier than in two months, but if the issue is still open until then, I will surely do so.

Show
Grzegorz Krugły added a comment - 24/Sep/09 2:17 PM Perhaps You are right and Glassfish should not throw the exception – that would be Glassfish's bug then and not the first of its annoyances. By lack of resources I meant mainly time for learning different app servers, etc, because I'm in a middle of a project right now. That said, I have downloaded Apache Geronimo (my app uses EJBs so Tomcat alone wouldn't be enough) and have tried to deploy, but have no idea how to port data sources from Glassfish to Geronimo If someone suggests me how I can go about deploying sun-resources.xml to Geronimo, I will try it. I'll be able to play with it all on my own no earlier than in two months, but if the issue is still open until then, I will surely do so.
Hide
Frederic Daoud added a comment - 24/Sep/09 2:22 PM

Thanks Grzegorz. I'd love to help out but right now all I have is working code. Maybe you could post the relevant portions of your application, just enough so that I can reproduce the problem? Off the top of my head, I guess that would be your web.xml, the action bean that is the target of your request, the action bean that is the target of the include, and the JSP that has the include.

Show
Frederic Daoud added a comment - 24/Sep/09 2:22 PM Thanks Grzegorz. I'd love to help out but right now all I have is working code. Maybe you could post the relevant portions of your application, just enough so that I can reproduce the problem? Off the top of my head, I guess that would be your web.xml, the action bean that is the target of your request, the action bean that is the target of the include, and the JSP that has the include.
Hide
Frederic Daoud added a comment - 24/Sep/09 2:28 PM

I'll test my code in Glassfish and see if I can reproduce the problem.

Show
Frederic Daoud added a comment - 24/Sep/09 2:28 PM I'll test my code in Glassfish and see if I can reproduce the problem.
Hide
Frederic Daoud added a comment - 24/Sep/09 2:31 PM

Which version of Glassfish are you using, so that we can compare red apples to red apples?

Show
Frederic Daoud added a comment - 24/Sep/09 2:31 PM Which version of Glassfish are you using, so that we can compare red apples to red apples?
Hide
Grzegorz Krugły added a comment - 24/Sep/09 2:35 PM

I'm using Glassfish 2.1. I e-mailed You my whole webapp, don't want to post it here.

Show
Grzegorz Krugły added a comment - 24/Sep/09 2:35 PM I'm using Glassfish 2.1. I e-mailed You my whole webapp, don't want to post it here.
Hide
Frederic Daoud added a comment - 25/Sep/09 9:24 PM

Reproduced the problem in GlassFish.
Fixed in revision 1150.

Show
Frederic Daoud added a comment - 25/Sep/09 9:24 PM Reproduced the problem in GlassFish. Fixed in revision 1150.

People

Vote (0)
Watch (0)

Dates

  • Created:
    24/Sep/09 12:28 PM
    Updated:
    04/Jan/11 1:46 PM
    Resolved:
    27/Oct/09 1:59 PM