1 Reply Latest reply on Mar 25, 2011 2:30 PM by Jairo Henao

    Problems using binding in richfaces

    Jairo Henao Newbie

      Good day, i have the following problem.



      I have a seam application using richfaces. I need the richfaces-ui.jar in the ear it because i am building a rich:contextmenu from code and richfaces-ui.jar in the war for the pages. So far all is well.



      <rich:contextMenu id="menu" attached="false" binding="#{barraModuloAdministracionSistema}"/>




      I have problems using the binding on the page because a IllegalArgumentException is thrown when i open it.




      01:31:13,851 ERROR [STDERR] (,) 24/03/2011 01:31:13 AM com.sun.facelets.FaceletViewHandler handleRenderException
      GRAVE: Error Rendering View[/paginasPrincipales/adminsistema.xhtml]
      java.lang.IllegalArgumentException: Component j_id15:menu not instance of org.richfaces.component.UIContextMenu
              at org.ajax4jsf.renderkit.RendererBase.encodeBegin(RendererBase.java:94)
              at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:813)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:934)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942)
              at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
              at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
              at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
              at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:109)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
              at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
              at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
              at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
              at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
              at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
              at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
              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:182)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              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:262)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
              at java.lang.Thread.run(Thread.java:595)





      After much review the class (org.ajax4jsf.renderkit.RendererBase), i find that the error is caused in this line:



      if (!getComponentClass().isInstance(component)) throw new IllegalArgumentException(Messages.getMessage(Messages.COMPONENT_CLASS_ERROR, component.getClientId(context), getComponentClass().getName()));





      Have this:



      getComponentClass() returns -> class org.richfaces.component.UIContextMenu
      component.getClass() returns -> class org.richfaces.component.html.ContextMenu





      by inheritance UIContextMenu is a subclass of ContextMenu, so it should not fail, but seeing a bit beyond, I find the following:




      getComponentClass().getClassLoader() -> WebappClassLoader
      component.getClass().getClassLoader() -> org.jboss.mx.loading.UnifiedClassLoader






      I think what happens is that UIContextMenu is taken from the richfaces-ui.jar of war, and ContextMenu of richfaces-ui of ear, taking as true the condition and throws exception.


      ¿How could I fix this behavior?



      thanks



        • 1. Re: Problems using binding in richfaces
          Jairo Henao Newbie

          The problem was due to an error of libraries, leaving those of WAR and EAR so:


          deployed-jars-war.list



          commons-digester.jar
          jboss-seam-debug.jar
          jboss-seam-excel.jar
          jboss-seam-ioc.jar
          jboss-seam-mail.jar
          jboss-seam-pdf.jar
          jboss-seam-resteasy.jar
          jboss-seam-rss.jar
          jxl.jar




          deployed-jars-ear.list



          antlr-runtime.jar
          commons-beanutils.jar
          core.jar
          drools-templates.jar
          drools-decisiontables.jar
          drools-compiler.jar
          drools-api.jar
          drools-core.jar
          groovy-all.jar
          janino.jar
          jboss-el.jar
          jboss-seam-remoting.jar
          jbpm-jpdl.jar
          mvel2.jar
          richfaces-api.jar
          richfaces-impl.jar
          richfaces-ui.jar
          commons-lang.jar
          log4j.jar
          commons-digester.jar
          jboss-seam-ui.jar
          jsf-facelets.jar