You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vano Beridze <va...@silkroad.ge> on 2004/02/27 12:22:25 UTC

java.lang.ClassCastException

Hello

I've got
struts 1.1
sun jdk 1.4.2_03
Fedora Core 1

I have a simple application
one action that has two forwards.
One of them I want to costruct dynamically.

I created a plugin and in its init method I do the following

moduleConfig.addForwardConfig(new ForwardConfig("mypath","myurl",true));

when I do in the action
return mapping.findForward("mypath");

it gives me a classcast exception

java.lang.ClassCastException
	at
org.apache.struts.action.ActionMapping.findForward(ActionMapping.java:151)
	at com.silkroad.srm3.Login.execute(Login.java:42)

When I did some debugging found out that the exception is happening
because of the following code

return ((ActionForward) config);

in org.apache.struts.action.ActionMapping.java line 151

config contains a forward defined by me and has type
org.apache.struts.config.ForwardConfig

what should I do?
are there any other ways dinamically defining global forwards?

Thank you
Vano




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: java.lang.ClassCastException

Posted by Max Cooper <ma...@maxcooper.com>.
I am not sure this will be a complete solution to your problem, but try:

moduleConfig.addForwardConfig(new ActionForward("mypath","myurl",true));

ActionForm extends ForwardConfig, not the other way around.

-Max

On Fri, 2004-02-27 at 03:22, Vano Beridze wrote:
> Hello
> 
> I've got
> struts 1.1
> sun jdk 1.4.2_03
> Fedora Core 1
> 
> I have a simple application
> one action that has two forwards.
> One of them I want to costruct dynamically.
> 
> I created a plugin and in its init method I do the following
> 
> moduleConfig.addForwardConfig(new ForwardConfig("mypath","myurl",true));
> 
> when I do in the action
> return mapping.findForward("mypath");
> 
> it gives me a classcast exception
> 
> java.lang.ClassCastException
> 	at
> org.apache.struts.action.ActionMapping.findForward(ActionMapping.java:151)
> 	at com.silkroad.srm3.Login.execute(Login.java:42)
> 
> When I did some debugging found out that the exception is happening
> because of the following code
> 
> return ((ActionForward) config);
> 
> in org.apache.struts.action.ActionMapping.java line 151
> 
> config contains a forward defined by me and has type
> org.apache.struts.config.ForwardConfig
> 
> what should I do?
> are there any other ways dinamically defining global forwards?
> 
> Thank you
> Vano
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org