5 Replies Latest reply on Oct 16, 2002 7:39 AM by adrian.brock

    JBoss3.0 -> JBoss3.0.3 Errors

    mik1

      Hi,

      I have an application that worked in JBoss 3.0.0 and I moved to 3.0.3 to try and fix an unrelated problem.

      Now my existing code is giving me the following error:
      javax.ejb.EJBException: A CMR collection may only be used within the transction in which it was created...

      :-?
      What is the trouble ?
      ( All the errors come from a SessionBean which use Local Entity relationship )

        • 1. Re: JBoss3.0 -> JBoss3.0.3 Errors

          How are your transactions configured?
          What does the code look like.

          Try setting org.jboss.ejb.plugins.TxInterceptorCMT
          to TRACE logging so you can see the transactions
          in the server.log

          Regards,
          Adrian

          • 2. Re: JBoss3.0 -> JBoss3.0.3 Errors
            mik1

            Here is the code of my Session Bean.
            User and Application are Local Entities.
            To make my code work under JBoss3.03, I must add the text in bold (UserTransaction).
            But all was working under JBoss3.0 ! :o

            public Collection getCurrentApplications( ) {
            Collection details = new ArrayList( );
            try {
            javax.transaction.UserTransaction trans = (javax.transaction.UserTransaction)new InitialContext().lookup("java:comp/UserTransaction");
            trans.begin();

            UserPK pk = new UserPK( this.currentUserLogin, this.currentOperatorName );
            User user = userHome.findByPrimaryKey( pk );
            Collection applications = user.getApplications( );
            for ( Iterator iter = applications.iterator( ); iter.hasNext( ); ) {
            Application application = ( Application ) iter.next( );
            ApplicationDetails applicationDetails = new ApplicationDetails( application.getName( ), application.getDescription( ), application.getMaxRightLevel( ) );
            details.add( applicationDetails );
            }
            trans.commit(); } catch( Exception e ) {
            throw new EJBException( e.getMessage( ) );
            }
            return details;
            }

            • 3. Re: JBoss3.0 -> JBoss3.0.3 Errors
              mik1

              Excuse me but where I can set org.jboss.ejb.plugins.TxInterceptorCMT to TRACE...

              in standardjboss.xml ???

              <container-interceptors>
              org.jboss.ejb.plugins.LogInterceptor
              org.jboss.ejb.plugins.SecurityInterceptor
              org.jboss.ejb.plugins.TxInterceptorCMT

              Where I put to TRACE ? :)
              Something like this ???

              • 4. Re: JBoss3.0 -> JBoss3.0.3 Errors

                server/[config]/conf/log4j.xml

                or the log4j service on http://localhost:8080

                Regards,
                Adrian

                • 5. Re: JBoss3.0 -> JBoss3.0.3 Errors

                  It sounds like you configured getCurrentApplications()
                  to not run with a transaction?
                  So a new transaction is started with
                  every Entity operation.

                  You should be able to see this in the trace.

                  Regards,
                  Adrian