2 Replies Latest reply on Jan 9, 2012 9:23 AM by Thorsten Nieser

    rich:push RF4.1.0 Final tomcat6/7 IllegalArgumentException

    Thorsten Nieser Newbie

      Hi all,

       

      I am currently trying to setup the rich:push feature without JMS support in RF4.1.0 Final - Tomcat6/7 - JDK6. (CDI impl)

      I collected all the jar files listed in the documentation and added the lines below to my project web.xml file. For testing I copied the example code of the 4.1.0 Final showcase. See below my Producer.xhtml, Receiver.xhtml and the JAVA Bean I use.

       

      I tried this example in tomcat6 and tomcat7 because I mentioned at first it is a tomcat7 problem. But after I managed it to setup my project with tomcat6 too I got exactly the same error in the log file:

       

      The server starts up and if I access the "receiver.xhtml" tomcat prints the following exception into the log.

      In "producer.xhtml" no error occurrs. The ajax calls goes out but nothing happens in "receiver.xhtml".

       

      What have I overlook? The showcase demo works pretty good :/

       

      http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=push&sample=pushCdi&skin=blueSky

       

       

       

      Thanks for your efforts and help!

       

      Regards

      Thorsten

       

      edit: I added a screenshot of my projects lib dir

       

       

      07.01.2012 11:19:44 org.apache.catalina.core.AprLifecycleListener init

      INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0_26\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\Entwicklung\apache-maven-3.0.3\bin;C:\Program Files\TortoiseSVN\bin;.

      07.01.2012 11:19:44 org.apache.tomcat.util.digester.SetPropertiesRule begin

      WARNUNG: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:CMS' did not find a matching property.

      07.01.2012 11:19:44 org.apache.coyote.http11.Http11Protocol init

      INFO: Initializing Coyote HTTP/1.1 on http-8080

      07.01.2012 11:19:44 org.apache.catalina.startup.Catalina load

      INFO: Initialization processed in 447 ms

      07.01.2012 11:19:44 org.apache.catalina.core.StandardService start

      INFO: Starting service Catalina

      07.01.2012 11:19:44 org.apache.catalina.core.StandardEngine start

      INFO: Starting Servlet Engine: Apache Tomcat/6.0.33

      07.01.2012 11:19:44 org.apache.catalina.loader.WebappClassLoader validateJarFile

      INFO: validateJarFile(D:\Entwicklung\Eclipse-Repo\.metadata\.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps\CMS\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

      07.01.2012 11:19:44 com.sun.faces.config.ConfigureListener contextInitialized

      INFO: Mojarra 2.0.4 (FCS b09) für Kontext '/CMS' wird initialisiert.

      07.01.2012 11:19:47 org.primefaces.webapp.PostConstructApplicationEventListener processEvent

      INFO: Running on PrimeFaces 3.0.RC2

      07.01.2012 11:19:47 org.richfaces.javascript.ClientServiceConfigParser parse

      WARNUNG: Found JavaScript function definition for class javax.validation.constraints.NotNull, but that class is not presented

      07.01.2012 11:19:47 org.richfaces.javascript.ClientServiceConfigParser parse

      WARNUNG: Found JavaScript function definition for class org.hibernate.validator.constraints.NotEmpty, but that class is not presented

      07.01.2012 11:19:47 org.richfaces.javascript.ClientServiceConfigParser parse

      WARNUNG: Found JavaScript function definition for class javax.validation.constraints.Size, but that class is not presented

      07.01.2012 11:19:47 org.richfaces.javascript.ClientServiceConfigParser parse

      WARNUNG: Found JavaScript function definition for class javax.validation.constraints.Pattern, but that class is not presented

      07.01.2012 11:19:47 org.richfaces.javascript.ClientServiceConfigParser parse

      WARNUNG: Found JavaScript function definition for class javax.validation.constraints.Min, but that class is not presented

      07.01.2012 11:19:47 org.richfaces.javascript.ClientServiceConfigParser parse

      WARNUNG: Found JavaScript function definition for class javax.validation.constraints.Max, but that class is not presented

      07.01.2012 11:19:47 org.richfaces.javascript.ClientServiceConfigParser parse

      WARNUNG: Found JavaScript function definition for class javax.validation.constraints.AssertTrue, but that class is not presented

      07.01.2012 11:19:47 org.richfaces.javascript.ClientServiceConfigParser parse

      WARNUNG: Found JavaScript function definition for class javax.validation.constraints.AssertFalse, but that class is not presented

      07.01.2012 11:19:47 org.richfaces.cache.CacheManager getCacheFactory

      INFO: Selected fallback cache factory

      07.01.2012 11:19:47 org.richfaces.cache.lru.LRUMapCacheFactory createCache

      INFO: Creating LRUMap cache instance using parameters: {com.sun.faces.expressionFactory=com.sun.el.ExpressionFactoryImpl,  org.richfaces.skin=glassX, org.richfaces.fileUpload.maxRequestSize=200000, javax.faces.PROJECT_STAGE=Development,  org.richfaces.fileUpload.createTempFiles=false, javax.faces.FACELETS_SKIP_COMMENTS=true, javax.faces.STATE_SAVING_METHOD=server, javax.faces.DEFAULT_SUFFIX=.xhtml, org.richfaces.push.jms.disable=true}

      07.01.2012 11:19:47 org.richfaces.cache.lru.LRUMapCacheFactory createCache

      INFO: Creating LRUMap cache instance of 512 items capacity

      07.01.2012 11:19:47 org.richfaces.application.InitializationListener onStart

      INFO: RichFaces Core Implementation by JBoss, a division of Red Hat, Inc., version v.4.1.0.Final

      07.01.2012 11:19:47 com.sun.faces.config.ConfigureListener$WebConfigResourceMonitor$Monitor <init>

      INFO: Monitoring jndi:/localhost/CMS/WEB-INF/faces-config.xml for modifications

      07.01.2012 11:19:47 com.sun.faces.lifecycle.ELResolverInitPhaseListener populateFacesELResolverForJsp

      INFO: JSF1027: [null Die ELResolvers für JSF wurden nicht im JSP-Container registriert.

      07.01.2012 11:19:47 org.apache.coyote.http11.Http11Protocol start

      INFO: Starting Coyote HTTP/1.1 on http-8080

      07.01.2012 11:19:47 org.apache.jk.common.ChannelSocket init

      INFO: JK: ajp13 listening on /0.0.0.0:8009

      07.01.2012 11:19:47 org.apache.jk.server.JkMain start

      INFO: Jk running ID=0 time=0/25  config=null

      07.01.2012 11:19:47 org.apache.catalina.startup.Catalina start

      INFO: Server startup in 3486 ms

      auth user: admin

      credentialsAuthorized: true

      username: admin

      permission to access the surface: true

      07.01.2012 11:20:11 org.apache.catalina.core.StandardWrapperValve invoke

      SCHWERWIEGEND: Servlet.service() for servlet Faces Servlet threw exception

      java.lang.IllegalArgumentException:

          at org.richfaces.application.push.TopicKey.<init>(TopicKey.java:76)

          at org.richfaces.application.push.TopicKey.<init>(TopicKey.java:58)

          at org.richfaces.application.push.TopicKey$1.apply(TopicKey.java:39)

          at org.richfaces.application.push.TopicKey$1.apply(TopicKey.java:37)

          at com.google.common.collect.Iterators$8.next(Iterators.java:751)

          at org.richfaces.application.push.impl.SessionImpl.createSubscriptions(SessionImpl.java:181)

          at org.richfaces.application.push.impl.SessionImpl.subscribe(SessionImpl.java:177)

          at org.richfaces.resource.PushResource.encode(PushResource.java:88)

          at org.richfaces.resource.UserResourceWrapperImpl.encode(UserResourceWrapperImpl.java:188)

          at org.richfaces.resource.ResourceHandlerImpl.handleResourceRequest(ResourceHandlerImpl.java:222)

          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:310)

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

          at org.richfaces.webapp.PushFilter.doFilter(PushFilter.java:130)

          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:233)

          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)

          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)

          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)

          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)

          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)

          at java.lang.Thread.run(Thread.java:662)


       

      Producer.xhtml

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:a4j="http://richfaces.org/a4j"
          xmlns:rich="http://richfaces.org/rich">
      
      <f:view contentType="text/html">
          <h:head>
          </h:head>
          <h:body>
              <h:form>
      
                  <h:panelGrid columns="3">
                      <h:outputLabel value="Message:" />
                      <h:inputText styleClass="message" value="#{pushBean.message}" />
      
                      <a4j:commandButton value="Send" action="#{pushBean.sendMessage}" execute="@form" />
                  </h:panelGrid>
      
              </h:form>
          </h:body>
      </f:view>
      </html>
      

       

       

      Receiver.xhtml

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:a4j="http://richfaces.org/a4j"
          xmlns:rich="http://richfaces.org/rich">
      
      <f:view contentType="text/html">
          <h:head>
          </h:head>
          <h:body>
              <h:form>
      
                  <h:panelGrid columns="3">
                      <a4j:push address="#{userIdentifier}@pushCdi"
                          ondataavailable="alert('Got message: ' + event.rf.data)" />
      
                      <ul id="messages" />
                  </h:panelGrid>
      
              </h:form>
          </h:body>
      </f:view>
      </html>
      

       

       

      PushBean


      import java.io.Serializable;
      import java.util.UUID;
      
      import javax.annotation.PostConstruct;
      import javax.enterprise.context.SessionScoped;
      import javax.enterprise.event.Event;
      import javax.inject.Inject;
      import javax.inject.Named;
      
      import org.richfaces.cdi.push.Push;
      
      @Named
      @SessionScoped
      public class PushBean implements Serializable {
      
          private static final long serialVersionUID = 1L;
          public static final String PUSH_CDI_TOPIC = "pushCdi";
      
          private String userIdentifier;
          private String message;
      
          @Inject
          @Push(topic = PUSH_CDI_TOPIC, subtopic = "#{pushBean.userIdentifier}")
          Event<String> pushEvent;
      
          @PostConstruct
          public void initialize() {
              if (userIdentifier == null) {
                  userIdentifier = getUUID().replace("-", "");
              }
          }
      
          /**
           * Sends message.
           *
           * @param message to send
           */
          public void sendMessage() {
              pushEvent.fire(message);
          }
      
          /**
           * Returns current user identifier.
           *
           * @return current user identifier.
           */
          public String getUserIdentifier() {
              return userIdentifier;
          }
      
          /**
           * Generates unique ID as string.
           *
           * @return unique ID as string.
           */
          public String getUUID() {
              return UUID.randomUUID().toString();
          }
      
          public String getMessage() {
              return message;
          }
      
          public void setMessage(String message) {
              this.message = message;
          }
      }
      

       

       

       

      web.xml

       

      ...  
       <context-param>
          <param-name>org.richfaces.push.jms.disable</param-name>
          <param-value>true</param-value>
        </context-param>
        <filter>
          <filter-name>PushFilter</filter-name>
          <filter-class>org.richfaces.webapp.PushFilter</filter-class>
        </filter>
        <filter-mapping>
          <filter-name>PushFilter</filter-name>
          <servlet-name>Faces Servlet</servlet-name>
        </filter-mapping>
      ...
      

       

       

      Used libs

       

      used_libs.jpg