[jboss-user] [JBoss Portal] - JBossRenderResponse cannot be cast to HttpServletResponse

Likurg do-not-reply at jboss.com
Thu Apr 16 04:49:23 EDT 2009


Hello. I have to make some additional code changes in project, which is built on jboss portal. Deployment is ok, but when I try to refres localhost:8080/portal page after deployment I get this:

  | java.lang.ClassCastException: org.jboss.portlet.JBossRenderResponse cannot be cast to javax.servlet.http.HttpServletResponse
  | 

This exception occurs in PhaseListener:

  | FacesContext facesContext = event.getFacesContext();
  | HttpServletResponse response = (HttpServletResponse)facesContext.getExternalContext().getResponse();
  | 

Here is configuration:
portlet.xml:

  | <portlet-app
  |    xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
  |    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |    xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
  |    version="1.0">
  |    <portlet>
  |       <portlet-name>SomePortlet</portlet-name>
  |       <portlet-class>
  |           some.some.MyfacesRepairedPortlet
  |       </portlet-class>
  |       <init-param>
  |          <name>default-view</name>
  |          <value>/jsp/welcome.jsp</value>
  |       </init-param>
  |       <supports>
  |          <mime-type>text/html</mime-type>
  |          <portlet-mode>VIEW</portlet-mode>
  |       </supports>
  |       <portlet-info>
  |          <title>Some Portlet</title>
  |       </portlet-info>
  |       <security-role-ref>
  |          <role-name>ADMIN</role-name>
  |          <role-name>ADMIN</role-name>
  |       </security-role-ref>
  |       
  |       <security-constraint>
  |       <portlet-collection>
  |          <web-resource-name>SomePortlet</web-resource-name>
  |          <url-pattern>*.jsp</url-pattern>
  |       </portlet-collection>
  |       <!--auth-constraint>
  |          <role-name>ADMIN</role-name>
  |       </auth-constraint-->
  |       <user-data-constraint>
  |          <transport-guarantee>NONE</transport-guarantee>
  |       </user-data-constraint>
  |    </security-constraint>
  |       
  |    </portlet>
  | </portlet-app>
  | 

portlet-instances.xml:


  | <?xml version="1.0" standalone="yes"?>
  | <deployments>
  |    <deployment>
  |       <instance>
  |          <instance-id>SomeInstance</instance-id>
  |          <portlet-ref>SomePortlet</portlet-ref>
  |       </instance>
  |    </deployment>
  | </deployments>
  | 

some-object.xml:


  | <?xml version="1.0" encoding="UTF-8"?>
  | <deployments>
  |    <deployment>
  |       <if-exists>overwrite</if-exists>
  |       <parent-ref>default.default</parent-ref>
  |       <window>
  |          <window-name>SomePortletWindow</window-name>
  |          <instance-ref>SomeInstance</instance-ref>
  |          <region>center</region>
  |          <height>1</height>
  |       </window>
  |       <security-constraint>
  |             <policy-permission>
  |                <role-definition>ADMIN</role-definition>
  |                <action-name>viewrecursive</action-name>
  |             </policy-permission>
  |          </security-constraint>
  |    </deployment>
  | </deployments>
  | 

jboss-web.xml:

  | <?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE jboss-web
  |     PUBLIC "-//JBoss//DTD Web Application 2.2//EN"
  |     "http://www.jboss.org/j2ee/dtd/jboss-web.dtd">
  | 
  | <jboss-web>
  |    <security-domain>java:/jaas/some</security-domain>
  | </jboss-web>
  | 

jboss-portlet.xml:

  | <?xml version="1.0" encoding="UTF-8"?>
  | <portlet-app>
  |    <portlet>
  |       <portlet-name>SomePortlet</portlet-name>
  |       <header-content>
  |          <link rel="stylesheet" type="text/css" href="/css/styles.css" title="" media="screen"/>
  |       </header-content>
  |    </portlet>
  | </portlet-app>
  | 

And finally:
MyFacesRepairedPortlet:

  | public class MyfacesRepairedPortlet extends MyFacesGenericPortlet{
  |    
  |    protected void facesRender(RenderRequest request, RenderResponse response) throws PortletException,
  |          java.io.IOException {
  |       if (sessionTimedOut(request) || request.getPortletSession().getAttribute(CURRENT_FACES_CONTEXT) == null) {
  |          setPortletRequestFlag(request);
  |          nonFacesRequest(request, response);
  |          return;
  |       }
  | 
  |       super.facesRender(request, response);
  |    }
  |    
  |    
  | }
  | 

Please help!!
With Best Wishes, Maxim

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4225827#4225827

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4225827



More information about the jboss-user mailing list