the relevant code (in veltools 1.1's StrutsUtils) is doing the following:

        resources = (MessageResources) request.getAttribute(bundle +
moduleConfig.getPrefix());

        if (resources == null) {
            resources = (MessageResources) app.getAttribute(bundle +
moduleConfig.getPrefix());
        }

this seems to indicate that there is something in either your request
attributes or servlet context attributes under the key "destinationsX"
(where X is your module config prefix) that is not a MessageResources
object.  i'm not sure how this would happen, but it is.  for tracking
the problem down, you might first try retrieving that object yourself
and finding out what it is.  you might also grep your app to find any
other place that an object would end up in your request or servlet
context attributes with that same key, because something is probably
doing so and thus replacing the MessageResources object that should be
there.


On Wed, 9 Feb 2005 12:26:05 +0200, Markos Charatzas <[EMAIL PROTECTED]> wrote:
> Hi all,
> 
> I get this weird bug(?) with TextTool.
> On my struts-config.xml I declare the following message resource
> 
> <message-resources parameter="DestinationsResources" key="destinations" />
> 
> then in my template I use the textool to retrieve a value from that resource
> 
> $text.get('title.img', 'destinations')
> 
> and I get a ClassCastException with the following stack trace,
> ------------------------------------------------------------
> java.lang.ClassCastException
>  at org.apache.velocity.tools.struts.StrutsUtils.getMessageResources(Unknown
> Source)
>  at org.apache.velocity.tools.struts.MessageResourcesTool.getResources(Unknown
> Source)
>  at org.apache.velocity.tools.struts.MessageTool.get(Unknown Source)
>  at org.apache.velocity.tools.struts.MessageTool.get(Unknown Source)
> ....
> ------------------------------------------------------------
> 
> changed the "key" of the message resource to "destination" (notice the 's'
> missing)
> 
> using the new key value... and it works :/
> 
> thats using velocity-tools-1.1
> 
> I also have other resources that use the same notation,
> <message-resources parameter="IndexResources" key="index" />
> 
> and cause me no problems.
> 
> Thanks in advance,
> Markos Charatzas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to