7 Replies Latest reply on Aug 30, 2002 12:26 PM by pete

    Bug in jBoss 3.0.1RC1 CMR collection

    jhvaranda

      Hello,

      Jboss 3.0.1RC1
      Windows2000
      Oracle 8i

      I'm having a java.lang.IllegalStateException when I do the following in a one-to-many relationship:

      Collection result= new java.util.ArrayList();
      MyEntityBean entity = entityHome.findByPrimaryKey(pk);
      Collection cmrCollection = entity.getManySideCollection();
      result.addAll(cmrCollection);

      It's executed in a Stateless session bean and all methods involved are transaction demarcated as "Required".

      It works at the first time I execute but when I run it again, in the same VM or in another one, the exception is thrown!

      The same statements work fine in all previous releases:
      Jboss3.0.0 final
      Jboss3.0.0RC3

      Any ideas?

      Thanks,
      JH

      My jboss stack trace is:
      14:09:11,103 ERROR [LogInterceptor] TransactionRolledbackException, causedBy:
      java.lang.IllegalStateException: A CMR collection may only be used within the transction in which it was created
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.RelationSet.getIdList(RelationSet.java:58)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.RelationSet.size(RelationSet.java:65)
      at java.util.ArrayList.addAll(ArrayList.java:433)
      at prodasen.negocio.ejb.prodasenon.ProdasenONBean.getPessoasPorSituacao(ProdasenONBean.java:894)
      at prodasen.negocio.ejb.prodasenon.ProdasenONBean.getPessoasPorTipoSituacao(ProdasenONBean.java:735)
      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:324)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:664)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:176)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:129)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:183)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
      at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invoke(BaseLocalContainerInvoker.java:296)
      at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:81)
      at $Proxy780.getPessoasPorTipoSituacao(Unknown Source)
      at prodasen.negocio.ejb.processoon.ProcessoONBean.getProcessos(ProcessoONBean.java:834)
      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:324)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:664)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:176)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:129)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:183)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
      at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invoke(BaseLocalContainerInvoker.java:296)
      at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:81)
      at $Proxy779.getProcessos(Unknown Source)
      at prodasen.grhsf.desligamento.comissionado.ejb.DesligamentoONBean.obterListaServidoresPorFiltro(DesligamentoONBean.java:185)
      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:324)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:664)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:96)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:176)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:129)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:183)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
      at org.jboss.ejb.Container.invoke(Container.java:705)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362)
      at sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:536)

        • 1. Re: Bug in jBoss 3.0.1RC1 CMR collection
          dsundstrom

          If you are using Commit Option A, there is a known bug the causes the relation set to never be reset. It has been fixed in CVS. If you are not using Commit Option A, pleas post a bug report at sourceforge with a small reproducible testcase.

          • 2. Re: Bug in jBoss 3.0.1RC1 CMR collection
            jhvaranda

            Thanks Dain,

            I was using comit-option A. I'll get the latest version.

            • 3. Re: Bug in jBoss 3.0.1RC1 CMR collection
              pete

              Hi,

              I've just downloaded JBOSS 3.0.2 to get around this problem and its still occurring. Here's the sample code fomn the session bean which gets the problem:

              public void seeOrdersTest()
              {
              try
              {
              // get list of orders - CMRs - there are
              // two in this test
              Collection orders = this.orderLocalHome.findAll();
              Iterator it = orders.iterator();

              // get 1st order
              OrderLocal ol = (OrderLocal) it.next();

              // get list of order items - CMRs
              Collection items = ol.getOrderItems();
              }
              catch(Exception ex)
              {
              ex.printStackTrace();
              }

              The IllegalState exception (A CMR collectiomay only be used...) appears as soon as the second "Collection" line is executed. All beans are using the "Required" transaction attribute.

              Is this fixed anywhere? It becomes really pointless to use CMP2.0 relations when this issue crops up!

              Thanks in advance,

              Pete

              • 4. Re: Bug in jBoss 3.0.1RC1 CMR collection
                pete

                Hi,

                I've just downloaded JBOSS 3.0.2 to get around this problem and its still occurring. Here's the sample code fomn the session bean which gets the problem:

                public void seeOrdersTest()
                {
                try
                {
                // get list of orders - CMRs - there are
                // two in this test
                Collection orders = this.orderLocalHome.findAll();
                Iterator it = orders.iterator();

                // get 1st order
                OrderLocal ol = (OrderLocal) it.next();

                // get list of order items - CMRs
                Collection items = ol.getOrderItems();
                }
                catch(Exception ex)
                {
                ex.printStackTrace();
                }

                The IllegalState exception (A CMR collectiomay only be used...) appears as soon as the second "Collection" line is executed. All beans are using the "Required" transaction attribute.

                Is this fixed anywhere? It becomes really pointless to use CMP2.0 relations when this issue crops up!

                Thanks in advance,

                Pete

                • 5. Re: Bug in jBoss 3.0.1RC1 CMR collection
                  pete

                  Hi,

                  I've just downloaded JBOSS 3.0.2 to get around this problem and its still occurring. Here's the sample code fomn the session bean which gets the problem:

                  public void seeOrdersTest()
                  {
                  try
                  {
                  // get list of orders - CMRs - there are
                  // two in this test
                  Collection orders = this.orderLocalHome.findAll();
                  Iterator it = orders.iterator();

                  // get 1st order
                  OrderLocal ol = (OrderLocal) it.next();

                  // get list of order items - CMRs
                  Collection items = ol.getOrderItems();
                  }
                  catch(Exception ex)
                  {
                  ex.printStackTrace();
                  }

                  The IllegalState exception (A CMR collectiomay only be used...) appears as soon as the second "Collection" line is executed. All beans are using the "Required" transaction attribute.

                  Is this fixed anywhere? It becomes really pointless to use CMP2.0 relations when this issue crops up!

                  Thanks in advance,

                  Pete

                  • 6. Re: Bug in jBoss 3.0.1RC1 CMR collection
                    pete

                    Hi,

                    I've just downloaded JBOSS 3.0.2 to get around this problem and its still occurring. Here's the sample code fomn the session bean which gets the problem:

                    public void seeOrdersTest()
                    {
                    try
                    {
                    // get list of orders - CMRs - there are
                    // two in this test
                    Collection orders = this.orderLocalHome.findAll();
                    Iterator it = orders.iterator();

                    // get 1st order
                    OrderLocal ol = (OrderLocal) it.next();

                    // get list of order items - CMRs
                    Collection items = ol.getOrderItems();
                    }
                    catch(Exception ex)
                    {
                    ex.printStackTrace();
                    }

                    The IllegalState exception (A CMR collectiomay only be used...) appears as soon as the second "Collection" line is executed. All beans are using the "Required" transaction attribute.

                    Is this fixed anywhere? It becomes really pointless to use CMP2.0 relations when this issue crops up!

                    Thanks in advance,

                    Pete

                    • 7. Re: Bug in jBoss 3.0.1RC1 CMR collection
                      pete

                      Hi,

                      I've just downloaded JBOSS 3.0.2 to get around this problem and its still occurring. Here's the sample code fomn the session bean which gets the problem:

                      public void seeOrdersTest()
                      {
                      try
                      {
                      // get list of orders - CMRs - there are
                      // two in this test
                      Collection orders = this.orderLocalHome.findAll();
                      Iterator it = orders.iterator();

                      // get 1st order
                      OrderLocal ol = (OrderLocal) it.next();

                      // get list of order items - CMRs
                      Collection items = ol.getOrderItems();
                      }
                      catch(Exception ex)
                      {
                      ex.printStackTrace();
                      }

                      The IllegalState exception (A CMR collectiomay only be used...) appears as soon as the second "Collection" line is executed. All beans are using the "Required" transaction attribute.

                      Is this fixed anywhere? It becomes really pointless to use CMP2.0 relations when this issue crops up!

                      Thanks in advance,

                      Pete