Continutaion to my post Migrating to WebSphere Portal 6.1 ...
I had FacesContext Locator in the Project which I was migrating. The getFacesContext method gave me ClassCastException.
thrown : java.lang.ClassCastException: com.ibm.wps.pe.pc.legacy.impl.PortletConfigImpl incompatible with javax.servlet.ServletContext at com.ibm.faces.context.MultipartFacesContextFactoryImpl.getFacesContext(MultipartFacesContextFactoryImpl.java:60
With changes as highlighted I was able to over come this.
public class RIFacesContextLocator implements FacesContextLocator{ ...
public FacesContext getFacesContext(PortletRequest request,PortletResponse response) throws EPSConfigurationException {
FacesContextFactory contextFactory = null;
if (request != null) {
contextFactory = (FacesContextFactory) request.getAttribute(PortletConstants.CONTEXT_FACTORY);
}
if (contextFactory == null) {
try {
contextFactory = (FacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
} catch (FacesException e) {
e.printStackTrace();
}
}
if (contextFactory != null) {
try {
PortletContextWrapper contextWrapper = null;
if (null != contextFactory) {
contextWrapper = new PortletContextWrapper(this.config.getPortletContext());
contextWrapper.setPorletConfig(this.config);
/*
*Commented Out
*return contextFactory.getFacesContext(this.config,request, response, this.lifecycleLocator.getLifecycle(request,response));
*/
return contextFactory.getFacesContext(contextWrapper,request, response, this.lifecycleLocator.getLifecycle(request,
response));
}
}
catch (FacesException e) {
e.printStackTrace();
}
}
return FacesContext.getCurrentInstance();
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment