1 Reply Latest reply on Nov 12, 2007 4:24 PM by Viggo Navarsete

    RichFaces with Portlet

    philippe gouret Newbie

      Hi

      I try to use RichFaces 3.1 with JBoss Portal 2.6.1 (AS 4.2.1) with default Sun RI 1.2 JSF implementation. (is it possible to use RichFaces 3.1 with JBoss Portal 2.6 and AS 4.2.1 ?)

      I just tried to use the Calendar, and i got:

      java.lang.ClassCastException: org.apache.catalina.core.ApplicationContextFacade
      at com.sun.faces.portlet.FacesContextFactoryImpl.getFacesContext(FacesContextFactoryImpl.java:64)
      at org.ajax4jsf.resource.InternetResourceService.getFacesContext(InternetResourceService.java:317)
      at org.ajax4jsf.resource.InternetResourceService.getResourceContext(InternetResourceService.java:251)
      at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:162)
      at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:144)
      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:265)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:595)


      I got no error at deployment time.
      (messages are:
      11:44:48,843 INFO [CacheManager] Selected [org.ajax4jsf.cache.LRUMapCacheFactory] cache factory
      11:44:48,848 INFO [LRUMapCacheFactory] Creating LRUMap cache instance using parameters: {org.apache.myfaces.CHECK_EXTENSIONS_FILTER=false, com.sun.faces.injectionProvider=org.jboss.web.jsf.integration.injection.JBossInjectionProvider, org.richfaces.SKIN=blueSky, javax.faces.STATE_SAVING_METHOD=server}
      11:44:48,848 INFO [LRUMapCacheFactory] Creating LRUMap cache instance of default capacity
      11:44:48,877 INFO [CacheManager] Selected [org.ajax4jsf.cache.LRUMapCacheFactory] cache factory
      11:44:48,877 INFO [LRUMapCacheFactory] Creating LRUMap cache instance using parameters: {org.apache.myfaces.CHECK_EXTENSIONS_FILTER=false, com.sun.faces.injectionProvider=org.jboss.web.jsf.integration.injection.JBossInjectionProvider, org.richfaces.SKIN=blueSky, javax.faces.STATE_SAVING_METHOD=server}
      11:44:48,877 INFO [LRUMapCacheFactory] Creating LRUMap cache instance of default capacity)


      Here are my configuration files:

      portlet.xml:
      -------------

      <?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">

      <!-- use JSF-portlet bridge (sun) -->


      <portlet-name>TestPortlet</portlet-name>
      <portlet-class>com.sun.faces.portlet.FacesPortlet</portlet-class>

      <mime-type>text/html</mime-type>
      <portlet-mode>VIEW</portlet-mode>

      <portlet-info>
      tree test
      </portlet-info>

      <init-param>
      Portlet init view page
      com.sun.faces.portlet.INIT_VIEW
      /WEB-INF/jsp/test.jsp
      </init-param>



      </portlet-app>

      web.xml:
      ------------

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">

      <servlet-name>Faces Servlet</servlet-name>
      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
      <load-on-startup>1</load-on-startup>

      <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>/faces/*</url-pattern>
      </servlet-mapping>

      <!-- for RichFaces 3.1 -->


      <display-name>RichFaces Filter</display-name>
      <filter-name>richfaces</filter-name>
      <filter-class>org.ajax4jsf.Filter</filter-class>


      <filter-mapping>
      <filter-name>richfaces</filter-name>
      <servlet-name>Faces Servlet</servlet-name>
      REQUEST
      FORWARD
      INCLUDE
      </filter-mapping>


      <listener-class>com.sun.faces.config.ConfigureListener</listener-class>


      <context-param>
      <param-name>org.richfaces.SKIN</param-name>
      <param-value>blueSky</param-value>
      </context-param>

      </web-app>

      faces-config.xml:
      ----------------------

      <?xml version="1.0" encoding="UTF-8"?>

      <faces-config
      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-facesconfig_1_2.xsd"
      version="1.2">

      <managed-bean>
      test bean
      <managed-bean-name>testBean</managed-bean-name>
      <managed-bean-class>
      mg.proto.TestBean
      </managed-bean-class>
      <managed-bean-scope>request</managed-bean-scope>
      </managed-bean>

      <navigation-rule>
      </navigation-rule>

      </faces-config>

      Can you help me ?

      Thanks