2 Replies Latest reply on Dec 18, 2006 1:28 PM by Mat Lowery

    ClassCastException when extending JBossPortlet

    Mat Lowery Newbie

      Environment:
      JBoss Portal/AS Version: Downloaded JBoss Portal + JBoss AS 2.4
      OS Platform: Windows XP
      Java: 1.4.2_12

      Problem:
      Extending JBossPortlet (using CatalogPortlet as a guide) yields a ClassCastException when render is called.

      PortletContainer.invokeRender() is calling JBossPortlet.render(RenderRequest, RenderResponse) with arguments of type RenderRequestImpl and RenderResponseImpl. JBossPortlet then attempts to cast those arguments to JBossRenderRequest and JBossRenderResponse which results in the exception.

      I'm sure I'm doing something stupid. Can anyone enlighten me?

      Note that my code (a subclass of JBossPortlet) never gets called.

      Stack Trace:

      java.lang.ClassCastException
       at org.jboss.portlet.JBossPortlet.render(JBossPortlet.java:384)
       at org.jboss.portal.portlet.container.PortletContainer.invokeRender(PortletContainer.java:519)
       ...
      


      portlet.xml:
       <portlet>
       <portlet-name>PentahoMenuPortlet</portlet-name>
       <portlet-class>
       org.pentaho.ui.portlet.PentahoMenuPortlet
       </portlet-class>
       <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>VIEW</portlet-mode>
       </supports>
       <portlet-info>
       <title>PentahoMenuPortlet</title>
       </portlet-info>
       </portlet>
      


      portlet-instances.xml:
       <deployment>
       <instance>
       <instance-id>PentahoMenuInstance</instance-id>
       <portlet-ref>PentahoMenuPortlet</portlet-ref>
       </instance>
       </deployment>
      


      default-object.xml:
      <deployments>
       <deployment>
       <parent-ref>default</parent-ref>
       <if-exists>overwrite</if-exists>
       <page>
       <page-name>Pentaho</page-name>
       <window>
       <window-name>NavigationPortletWindow</window-name>
       <instance-ref>NavigationPortletInstance</instance-ref>
       <region>navigation</region>
       <height>0</height>
       <properties>
       <property>
       <name>theme.windowRendererId</name>
       <value>emptyRenderer</value>
       </property>
       <property>
       <name>theme.decorationRendererId</name>
       <value>emptyRenderer</value>
       </property>
       <property>
       <name>theme.portletRendererId</name>
       <value>emptyRenderer</value>
       </property>
       </properties>
       </window>
       <window>
       <window-name>PentahoNewsWindow</window-name>
       <instance-ref>PentahoNewsInstance</instance-ref>
       <region>center</region>
       <height>0</height>
       </window>
       <window>
       <window-name>PentahoMenuWindow</window-name>
       <instance-ref>PentahoMenuInstance</instance-ref>
       <region>left</region>
       <height>0</height>
       </window>
       ...