[
https://issues.apache.org/struts/browse/STR-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul Benedict closed STR-2064.
------------------------------
Resolution: Won't Fix
Assignee: (was: Struts Developers)
The reporter mentions that there are 2 versions of the class loaded, and the
application server is wrongly choosing the one during casting. This to me
sounds more like a deployment configuration issue than a Struts development
error. Marking this as WONTFIX.
> ClassCastException in org.apache.struts.taglib.TagUtils.java
> ------------------------------------------------------------
>
> Key: STR-2064
> URL: https://issues.apache.org/struts/browse/STR-2064
> Project: Struts 1
> Issue Type: Improvement
> Components: Taglibs
> Affects Versions: Nightly Build
> Environment: Operating System: Linux
> Platform: Other
> Reporter: Rick Wong
> Priority: Minor
>
> Hi, I verified this problem with nightlybuild version
> jakarta-struts-20040506.tar.gz
> are.owm.widgets.search.filter_jsp threw exception
> java.lang.ClassCastException
> at
> org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java:1211)
> at org.apache.struts.taglib.TagUtils.message(TagUtils.java:1082)
> at org.apache.struts.taglib.TagUtils.message(TagUtils.java:1057)
> at
> org.apache.struts.taglib.bean.WriteTag.retrieveFormatString(WriteTag.java:256)
> at
> org.apache.struts.taglib.bean.WriteTag.formatValue(WriteTag.java:319)
> at
> org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:234)
> This happens in TagUtils.retrieveMessageResources()
> if (resources == null) {
> resources =
> (MessageResources) pageContext.getAttribute(
> bundle,
> PageContext.REQUEST_SCOPE);
> }
> When Struts tries to retrieve an INT format string (from a default bundle) to
> display an Integer. This condition may be the result of the way my JSP page
> is
> constructed.
> Basically, I have two web application with each bundling and loading the
> Struts
> library in its own class loader. My JSP page in Application X gets a
> RequestDispatcher from application Y and does an Include. This may result in
> the HttpServletRequest containing a MessageResources object loaded in
> application X in the request scope, and passed along to application Y (due to
> the Include). Since the MessageResources class is loaded in each of the
> application classloader in X and Y, the casting results in ClassCastException.
> At the moment, I am stuck. Could this be fixed by catching the
> ClassCastException inside TagUtils.retrieveMessageResource()?
> if (resources == null) {
> try {
> resources =
> (MessageResources) pageContext.getAttribute(
> bundle,
> PageContext.REQUEST_SCOPE);
> } catch (ClassCastException e) {}
> }
> Thanks!
> --
> Rick
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.