3 Replies Latest reply on Jul 16, 2007 4:02 PM by smigielski

    Issue when upgrading to Seam 1.3.0.ALPHA (CVS)

    fernando_jmt

      Hi,

      Using Seam 1.2.1 I had a relationship like:

      //User Entity.
      @ManyToMany(fetch = FetchType.LAZY)
       @JoinTable(
       name = "userrole",
       joinColumns = @JoinColumn(name = "userid"),
       inverseJoinColumns = @JoinColumn(name = "roleid")
       )
       @OrderBy("name asc")
       private List<Role> roles;
      

      And my respective page fragment for create/update such relationship was:
      <s:decorate template="/include/inputField.xhtml">
       <ui:define name="label">#{messages['User.assignRoles']}</ui:define>
       <h:selectManyCheckbox value="#{user.roles}" id="userRoles" tabindex="13" styleClass="checkBox">
       <s:selectItems value="#{rolesQuery.resultList}" var="role" label="#{messages[role.description]}"/>
       <s:convertEntity />
       </h:selectManyCheckbox>
      </s:decorate>
      
      


      Creating and updating user's roles was working well using seam 1.2.1.



      Yesterday I decided to upgrade my applicationt to Seam 1.3.0.APLHA, everything works fine except roles updating (creation works fine). I mean, if I create a user with 2 roles, then I open same user to edit it and I add or remove a role and then save the changes I get an java.lang.UnsupportedOperationException (I will put the stacktrace bottom).

      I think this is not the UnsupportedOperationException most people deal with it when migrating to JBoss 4.2. Application loads fine, works everywhere except this specific case I mentioned.

      -I checked every library in Seam and compare them with my app libraries in order to avoid any mistake.
      -I am sure I have my configuration files pointing 1.3 version.
      -My web.xml is fine.

      My application is running fine with Seam 1.2.1 (I did a backup), so I don't know what the problem could be, I guess it is something with JSF 1.2 RI or SEAM, but I'm not sure because I had to update both at same time (seam now uses JSF RI 1.2 as default) .

      Even I made an small test case (only the affected classes and operations without A4J or RichFaces support) in order to know if I was doing something wrong in my code (But I didn't touch anything before upgrading), but even in this test case I get the same error. I test it in JBoss 4.2.GA and Tomcat 6.0.13.

      Please help,


      Thanks in advance.


      Stacktrace:



      javax.faces.FacesException: #{userAction.update}: /admin/user.xhtml @165,120 action="#{userAction.update}": javax.ejb.EJBEx
      ception: java.lang.UnsupportedOperationException
       at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:105)
       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.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:64)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:60)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:81)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:47)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
       at org.jboss.seam.web.AbstractAjax4jsfFilter.doFilter(AbstractAjax4jsfFilter.java:35)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55)
       at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:126)
       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:228)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: javax.faces.FacesException: #{userAction.update}: /admin/user.xhtml @165,120 action="#{userAction.update}": java
      x.ejb.EJBException: java.lang.UnsupportedOperationException
       at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:107)
       at javax.faces.component.UICommand.broadcast(UICommand.java:383)
       at org.ajax4jsf.framework.ajax.AjaxActionComponent.broadcast(AjaxActionComponent.java:55)
       at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
       at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
       at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:346)
       at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
       ... 32 more
      Caused by: javax.faces.el.EvaluationException: /admin/user.xhtml @165,120 action="#{userAction.update}": javax.ejb.EJBExcep
      tion: java.lang.UnsupportedOperationException
       at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
       at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
       ... 38 more
      Caused by: javax.ejb.EJBException: java.lang.UnsupportedOperationException
       at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
       at org.jboss.aspects.tx.TxInterceptor$RequiresNew.invoke(TxInterceptor.java:266)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:81)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:189)
       at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
       at $Proxy76.update(Unknown Source)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:61)
       at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:72)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
       at org.jboss.seam.interceptors.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:40)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
       at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50)
       at org.javassist.tmp.java.lang.Object_$$_javassist_8.update(Object_$$_javassist_8.java)
       at com.psa.comapp.common.EntityAction.update(EntityAction.java:100)
       at com.psa.comapp.action.UserAction.update(UserAction.java:61)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:61)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
       at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:47)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:
      37)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:34)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:54)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.SecurityInterceptor.aroundInvoke(SecurityInterceptor.java:39)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
       at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
       at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
       at com.psa.comapp.action.UserAction_$$_javassist_7.update(UserAction_$$_javassist_7.java)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:325)
       at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:338)
       at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
       at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
       at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
       at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
       at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
       ... 39 more
      Caused by: java.lang.UnsupportedOperationException
       at java.util.AbstractList.remove(AbstractList.java:172)
       at java.util.AbstractList$Itr.remove(AbstractList.java:437)
       at java.util.AbstractList.removeRange(AbstractList.java:662)
       at java.util.AbstractList.clear(AbstractList.java:258)
       at org.hibernate.type.CollectionType.replaceElements(CollectionType.java:404)
       at org.hibernate.type.CollectionType.replace(CollectionType.java:449)
       at org.hibernate.type.TypeFactory.replace(TypeFactory.java:431)
       at org.hibernate.event.def.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:282)
       at org.hibernate.event.def.DefaultMergeEventListener.entityIsPersistent(DefaultMergeEventListener.java:132)
       at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:105)
       at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:51)
       at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:679)
       at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:663)
       at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:667)
       at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:201)
       at org.jboss.seam.persistence.EntityManagerProxy.merge(EntityManagerProxy.java:123)
       at com.psa.comapp.common.service.EntityControllerBean.update(EntityControllerBean.java:56)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
       at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
       at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:73)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
       at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:47)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:
      37)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
       at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
       at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagat
      ionInterceptor.java:57)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor
      .java:54)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
       ... 103 more
      


        • 1. Re: Issue when upgrading to Seam 1.3.0.ALPHA (CVS)
          gavin.king

          What is the class of the List that throws UOE? Use your debugger to find out.

          BTW, this is definitely not a Seam problem.

          • 2. Re: Issue when upgrading to Seam 1.3.0.ALPHA (CVS)
            fernando_jmt

             

            "gavin.king@jboss.com" wrote:
            What is the class of the List that throws UOE? Use your debugger to find out.


            After debugging I saw that the UOE is thrown by the class org.hibernate.type.CollectionType, in the method replaceElements.
            ...
            java.util.Collection result = ( java.util.Collection ) target;
            result.clear(); //just here
            ...
            


            When debugging I also saw that the collection is an ArrayList that has the correct value. I researched about possibles causes and it seems the most probable reason for this exception is that the ArrayList to be clear is unmodifiable, but I don't know why!

            Related UOE topic: http://forum.java.sun.com/thread.jspa?threadID=700412




            "gavin.king@jboss.com" wrote:

            BTW, this is definitely not a Seam problem.


            The debugging tells the exception is thrown by Hibernate, but it really does not involve it is the problem. Specially because hibernate libraries (bundled in seam) are the same in 1.3 and 1.2.1 version (so, nothing has changed), even I did upgrade to latest Hibernate libs and I got the same exception.

            I'm really stuck with this, hope someone can give me some hints regarding this, in the meantime I will go back to Seam 1.2.1, where all works fine (but I would like to use the upcoming 1.3).


            Any help would be appreciated.

            Thanks for your time.

            If someone wants to see this problem running, as I said before I have a test case for JBoss 4.2.GA and tomcat 6.0.10.







            • 3. Re: Issue when upgrading to Seam 1.3.0.ALPHA (CVS)
              smigielski

              HI,

              I manage to work around this by adding before invoking of merge method:

              List list = entity.getListProperty();
              entity.setListProperty(new ArrayList(list));



              Maybe there is some bug with jsf implementation of selectManyCheckbox, since I get it exactly the same way?

              regards,