Trouble porting an RI implementation into portal
mwelch16 Jul 17, 2006 2:23 PMHello,
I'm using the 2.2.1sp2 bundled version of jboss portal (downloaded). I'm using the built in hibernate virtual database and running JBoss on my PC (Windows XP). I am trying to integrate a JSF RI implementation into the portal. The JSF application currently runs in the 4.0.2 AS version of JBOSS. While integrating I am experiencing what appears to be conflicts between the RI and my faces. I don't know if it's a classpath issue, my war file, or an actual conflict. The portal seems to be trying to cast to a JBossRenderResponse and the RI code is using an HTTPServletResponse. Any advice would be helpful. I was hoping the RI application would work with very little change.
Thanks,
Mark
Here is the Exception:
java.lang.ClassCastException: org.jboss.portlet.JBossRenderResponse at com.nielsenmedia.datadelivery.console.Authenticator.authenticate(Authenticator.java:11) at com.nielsenmedia.datadelivery.console.MarketProcessedBean.<init>(MarketProcessedBean.java:43) at com.nielsenmedia.datadelivery.console.MarketProcessedMorningBean.<init>(MarketProcessedMorningBean.java:7) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at java.lang.Class.newInstance0(Class.java:350) at java.lang.Class.newInstance(Class.java:303) at org.apache.myfaces.util.ClassUtils.newInstance(ClassUtils.java:274) at org.apache.myfaces.util.ClassUtils.newInstance(ClassUtils.java:265) at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:49) at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:311) at org.apache.myfaces.el.ValueBindingImpl$ELVariableResolver.resolveVariable(ValueBindingImpl.java:569) at org.apache.commons.el.NamedValue.evaluate(NamedValue.java:124) at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:140) at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:378) at javax.faces.component.UIOutput.getValue(UIOutput.java:75) at org.apache.myfaces.renderkit.RendererUtils.getStringValue(RendererUtils.java:225) at org.apache.myfaces.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:131) at org.apache.myfaces.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:49) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:331) at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:349) at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:253)
Here is the code:
import javax.faces.context.FacesContext; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; public class Authenticator { public static void authenticate() throws Exception { FacesContext context = FacesContext.getCurrentInstance(); HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse(); LoginBean login = getLoginBean(); if (login == null || login.getUsername() == null || login.getPassword() == null || !login.login().equals(LoginBean.SUCCESS)) { response.sendRedirect("logout.jsp"); } } public static LoginBean getLoginBean() throws Exception { FacesContext context = FacesContext.getCurrentInstance(); HttpSession mySession = (HttpSession) context.getExternalContext().getSession(true); if (mySession.getAttribute("LoginBean") != null) { return (LoginBean) mySession.getAttribute("LoginBean"); } else { return null; } } }