You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Security Management <li...@secmgmt.com> on 2009/04/07 18:08:58 UTC

Error with ActionForward

Struts 2.1.6, here's my action.

<action name="saveRuleName" class="com.secmgmt.actions.SaveRule">
	<result name="success" type="redirectAction">
		<param name="actionName">addExceptionForm</param>
		<param name="rule">${rule}</param>
	</result>
</action>

public class AddExceptionForm extends SMCBaseAction
{

private IRule rule;

public IRule getRule()
        {
            return rule;
        }

    public void setRule(IRule r)
        {
            this.rule = r;
        }

public String execute()
        {
            return SUCCESS;
        }
}

This gives the following exception, even though it seems to generate the
proper URL:


2009-04-07 12:03:06,965 [http-8080-Processor23] ERROR
com.opensymphony.xwork2.ObjectFactory - Unable to set parameter [rule] in
result of type [org.apache.struts2.dispatcher.ServletActionRedirectResult]
Caught OgnlException while setting property 'rule' on type
'org.apache.struts2.dispatcher.ServletActionRedirectResult'. - Class:
ognl.ObjectPropertyAccessor
File: ObjectPropertyAccessor.java
Method: setProperty
Line: 163 - ognl/ObjectPropertyAccessor.java:163:-1
	at
com.opensymphony.xwork2.ognl.OgnlUtil.internalSetProperty(OgnlUtil.java:392)
	at
com.opensymphony.xwork2.ognl.OgnlUtil.setProperty(OgnlUtil.java:143)
	at
com.opensymphony.xwork2.ognl.OgnlReflectionProvider.setProperty(OgnlReflecti
onProvider.java:91)
	at
com.opensymphony.xwork2.ObjectFactory.buildResult(ObjectFactory.java:221)
	at
com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionIn
vocation.java:208)
	at
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionI
nvocation.java:355)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:265)


and so on, then this:

Caused by: ognl.NoSuchPropertyException:
org.apache.struts2.dispatcher.ServletActionRedirectResult.rule
	at
ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:163)
	at
com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAcces
sor.java:28)
	at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1950)
	at ognl.ASTProperty.setValueBody(ASTProperty.java:122)
	at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:210)
	at ognl.SimpleNode.setValue(SimpleNode.java:289)
	at ognl.Ognl.setValue(Ognl.java:737)
	at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:192)
	at
com.opensymphony.xwork2.ognl.OgnlUtil.internalSetProperty(OgnlUtil.java:385)
	... 88 more

This is not in agreement with the documentation, I don't think, which says
this (in the javadocs).   As far as I can tell, that's exactly what I am
doing:

<action name="gatherReportInfo" class="...">
       <result name="showReportResult" type="redirectAction">
          <param name="actionName">generateReport</param>
          <param name="namespace">/genReport</param>
          <param name="reportType">pie</param>
          <param name="width">100</param>
          <param name="height">100</param>
          <param name="empty"></param>
          <param name="supressEmptyParameters">true</param>
       </result>
</action>




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


RE: Error with ActionForward

Posted by Security Management <li...@secmgmt.com>.
Thanks for the reply.

My actionName was addExceptionForm in the redirect, but the action xml
element was actually addException, so it was a dumb mistake.

The exception showing up was a red-herring, and I agree that having it say
"ERROR" is confusing as all hell, because I was on the wrong track for quite
some time due to it.

I've been working at this too long, I just need a break.

-----Original Message-----
From: Nils-Helge Garli Hegvik [mailto:nilsga@gmail.com] 
Sent: Tuesday, April 07, 2009 12:44 PM
To: Struts Users Mailing List
Subject: Re: Error with ActionForward

Does it actually fail, or does it just print the exception in the log?
Do you have devMode on?

Nils-H

On Tue, Apr 7, 2009 at 6:08 PM, Security Management
<li...@secmgmt.com> wrote:
> Struts 2.1.6, here's my action.
>
> <action name="saveRuleName" class="com.secmgmt.actions.SaveRule">
>        <result name="success" type="redirectAction">
>                <param name="actionName">addExceptionForm</param>
>                <param name="rule">${rule}</param>
>        </result>
> </action>
>
> public class AddExceptionForm extends SMCBaseAction
> {
>
> private IRule rule;
>
> public IRule getRule()
>        {
>            return rule;
>        }
>
>    public void setRule(IRule r)
>        {
>            this.rule = r;
>        }
>
> public String execute()
>        {
>            return SUCCESS;
>        }
> }
>
> This gives the following exception, even though it seems to generate the
> proper URL:
>
>
> 2009-04-07 12:03:06,965 [http-8080-Processor23] ERROR
> com.opensymphony.xwork2.ObjectFactory - Unable to set parameter [rule] in
> result of type [org.apache.struts2.dispatcher.ServletActionRedirectResult]
> Caught OgnlException while setting property 'rule' on type
> 'org.apache.struts2.dispatcher.ServletActionRedirectResult'. - Class:
> ognl.ObjectPropertyAccessor
> File: ObjectPropertyAccessor.java
> Method: setProperty
> Line: 163 - ognl/ObjectPropertyAccessor.java:163:-1
>        at
>
com.opensymphony.xwork2.ognl.OgnlUtil.internalSetProperty(OgnlUtil.java:392)
>        at
> com.opensymphony.xwork2.ognl.OgnlUtil.setProperty(OgnlUtil.java:143)
>        at
>
com.opensymphony.xwork2.ognl.OgnlReflectionProvider.setProperty(OgnlReflecti
> onProvider.java:91)
>        at
> com.opensymphony.xwork2.ObjectFactory.buildResult(ObjectFactory.java:221)
>        at
>
com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionIn
> vocation.java:208)
>        at
>
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionI
> nvocation.java:355)
>        at
>
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
> on.java:265)
>
>
> and so on, then this:
>
> Caused by: ognl.NoSuchPropertyException:
> org.apache.struts2.dispatcher.ServletActionRedirectResult.rule
>        at
> ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:163)
>        at
>
com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAcces
> sor.java:28)
>        at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1950)
>        at ognl.ASTProperty.setValueBody(ASTProperty.java:122)
>        at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:210)
>        at ognl.SimpleNode.setValue(SimpleNode.java:289)
>        at ognl.Ognl.setValue(Ognl.java:737)
>        at
com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:192)
>        at
>
com.opensymphony.xwork2.ognl.OgnlUtil.internalSetProperty(OgnlUtil.java:385)
>        ... 88 more
>
> This is not in agreement with the documentation, I don't think, which says
> this (in the javadocs).   As far as I can tell, that's exactly what I am
> doing:
>
> <action name="gatherReportInfo" class="...">
>       <result name="showReportResult" type="redirectAction">
>          <param name="actionName">generateReport</param>
>          <param name="namespace">/genReport</param>
>          <param name="reportType">pie</param>
>          <param name="width">100</param>
>          <param name="height">100</param>
>          <param name="empty"></param>
>          <param name="supressEmptyParameters">true</param>
>       </result>
> </action>
>
>
>
>
> ---------------------------------------------------------------------
> 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


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


RE: Error with ActionForward

Posted by Martin Gainty <mg...@hotmail.com>.
1)what is IRule?

2)paramName="rule" is not declared
An example of passing a parameter (in this case id) to your Action Class 
 <result name="success" type="redirectAction">otherAction?id=${id}</result>
where otherAction Action Class accomodates parameter id by

   private int id;   //attribute declaration
   public int getId() { return this.id; } //accessor
   public void setId(int id) { this.id = id; } //mutator


Result params are typically used to locate a web resource such as
<param name="location">/ThankYou.jsp</param>


?
Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung / Note de déni et de confidentialité 

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.





 

> Date: Tue, 7 Apr 2009 18:43:40 +0200
> Subject: Re: Error with ActionForward
> From: nilsga@gmail.com
> To: user@struts.apache.org
> 
> Does it actually fail, or does it just print the exception in the log?
> Do you have devMode on?
> 
> Nils-H
> 
> On Tue, Apr 7, 2009 at 6:08 PM, Security Management
> <li...@secmgmt.com> wrote:
> > Struts 2.1.6, here's my action.
> >
> > <action name="saveRuleName" class="com.secmgmt.actions.SaveRule">
> >        <result name="success" type="redirectAction">
> >                <param name="actionName">addExceptionForm</param>
> >                <param name="rule">${rule}</param>
> >        </result>
> > </action>
> >
> > public class AddExceptionForm extends SMCBaseAction
> > {
> >
> > private IRule rule;
> >
> > public IRule getRule()
> >        {
> >            return rule;
> >        }
> >
> >    public void setRule(IRule r)
> >        {
> >            this.rule = r;
> >        }
> >
> > public String execute()
> >        {
> >            return SUCCESS;
> >        }
> > }
> >
> > This gives the following exception, even though it seems to generate the
> > proper URL:
> >
> >
> > 2009-04-07 12:03:06,965 [http-8080-Processor23] ERROR
> > com.opensymphony.xwork2.ObjectFactory - Unable to set parameter [rule] in
> > result of type [org.apache.struts2.dispatcher.ServletActionRedirectResult]
> > Caught OgnlException while setting property 'rule' on type
> > 'org.apache.struts2.dispatcher.ServletActionRedirectResult'. - Class:
> > ognl.ObjectPropertyAccessor
> > File: ObjectPropertyAccessor.java
> > Method: setProperty
> > Line: 163 - ognl/ObjectPropertyAccessor.java:163:-1
> >        at
> > com.opensymphony.xwork2.ognl.OgnlUtil.internalSetProperty(OgnlUtil.java:392)
> >        at
> > com.opensymphony.xwork2.ognl.OgnlUtil.setProperty(OgnlUtil.java:143)
> >        at
> > com.opensymphony.xwork2.ognl.OgnlReflectionProvider.setProperty(OgnlReflecti
> > onProvider.java:91)
> >        at
> > com.opensymphony.xwork2.ObjectFactory.buildResult(ObjectFactory.java:221)
> >        at
> > com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionIn
> > vocation.java:208)
> >        at
> > com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionI
> > nvocation.java:355)
> >        at
> > com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
> > on.java:265)
> >
> >
> > and so on, then this:
> >
> > Caused by: ognl.NoSuchPropertyException:
> > org.apache.struts2.dispatcher.ServletActionRedirectResult.rule
> >        at
> > ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:163)
> >        at
> > com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAcces
> > sor.java:28)
> >        at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1950)
> >        at ognl.ASTProperty.setValueBody(ASTProperty.java:122)
> >        at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:210)
> >        at ognl.SimpleNode.setValue(SimpleNode.java:289)
> >        at ognl.Ognl.setValue(Ognl.java:737)
> >        at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:192)
> >        at
> > com.opensymphony.xwork2.ognl.OgnlUtil.internalSetProperty(OgnlUtil.java:385)
> >        ... 88 more
> >
> > This is not in agreement with the documentation, I don't think, which says
> > this (in the javadocs).   As far as I can tell, that's exactly what I am
> > doing:
> >
> > <action name="gatherReportInfo" class="...">
> >       <result name="showReportResult" type="redirectAction">
> >          <param name="actionName">generateReport</param>
> >          <param name="namespace">/genReport</param>
> >          <param name="reportType">pie</param>
> >          <param name="width">100</param>
> >          <param name="height">100</param>
> >          <param name="empty"></param>
> >          <param name="supressEmptyParameters">true</param>
> >       </result>
> > </action>
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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
> 

_________________________________________________________________
Rediscover Hotmail®: Get quick friend updates right in your inbox. 
http://windowslive.com/RediscoverHotmail?ocid=TXT_TAGLM_WL_HM_Rediscover_Updates1_042009

Re: Error with ActionForward

Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
Does it actually fail, or does it just print the exception in the log?
Do you have devMode on?

Nils-H

On Tue, Apr 7, 2009 at 6:08 PM, Security Management
<li...@secmgmt.com> wrote:
> Struts 2.1.6, here's my action.
>
> <action name="saveRuleName" class="com.secmgmt.actions.SaveRule">
>        <result name="success" type="redirectAction">
>                <param name="actionName">addExceptionForm</param>
>                <param name="rule">${rule}</param>
>        </result>
> </action>
>
> public class AddExceptionForm extends SMCBaseAction
> {
>
> private IRule rule;
>
> public IRule getRule()
>        {
>            return rule;
>        }
>
>    public void setRule(IRule r)
>        {
>            this.rule = r;
>        }
>
> public String execute()
>        {
>            return SUCCESS;
>        }
> }
>
> This gives the following exception, even though it seems to generate the
> proper URL:
>
>
> 2009-04-07 12:03:06,965 [http-8080-Processor23] ERROR
> com.opensymphony.xwork2.ObjectFactory - Unable to set parameter [rule] in
> result of type [org.apache.struts2.dispatcher.ServletActionRedirectResult]
> Caught OgnlException while setting property 'rule' on type
> 'org.apache.struts2.dispatcher.ServletActionRedirectResult'. - Class:
> ognl.ObjectPropertyAccessor
> File: ObjectPropertyAccessor.java
> Method: setProperty
> Line: 163 - ognl/ObjectPropertyAccessor.java:163:-1
>        at
> com.opensymphony.xwork2.ognl.OgnlUtil.internalSetProperty(OgnlUtil.java:392)
>        at
> com.opensymphony.xwork2.ognl.OgnlUtil.setProperty(OgnlUtil.java:143)
>        at
> com.opensymphony.xwork2.ognl.OgnlReflectionProvider.setProperty(OgnlReflecti
> onProvider.java:91)
>        at
> com.opensymphony.xwork2.ObjectFactory.buildResult(ObjectFactory.java:221)
>        at
> com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionIn
> vocation.java:208)
>        at
> com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionI
> nvocation.java:355)
>        at
> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
> on.java:265)
>
>
> and so on, then this:
>
> Caused by: ognl.NoSuchPropertyException:
> org.apache.struts2.dispatcher.ServletActionRedirectResult.rule
>        at
> ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:163)
>        at
> com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAcces
> sor.java:28)
>        at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1950)
>        at ognl.ASTProperty.setValueBody(ASTProperty.java:122)
>        at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:210)
>        at ognl.SimpleNode.setValue(SimpleNode.java:289)
>        at ognl.Ognl.setValue(Ognl.java:737)
>        at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:192)
>        at
> com.opensymphony.xwork2.ognl.OgnlUtil.internalSetProperty(OgnlUtil.java:385)
>        ... 88 more
>
> This is not in agreement with the documentation, I don't think, which says
> this (in the javadocs).   As far as I can tell, that's exactly what I am
> doing:
>
> <action name="gatherReportInfo" class="...">
>       <result name="showReportResult" type="redirectAction">
>          <param name="actionName">generateReport</param>
>          <param name="namespace">/genReport</param>
>          <param name="reportType">pie</param>
>          <param name="width">100</param>
>          <param name="height">100</param>
>          <param name="empty"></param>
>          <param name="supressEmptyParameters">true</param>
>       </result>
> </action>
>
>
>
>
> ---------------------------------------------------------------------
> 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: Error with ActionForward

Posted by Lukasz Lenart <lu...@googlemail.com>.
2009/4/7 Security Management <li...@secmgmt.com>:
> Struts 2.1.6, here's my action.
>
> <action name="saveRuleName" class="com.secmgmt.actions.SaveRule">
>        <result name="success" type="redirectAction">
>                <param name="actionName">addExceptionForm</param>
>                <param name="rule">${rule}</param>
>        </result>
> </action>

You shouldn't use custom objects as a params, Ognl will change them to
Object.toString()

> public class AddExceptionForm extends SMCBaseAction
> {
>
> private IRule rule;

I suppose IRule is interface, which means Ognl doesn't know how to
create it, you have to use real object with default constructor


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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