E-com DevBlog Spider-ball-vacuum

21Apr/100

Configuration is frozen

configuration-is-frozen

While in your Java development journey, if you find yourself getting an Error 500 NullPointerException and your console shows "IllegalStateException: Configuration is frozen", you could be the victim of what I experienced this week.

I wanted my forwarding to actually redirect to a new action so that the decorator would be applied to the new action instead of the current one, so I tried this approach:

forward = mapping.findForward("blahblah");
forward.setRedirect(true);

This doesn't work.  The reason is because the forward that you are using is defined in the struts config file, so you are attempting to modify an existing forward. This is not what you want to do because it will affect ALL future uses of that forward, hence the error. Here is the correct way to accomplish this:

forward = new ActionForward(mapping.findForward("blahblah"));
forward.setRedirect(true);

UPDATE: An astute reader pointed out that this is probably only an issue if you haven't set redirect="true" in your struts config, and that you should always set redirect to true if you are forwarding to another action anyway. Good catch Casey!

Print This Post Print This Post
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.