You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by kh...@wipro.com on 2005/11/02 12:41:46 UTC

"Configuration is frozen" exception thrown for actionMapping.setScope

Hi All,

In our application, we have decided to force all the actions to use the
request scope. So instead of adding scope ="request" in the <action>
element in struts-config.xml for each action, we extended the
RequestProcessor class as below

1.Extend the RequestProcessor class and add the config entry in
struts-config.xml
  <controller>
 <set-property  property="processorClass"
 value="CustomRequestProcessor"/>
</controller>

2.Override the processMapping method of RequestProcessor as below

      ActionMapping actionMapping= super.processMapping(request,
response, path);
      if (actionMapping!= null) {
        actionMapping.setScope("request");
      }
      return actionMapping;

However I get the exception at actionMapping.setScope("request");

java.lang.IllegalStateException: Configuration is frozen
....

I tried looking at the struts mailing list, The cause of the exception
is mentioned , however no workaround is suggested, My questions are

1.Is there any workaround to avoid the "Configuration is frozen"
exception
2.Is there any better way to enforce that all the actions to use some
specific scope (Ex: request)

Awaiting your replies and Thanks in Advance

Sajid





Confidentiality Notice

The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately
and destroy all copies of this message and any attachments.

Re: "Configuration is frozen" exception thrown for actionMapping.setScope

Posted by Hubert Rabago <hr...@gmail.com>.
On 11/2/05, khan.sajid@wipro.com <kh...@wipro.com> wrote:
>
> Hi All,
>
> In our application, we have decided to force all the actions to use the
> request scope. So instead of adding scope ="request" in the <action>
> element in struts-config.xml for each action, we extended the
> RequestProcessor class as below
>
<snip/>
>
> 1.Is there any workaround to avoid the "Configuration is frozen"
> exception

This happens when you try to change objects configured through
struts-config after the application has started up.


> 2.Is there any better way to enforce that all the actions to use some
> specific scope (Ex: request)

You can:
1) Implement a plugin that'll loop through the action mappings
configured and change their "scope" value.
2) Override the default ActionMapping class and set its default
"scope" value to request.

I'd probably try option (2).
You can take a look at the struts-examples.war sample application
[included in the struts download] for an example of how this is done.


>
> Awaiting your replies and Thanks in Advance
>
> Sajid

Hubert

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


Re: "Configuration is frozen" exception thrown for actionMapping.setScope

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Hi Sajid,

One way to get around this would be to modify the ActionConfig class's
freeze() method... just remove configured=true; and you should be all set
(I'm going from memory here, but I think I'm remembering right).  But, the
configs are frozen for a reason, so you may not want to do that.

Another option is to have a class in the struts.config package that has
the sole purpose of unfreezing an ActionConfig (by firectly setting
configured=false;).  The configured attribute of ActionConfig is
protected, that's why it would have to be in the same package.  Keep in
mind though that mapping instances are shared, so if you unfreeze a
mapping it is unfrozen for all requests.  You most likely will want to
clone the real, shared mapping, and then unfreeze the clone and continue
using that for the remainder of the request.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: fzammetti@hotmail.com

On Wed, November 2, 2005 6:41 am, khan.sajid@wipro.com said:
>
> Hi All,
>
> In our application, we have decided to force all the actions to use the
> request scope. So instead of adding scope ="request" in the <action>
> element in struts-config.xml for each action, we extended the
> RequestProcessor class as below
>
> 1.Extend the RequestProcessor class and add the config entry in
> struts-config.xml
>   <controller>
>  <set-property  property="processorClass"
>  value="CustomRequestProcessor"/>
> </controller>
>
> 2.Override the processMapping method of RequestProcessor as below
>
>       ActionMapping actionMapping= super.processMapping(request,
> response, path);
>       if (actionMapping!= null) {
>         actionMapping.setScope("request");
>       }
>       return actionMapping;
>
> However I get the exception at actionMapping.setScope("request");
>
> java.lang.IllegalStateException: Configuration is frozen
> ....
>
> I tried looking at the struts mailing list, The cause of the exception
> is mentioned , however no workaround is suggested, My questions are
>
> 1.Is there any workaround to avoid the "Configuration is frozen"
> exception
> 2.Is there any better way to enforce that all the actions to use some
> specific scope (Ex: request)
>
> Awaiting your replies and Thanks in Advance
>
> Sajid
>
>
>
>
>
> Confidentiality Notice
>
> The information contained in this electronic message and any attachments
> to this message are intended
> for the exclusive use of the addressee(s) and may contain confidential or
> privileged information. If
> you are not the intended recipient, please notify the sender at Wipro or
> Mailadmin@wipro.com immediately
> and destroy all copies of this message and any attachments.


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