Announcement Announcement Module
Collapse
No announcement yet.
ACL Transaction must be running Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ACL Transaction must be running

    Hello everyone,

    I have a problem with ACLs.

    I implemented the Contacts application to run with my own database and it works just fine.

    Then i added another class to the acl-list called NewsEntry.

    NewsEntry has its won NewsEntryManagerBackend.

    Everything works as it should but once in a while i get this Error:
    Code:
    Request processing failed; nested exception is java.lang.IllegalArgumentException: Transaction must be running
    When i add a Contact first i never get this error. But when i add a NewsEntry i get this once in a while.

  • #2
    The ACLS package requires an active transaction otherwise it throws this exception. Have a look at the transactionManager/transactionInterceptor beans and add in the appropriate transactions attributes.

    Comment


    • #3
      Hey .. i need a bit of help on this matter

      this is my exception
      PHP Code:
      java.lang.IllegalArgumentExceptionTransaction must be running
          org
      .springframework.util.Assert.isTrue(Assert.java:65)
          
      org.springframework.security.acls.jdbc.JdbcMutableAclService.createOrRetrieveSidPrimaryKey(JdbcMutableAclService.java:223)
          
      org.springframework.security.acls.jdbc.JdbcMutableAclService.createObjectIdentity(JdbcMutableAclService.java:155)
          
      org.springframework.security.acls.jdbc.JdbcMutableAclService.createAcl(JdbcMutableAclService.java:108
      this is my configuration for transaction ...

      PHP Code:
      <bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor"
                
      p:transactionManager-ref="jdbcTransactionManager">
              <
      property name="transactionAttributeSource">
                  <
      value>
                      
      org.springframework.security.acls.jdbc.JdbcMutableAclService.createAcl=PROPAGATION_REQUIRED
                      org
      .springframework.security.acls.jdbc.JdbcMutableAclService.deleteAcl=PROPAGATION_REQUIRED
                      org
      .springframework.security.acls.jdbc.JdbcMutableAclService.updateAcl=PROPAGATION_REQUIRED
                      org
      .springframework.security.acls.MutableAcl.insertAce=PROPAGATION_REQUIRED
                      org
      .springframework.security.acls.MutableAcl.deleteAce=PROPAGATION_REQUIRED
                      org
      .springframework.security.acls.MutableAcl.updateAce=PROPAGATION_REQUIRED
                  
      </value>
              </
      property>
          </
      bean>

          <
      bean id="jdbcTransactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" p:dataSource-ref="dataSource"/> 
      can somebody please help me with this ?

      Kind regards

      Armando Ota
      Last edited by armandoxxx; Feb 26th, 2009, 04:57 AM.

      Comment


      • #4
        previous post was missleading ...


        This was taken from JdbcMutableAclService source
        PHP Code:
        /**
             * Retrieves the primary key from acl_sid, creating a new row if needed and the allowCreate property is
             * true.
             *
             * @param sid to find or create
             * @param allowCreate true if creation is permitted if not found
             *
             * @return the primary key or null if not found
             *
             * @throws IllegalArgumentException DOCUMENT ME!
             */
            
        protected Long createOrRetrieveSidPrimaryKey(Sid sidboolean allowCreate) {
                
        Assert.notNull(sid"Sid required");

                
        String sidName null;
                
        boolean principal true;

                if (
        sid instanceof PrincipalSid) {
                    
        sidName = ((PrincipalSidsid).getPrincipal();
                } else if (
        sid instanceof GrantedAuthoritySid) {
                    
        sidName = ((GrantedAuthoritySidsid).getGrantedAuthority();
                    
        principal false;
                } else {
                    throw new 
        IllegalArgumentException("Unsupported implementation of Sid");
                }

                List 
        sidIds jdbcTemplate.queryForList(selectSidPrimaryKey, new Object[] {new Boolean(principal), sidName},
                        
        Long.class);
                
        Long sidId null;

                if (
        sidIds.isEmpty()) {
                    if (
        allowCreate) {
                        
        sidId null;
                        
        jdbcTemplate.update(insertSid, new Object[] {new Boolean(principal), sidName});
                        
        Assert.isTrue(TransactionSynchronizationManager.isSynchronizationActive(),
                                
        "Transaction must be running");
                        
        sidId = new Long(jdbcTemplate.queryForLong(sidIdentityQuery));
                    }
                } else {
                    
        sidId = (LongsidIds.iterator().next();
                }

                return 
        sidId;
            } 
        the problem lies in the line
        PHP Code:
        Assert.isTrue(TransactionSynchronizationManager.isSynchronizationActive(),        "Transaction must be running"); 
        Can somebody please tell me if there is some sort of configuration needed to make TransactionSynchronizationManager work .. since I can't figure it out ...

        I'm developing on JBOSS AS and I dont use hibernate in my application ..

        Kind regards

        Armando
        Last edited by armandoxxx; Feb 26th, 2009, 08:50 AM.

        Comment


        • #5
          any1 ?

          Would greatly appreciate any help !

          kind regards

          Armando

          Comment


          • #6
            [SOLVED] exception: transaction must be running

            I'm using MYSQL server .. and some of the tables in the database where using MyISAM engine instead of InnoDB

            Kind regards

            Armando

            Comment


            • #7
              After trying out some more ... I still got the same Exception !!!

              This only happens when SID is not in the database and is inserted by Springs ACL automagic ...
              if someone else is having this problem please report .. might be a bug ...

              could use some help from developers to figure out the problem ...

              Kind regards

              Armando

              Comment


              • #8
                Hi ..

                I'm still strugling with this ...
                transaction is not started on aclService.createAcl method .. and I don't get it why !!!

                any help would be really appreciated

                PHP Code:

                <bean id="aclService" class="org.springframework.security.acls.jdbc.JdbcMutableAclService">
                        <
                constructor-arg ref="dataSource"/>
                        <
                constructor-arg ref="lookupStrategy"/> 
                        <
                constructor-arg ref="aclCache"/>
                    </
                bean>

                <
                bean id="jdbcTransactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" p:dataSource-ref="dataSource"/>
                    
                    <
                bean id="txProxyTemplate" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
                        <
                property name="transactionManager"><ref local="jdbcTransactionManager"/></property>
                        <
                property name="target"><ref local="aclService" /></property>
                        <
                property name="transactionAttributes">
                            <
                props>
                                <
                prop key="create*">PROPAGATION_REQUIRED</prop>
                                <
                prop key="update*">PROPAGATION_REQUIRED</prop>
                                <
                prop key="delete*">PROPAGATION_REQUIRED</prop>
                            </
                props>
                        </
                property>
                    </
                bean
                Kind regards

                Armando

                Comment

                Working...
                X