3 Replies Latest reply on Sep 13, 2013 9:12 AM by Randall Hauch

    Checkin & Restore not work in 3.3.0

    Angelo Chen Newbie

      Checkin result in the issue [#MODE-1822] VersionManager.checkin throws exception in the transaction when using JTA transaction manager - JBoss Issue…

      restore will throw exception

           This session tried to save changes to node with key 'Cannot locate child node: a7ca237e3dd4402e7155ba-dd15-4547-8072-375827a09d17 within parent: a7ca237e3dd440b7b9eb53-14c6-4589-b640-143cb93a2e0c', but it was removed by another session.


      From the jira 1822 has been fixed, but still exist in my side.

       

      Environment:

           MacOS 10.8.4

           JDK 1.7.21

           modeshape 3.3.0 Final

           JTA Atomikos 3.9.0.M1

       

      JTA config for modeshape:

              <transaction

                      transactionManagerLookupClass="com.cms.jcr.AtomikosTransactionManagerLookup"

                      transactionMode="TRANSACTIONAL" lockingMode="OPTIMISTIC" />

       

      Related CND (partial):

      [jj:content] orderable

        - * (undefined) multiple

        - * (undefined)

        + * (jj:content) = jj:content sns

       

      [jj:page] >mix:versionable orderable

        - _title (string) mandatory

        - _metaTags (string)

      + * (jj:page) ignore

      + * (jj:content)

       

      1. when i checkin the node with type "jj:page", the issue https://issues.jboss.org/browse/MODE-1822 still exist. In view this, use checkpoint instead.

      2. when i checkpoint two version of page which has the a child typed "jj:content", and do the restore to previous version, exception

      This session tried to save changes to node with key 'Cannot locate child node: a7ca237e3dd4402e7155ba-dd15-4547-8072-375827a09d17 within parent: a7ca237e3dd440b7b9eb53-14c6-4589-b640-143cb93a2e0c', but it was removed by another session.

       

      1) for method which operate on the JCR all annotated with @Transactional

      2) transaction configuration

         <bean id="atomikosTransactionManagerLookup" class="com.cms.jcr.AtomikosTransactionManagerLookup">

              <property name="atomikosTransactionManager" ref="atomikosTransactionManager"/>

          </bean>

          <!-- Atomikos transaction manager -->

          <bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager"

                init-method="init" destroy-method="close" depends-on="dataSource">

              <property name="forceShutdown" value="false"/>

          </bean>

          <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp">

              <property name="transactionTimeout" value="30000"/>

          </bean>

          <bean id="dataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean"

                init-method="init" destroy-method="close">

              <property name="uniqueResourceName" value="applicationDatabase"/>

              <property name="xaDataSourceClassName" value="org.postgresql.xa.PGXADataSource"/>

              <property name="xaProperties">

                  <props>

                      <prop key="ServerName">${DATABASE_HOST}</prop>

                      <prop key="PortNumber">5432</prop>

                      <prop key="DatabaseName">${DATABASE_APPDB_NAME}</prop>

                      <prop key="User">${DATABASE_USERNAME}</prop>

                      <prop key="Password">${DATABASE_PASSWORD}</prop>

              </props>

              </property>

              <property name="minPoolSize" value="1" />

              <!--<property name="maxPoolSize" value="20"/>-->

              <!--<property name="minPoolSize" value="10"/>-->

              <property name="testQuery" value="select now()"/>

          </bean>

          <tx:annotation-driven transaction-manager="transactionManager"/>

          <bean id="transactionManager"

                class="org.springframework.transaction.jta.JtaTransactionManager">

              <property name="transactionManager" ref="atomikosTransactionManager"/>

              <property name="userTransaction" ref="atomikosUserTransaction"/>

          </bean>

          <bean id="sessionFactory"

                class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">

              <property name="packagesToScan" value="com.cms.model"/>

              <property name="dataSource" ref="dataSource"/>

              <property name="hibernateProperties">

                  <props>

                      <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQL82Dialect</prop>

                      <prop key="hibernate.current_session_context_class">jta</prop>

                      <prop key="hibernate.transaction.factory_class">

                          org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory

                      </prop>

                      <prop key="hibernate.transaction.manager_lookup_class">

                          com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup

                      </prop>

                  </props>

              </property>

          </bean>

       

      3) infinispan configuration:

          <global>

          </global>

          <default>

          </default>

          <namedCache name="persisted_repository">

              <loaders passivation="false" shared="false" preload="false">

                  <loader class="org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore"

                          fetchPersistentState="false" ignoreModifications="false"

                          purgeOnStartup="false">

                      <properties>

                          <property name="stringsTableNamePrefix" value="ISPN_STRING_TABLE"/>

                          <property name="idColumnName" value="ID_COLUMN"/>

                          <property name="dataColumnName" value="DATA_COLUMN"/>

                          <property name="timestampColumnName" value="TIMESTAMP_COLUMN"/>

                          <property name="timestampColumnType" value="BIGINT"/>

                          <property name="connectionFactoryClass" value="org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory"/>

                          <property name="connectionUrl" value="jdbc:postgresql://${DATABASE_HOST}:5432/${DATABASE_JCRDB_NAME}"/>

                          <property name="driverClass" value="org.postgresql.Driver"/>

                          <property name="userName" value="${DATABASE_USERNAME}"/>

                          <property name="password" value="${DATABASE_PASSWORD}"/>

                          <property name="idColumnType" value="VARCHAR(255)"/>

                          <property name="dataColumnType" value="BYTEA"/>

                          <property name="dropTableOnExit" value="false"/>

                          <property name="createTableOnStart" value="true"/>

                      </properties>

                  </loader>

              </loaders>

              <transaction

                      transactionManagerLookupClass="com.cms.jcr.AtomikosTransactionManagerLookup"

                      transactionMode="TRANSACTIONAL" lockingMode="OPTIMISTIC" />

          </namedCache>