10 Replies Latest reply on Jul 4, 2007 7:26 AM by Thomas Heute

    JBoss AS 4.2.0GA + JBoss Portal 2.6 + JSF 1.2 + JSFPortletBr

    Viggo Navarsete Expert

      Hi,

      I'm trying to develop my first portlet using the following:
      - JBoss Application Server 4.2.0GA
      - JBoss Portal 2.6

      What I've done so far is:
      1. Created a new portlet project in Netbeans 6M10.
      2. Added the JSFPortletBridge to WEB-INF/lib from here (https://jsfportletbridge.dev.java.net/) since that is required as far as I understand.
      3. Created web.xml looking like this (I'm planning to use jMaki so that's why you can see references to jmaki in web.xml):

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
       <context-param>
       <description>Switch off caching. You can remove this parameter or comment it out when this app goes into production.</description>
       <param-name>jmaki-usecache</param-name>
       <param-value>false</param-value>
       </context-param>
       <context-param>
       <param-name>com.sun.faces.verifyObjects</param-name>
       <param-value>false</param-value>
       </context-param>
       <context-param>
       <param-name>com.sun.faces.validateXml</param-name>
       <param-value>true</param-value>
       </context-param>
       <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>client</param-value>
       </context-param>
       <servlet>
       <servlet-name>XmlHttpProxy</servlet-name>
       <servlet-class>jmaki.xhp.XmlHttpProxyServlet</servlet-class>
       </servlet>
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
       <servlet-mapping>
       <servlet-name>XmlHttpProxy</servlet-name>
       <url-pattern>/xhp</url-pattern>
       </servlet-mapping>
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>/faces/*</url-pattern>
       </servlet-mapping>
       <session-config>
       <session-timeout>
       30
       </session-timeout>
       </session-config>
       <welcome-file-list>
       <welcome-file>faces/welcomeJSF.jsp</welcome-file>
       </welcome-file-list>
       </web-app>

      4. Created portlet.xml looking like this:
      <?xml version="1.0" encoding="UTF-8"?>
      <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 http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" version="1.0">
      
       <portlet>
       <description>Search</description>
       <portlet-name>Search</portlet-name>
       <display-name>Search</display-name>
       <!-- You must use this Portlet implementation class -->
       <portlet-class>com.sun.faces.portlet.FacesPortlet</portlet-class>
       <!-- This is a required parameter and must point to the first page of the JSF Application -->
       <init-param>
       <description>Portlet init view page</description>
       <name>com.sun.faces.portlet.INIT_VIEW</name>
       <value>/view.jsp</value>
       </init-param>
       <init-param>
       <description>Portlet init edit page</description>
       <name>com.sun.faces.portlet.INIT_EDIT</name>
       <value>/edit.jsp</value>
       </init-param>
       <init-param>
       <description>Portlet init help page</description>
       <name>com.sun.faces.portlet.INIT_HELP</name>
       <value>/help.jsp</value>
       </init-param>
       <expiration-cache>0</expiration-cache>
       <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>VIEW</portlet-mode>
       <portlet-mode>EDIT</portlet-mode>
       <portlet-mode>HELP</portlet-mode>
       </supports>
       <portlet-info>
       <title>Search</title>
       <short-title>Search</short-title>
       </portlet-info>
       </portlet>
      </portlet-app>


      When I deploy the war file I get a ClassCastException like this:
      12:58:46,633 ERROR [STDERR] Caused by: java.lang.ClassCastException: com.sun.faces.portlet.FacesPortlet
      12:58:46,633 ERROR [STDERR] at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.start(PortletContainerImpl.java:231)
      12:58:46,633 ERROR [STDERR] ... 73 more