E-com DevBlog Spider-ball-vacuum

21Apr/100

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
Tagged as: , No Comments
7Mar/080

Updating Struts

So we all remember that you only edit the struts-config-ext.xml file right (you don't edit the plain struts-config.xml because IBM constantly overwrites that file when you push updates etc.)? Wrong, to avoid spinning wheels and wondering why nothing is working (your view that is) make sure that you edit both struts-config-ext and struts-config-live. This also cuts down on brow-beating, dead-horse-beating, and all around sheepishness.

Print This Post Print This Post