getFacesContext().getExternalContext().redirect() giving java.lang.IllegalStateException.

I am using below code for navigaing to another page. I am invoking this action using command link.

[color=blue] public String goToPasswordPage()throws Exception {
IPortletURL editDataPageUrl = createRenderUrl() ;
editDataPageUrl.setBaseURL(“/” + getSearchResult().getPasswordPageAlias());
editDataPageUrl.clearState();

	IPortletURL editDataPortletUrl = editDataPageUrl.addPortletURL(getSearchResult().getPasswordPortletAlias());
	editDataPortletUrl.setParameter("ServerNamePerf", (String) resolveExpression("#{SearchResultDefaultviewView.searchResult.serverNameSearch}"));
    getFacesContext().getExternalContext().redirect(editDataPageUrl.toString());
	   return OUTCOME_OK;
}[/color]

After clicking on link window stay in same page and giving below error, please suggest if anybody face this issue.
MWS Log:–
2011-09-27 00:34:49 EST (javax.faces.component:ERROR) [RID:59] - java.lang.IllegalStateException
java.lang.IllegalStateException
at com.webMethods.caf.faces.data.object.ListTableContentProvider.setValue(ListTableContentProvider.java:245)
at com.webMethods.caf.faces.data.el.ContentProviderPropertyResolver.setValue(ContentProviderPropertyResolver.java:43)
at com.sun.faces.el.PropertyResolverChainWrapper.setValue(PropertyResolverChainWrapper.java:159)
at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:283)
at com.sun.faces.el.FacesCompositeELResolver.setValue(FacesCompositeELResolver.java:100)
at com.sun.el.parser.AstValue.setValue(AstValue.java:167)
at com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:269)
at com.sun.faces.application.ValueBindingValueExpressionAdapter.setValue(ValueBindingValueExpressionAdapter.java:152)
at com.webMethods.caf.faces.application.CAFValueBinding.setValue(CAFValueBinding.java:73)
at javax.faces.component.ValueExpressionValueBindingAdapter.setValue(ValueExpressionValueBindingAdapter.java:101)
at javax.faces.component.UIInput.updateModel(UIInput.java:771)
at javax.faces.component.UIInput.processUpdates(UIInput.java:703)
at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1081)
at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1081)
at com.webMethods.caf.faces.component.panel.BaseHideablePanel.processUpdates(BaseHideablePanel.java:149)
at com.webMethods.caf.faces.component.table.html.DataTable.processColumnChild(DataTable.java:1488)
at com.webMethods.caf.faces.component.table.html.DataTable.iterate(DataTable.java:1359)
at com.webMethods.caf.faces.component.table.html.DataTable.processUpdates(DataTable.java:981)
at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1081)
at com.webMethods.caf.faces.component.panel.BaseHideablePanel.processUpdates(BaseHideablePanel.java:149)
at javax.faces.component.UIForm.processUpdates(UIForm.java:260)
at com.webMethods.caf.faces.component.command.html.CommandForm.processUpdates(CommandForm.java:99)
at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1081)
at javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:728)
at com.webMethods.caf.faces.component.ViewRoot.processUpdates(ViewRoot.java:112)
at com.webMethods.caf.faces.portlet.PortletLifecycle$UpdateModelValuesPhase.execute(PortletLifecycle.java:706)
at com.webMethods.caf.faces.portlet.PortletLifecycle.phase(PortletLifecycle.java:261)
at com.webMethods.caf.faces.portlet.PortletLifecycle.execute(PortletLifecycle.java:151)
at com.webMethods.caf.faces.portlet.FacesPortlet.processAction(FacesPortlet.java:300)
at com.webMethods.portal.framework.portletcontainer.impl.PortletApplicationHandler.process(PortletApplicationHandler.java:480)
at com.webMethods.portal.framework.portletcontainer.servlet.PortletServlet.service(PortletServlet.java:58)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327)
at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)
at com.webMethods.portal.framework.portletcontainer.PortletContainer.dispatch(PortletContainer.java:219)
at com.webMethods.portal.framework.portletcontainer.PortletContainer.process(PortletContainer.java:130)
at com.webMethods.portal.framework.portletcontainer.PortletContainer.processPortletAction(PortletContainer.java:108)
at com.webMethods.portal.framework.portlet.beans.rest.RestfulPCAHandler.handle(RestfulPCAHandler.java:194)
at com.webMethods.portal.framework.dispatch.DispatchManager.handle(DispatchManager.java:438)
at com.webMethods.portal.framework.dispatch.DispatchManager.handleDispatch(DispatchManager.java:369)
at com.webMethods.portal.framework.impl.PortalServlet.service(PortalServlet.java:272)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at com.webMethods.portal.framework.impl.NTLMFilter.doFilter(NTLMFilter.java:50)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.webMethods.caf.faces.servlet.GZIPFilter.doFilter(GZIPFilter.java:42)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:451)
2011-09-27 00:34:49 EST (jsf:INFO) [RID:59] - java.lang.IllegalStateException: java.lang.IllegalStateException
2011-09-27 00:34:49 EST (Framework:INFO) [RID:60] - Processing request [srdq5318kn92:prahuu] http://203.14.65.145:8585/meta/default/wm_xt_fabricfolder/0000011281 (GET)
2011-09-27 00:34:50 EST (jsf:INFO) [RID:60] - java.lang.IllegalStateException: java.lang.IllegalStateException
2011-09-27 00:34:50 EST (jsf:INFO) [RID:60] - java.lang.IllegalStateException: java.lang.IllegalStateException
2011-09-27 00:34:50 EST (jsf:INFO) [RID:60] - java.lang.IllegalStateException: java.lang.IllegalStateException
2011-09-27 00:34:50 EST (jsf:INFO) [RID:60] - java.lang.IllegalStateException: java.lang.IllegalStateException
2011-09-27 00:34:50 EST (jsf:INFO) [RID:60] - java.lang.IllegalStateException: java.lang.IllegalStateException

Pradeep:

Check the result of editDataPageUrl.toString(). You need to use editDataPageUrl.getBaseUrl().

getBaseURL
String getBaseURL()Returns base url for this portlet url. By default it’s current portal resource, i.e. http://myotherportal:8080/

Returns:
current base url
See Also:
setBaseURL(String)

clearState
void clearState()

Clears the state of the url keeping just the baseUrl

Hi Norberto,

I checked the result of editDataPageUrl.toString() method–> “/spa.configManagement.Password.page?wmp_tc=11317&wmp_rt=render&wmp11289.ServerNamePerf=ESBGATEWAY” which is the correct url for the requested page with the post data.
I have also checked the result of editDataPageUrl.getBaseUrl() method–> “/spa.configManagement.Password.page” this url missing the post data.

But still i am getting the same error in both case and when I looked into the API:-

"
[color=blue]public abstract void redirect(java.lang.String url)
throws java.io.IOException

Redirect a request to the specified URL, and cause the responseComplete() method to be called on the FacesContext instance for the current request.

Servlet: This must be accomplished by calling the javax.servlet.http.HttpServletResponse method sendRedirect().

Portlet: This must be accomplished by calling the javax.portlet.ActionResponse method sendRedirect().

Parameters:
    url - Absolute URL to which the client should be redirected 
Throws:
    java.lang.IllegalArgumentException - if the specified url is relative 
    java.lang.IllegalStateException - if, in a portlet environment, the current response object is a RenderResponse instead of an ActionResponse [/color]"

Not sure how to manupulate response object here or convert it to ActionResponse.

Are you doing this redirect as a result of a Command? if so, is it an async Command, because it needs to be.
Regards,
–mark

Hi Pradeep,
Do you have any usage of ListTableContentProvider in either the source or target portlets.

[quote]
at com.webMethods.caf.faces.data.object.ListTableContentProvider.setValue(ListTableContentProvider.java:245)
at com.webMethods.caf.faces.data.el.ContentProviderPropertyResolver.setValue(ContentProviderPropertyResolver.java:43)

Because the error you’ve pasted seems to be complaining about the provider.
If your target is using this provider then there might be some problem with the way you’re either binding or rendering the values.

Mark,
I guess the redirect can be only used with a Command icon and not an async command.
When we implemented this in 7.1, we used a command icon to do the getFacesContext.redirect as suggested by a PS from software ag.

That’s correct. In fact, that is what i attempted to say in my last post. However, when re-reading my last post i see that my response made very little sense, or at least came nowhere near to making the point that i intended to make.