13 Replies Latest reply on Sep 28, 2007 7:53 AM by pmuir

    Removal of commons-beanutils dependency

    pmuir

      We've run into a problem with deploying Seam ears to JBoss AS. This occurs because RichFaces depends on commons-beanutils, which bundles part of commons-collections (which is evil IMO). This means that if you bundle commons-beanutils in your ear (both under ear/lib and WEB-INF/lib) then there is significant risk that the *wrong* commons-collections classes are loaded (the ones from beanutils not collections) which then causes an UnboundedFifoError. I know we say to bundle commons-collections in WEB-INF/lib however I couldn't get this to work with Seam and JBoss AS.

      So, the proposal is to simply eliminate the commons-beanutils dependency from RichFaces.

        • 1. Re: Removal of commons-beanutils dependency
          maksimkaszynski

          There are five classes in richfaces runtime that rely on common-beanutils. Can we include those classes in richfaces source, like org.richfaces.org.apache? Or should we reimplement their functionality ourselves?

          • 2. Re: Removal of commons-beanutils dependency
            pmuir

            I believe that if the code is licensed using the ASL then we can include it in LGPL code, but we should check that. Copying in the necessary classes into org.richfaces package could be a good starting point - we can then cleanup/improve the source as necessary. I don't think implementing the functionality ourselves would be much more work - the beanutils just wrap up some basic reflection calls.

            • 3. Re: Removal of commons-beanutils dependency
              alexsmirnov

              Pete, can you provide exact FIFO buffer exception ?
              Richfaces 3.1 source code have a very sample Seam application, packaged into EAR.
              Maven build put all commons-* jars into EAR lib folder, and I never got such error.

              • 4. Re: Removal of commons-beanutils dependency
                gavin.king

                In general, my policy is "avoid commons-foobar crap like the plague". This stuff has historically been super-buggy, unmaintained, and full of incompatible changes between versions.

                Furthermore, it forces an extra jar dependency on users for some totally trivial crappy thing.

                If you *really* need to use some code out of commons, that would not take you 10 minutes to rewrite yourself, just copy and paste it (it's ASL licensed).

                • 5. Re: Removal of commons-beanutils dependency
                  pmuir

                  Sure

                  14:49:36,937 WARN [lifecycle] org.apache.commons.collections.UnboundedFifoBuffer
                  java.lang.ArrayStoreException: org.apache.commons.collections.UnboundedFifoBuffer
                   at org.ajax4jsf.component.AjaxViewRoot.clearEvents(AjaxViewRoot.java:251)
                   at org.ajax4jsf.component.AjaxViewRoot.getEvents(AjaxViewRoot.java:231)
                   at org.ajax4jsf.component.AjaxViewRoot.getEventsQueue(AjaxViewRoot.java:223)
                   at org.ajax4jsf.component.AjaxViewRoot.queueEvent(AjaxViewRoot.java:140)
                   at javax.faces.component.UIComponentBase.queueEvent(UIComponentBase.java:974)
                   at javax.faces.component.UIComponentBase.queueEvent(UIComponentBase.java:974)
                   at javax.faces.component.UICommand.queueEvent(UICommand.java:405)
                   at com.sun.faces.renderkit.html_basic.ButtonRenderer.decode(ButtonRenderer.java:104)
                   at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:764)
                   at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1006)
                   at javax.faces.component.UIForm.processDecodes(UIForm.java:203)
                   at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1001)
                   at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:493)
                   at org.ajax4jsf.component.AjaxViewRoot.access$001(AjaxViewRoot.java:59)
                   at org.ajax4jsf.component.AjaxViewRoot$1.invokeRoot(AjaxViewRoot.java:262)
                   at org.ajax4jsf.context.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:56)
                   at org.ajax4jsf.context.AjaxContextImpl.invokeOnRegionOrRoot(AjaxContextImpl.java:173)
                   at org.ajax4jsf.component.AjaxViewRoot.processDecodes(AjaxViewRoot.java:278)
                   at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:101)
                   at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                   at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
                   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                   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.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
                   at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                   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:44)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                   at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                   at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                   at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                   at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                   at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
                   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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                   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)
                  14:49:36,953 WARN [lifecycle] executePhase(APPLY_REQUEST_VALUES 2,com.sun.faces.context.FacesContex
                  tImpl@413ffc) threw exception
                  javax.faces.FacesException: org.apache.commons.collections.UnboundedFifoBuffer
                   at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:109)
                   at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                   at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
                   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                   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.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
                   at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                   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:44)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                   at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                   at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                   at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                   at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                   at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
                   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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                   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)
                  Caused by: java.lang.ArrayStoreException: org.apache.commons.collections.UnboundedFifoBuffer
                   at org.ajax4jsf.component.AjaxViewRoot.clearEvents(AjaxViewRoot.java:251)
                   at org.ajax4jsf.component.AjaxViewRoot.getEvents(AjaxViewRoot.java:231)
                   at org.ajax4jsf.component.AjaxViewRoot.getEventsQueue(AjaxViewRoot.java:223)
                   at org.ajax4jsf.component.AjaxViewRoot.queueEvent(AjaxViewRoot.java:140)
                   at javax.faces.component.UIComponentBase.queueEvent(UIComponentBase.java:974)
                   at javax.faces.component.UIComponentBase.queueEvent(UIComponentBase.java:974)
                   at javax.faces.component.UICommand.queueEvent(UICommand.java:405)
                   at com.sun.faces.renderkit.html_basic.ButtonRenderer.decode(ButtonRenderer.java:104)
                   at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:764)
                   at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1006)
                   at javax.faces.component.UIForm.processDecodes(UIForm.java:203)
                   at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1001)
                   at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:493)
                   at org.ajax4jsf.component.AjaxViewRoot.access$001(AjaxViewRoot.java:59)
                   at org.ajax4jsf.component.AjaxViewRoot$1.invokeRoot(AjaxViewRoot.java:262)
                   at org.ajax4jsf.context.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:56)
                   at org.ajax4jsf.context.AjaxContextImpl.invokeOnRegionOrRoot(AjaxContextImpl.java:173)
                   at org.ajax4jsf.component.AjaxViewRoot.processDecodes(AjaxViewRoot.java:278)
                   at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:101)
                   ... 41 more


                  You can see this in action if you build the booking example (from CVS), having edited /build/root.pom.xml and changed the version of commons-beanutils to 1.7.0.seam to 1.7.0

                  • 6. Re: Removal of commons-beanutils dependency
                    pmuir

                    I'm with Gavin on this one - commons-beanutils is especially weird due to it including part of commons-collections rather than just having it as a dependency as most normal libraries do.

                    • 7. Re: Removal of commons-beanutils dependency
                      alexsmirnov

                      Ok, this is not a commons-Beanutils problem, but commons-collections version incompability.
                      Since this is not a first problem in this code, I will swich into own events queue implementation.

                      • 8. Re: Removal of commons-beanutils dependency
                        pmuir

                        No, its not a commons-collections version incompatibility - AS 4.2.1.GA ships with collections 3.1 which *is* compatible with beanutils 1.7.0 (according to the beanutils website at least). And swapping this out for collections 3.2 in the AS doesn't help.

                        • 9. Re: Removal of commons-beanutils dependency
                          alexsmirnov
                          • 10. Re: Removal of commons-beanutils dependency
                            alexsmirnov

                            I did created JIRA issue for a this problem.
                            Also, I have a some problems with commons-digetester, wich have a strange dependencies from a JAXP implementations ( especially, it work wrong with Oracle OC4J server ).

                            • 11. Re: Removal of commons-beanutils dependency
                              pmuir

                              Thanks Alex, let me know if you need any help with this :)

                              • 12. Re: Removal of commons-beanutils dependency
                                alexsmirnov

                                Work in progress. 3.1.1-CR1 have no dependencies from buggy FifoBuffer class.

                                • 13. Re: Removal of commons-beanutils dependency
                                  pmuir

                                  Thanks Alex, just tested with Seam and its removed the problem under discussion!