5 Replies Latest reply on Feb 28, 2012 6:15 AM by Nicolas Filotto

    Could not create a new Tx

    Rory Sambrano Newbie

      Hi,

       

      I'm trying to do some stuff with the JCR like create namespaces but I get this error:

      javax.jcr.RepositoryException: Could not create a new Tx: BaseTransaction.checkTransactionState - [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated] [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated] thread is already associated with a transaction!: BaseTransaction.checkTransactionState - [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated] [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated] thread is already associated with a transaction!

       

      Please help

        • 1. Re: Could not create a new Tx
          Nicolas Filotto Novice

          Please describe more your issue. What is your code? What is your data source configuration?...

          • 2. Re: Could not create a new Tx
            Rory Sambrano Newbie

            My gatein-ds.xml for jcr:

             

            <local-tx-datasource>

                  <jndi-name>gatein-jcr_portal</jndi-name>

                  <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}gatein${/}hypersonic${/}gatein-jcr_portal-localDB</connection-url>

                  <driver-class>org.hsqldb.jdbcDriver</driver-class>

                  <user-name>sa</user-name>

                  <password></password>

             

                  <min-pool-size>5</min-pool-size>

                  <max-pool-size>20</max-pool-size>

                  <idle-timeout-minutes>0</idle-timeout-minutes>

                  <prepared-statement-cache-size>32</prepared-statement-cache-size>

               </local-tx-datasource>

             

            My code:

             

                 PortalContainer container = RootContainer.getInstance().getPortalContainer("ecmdemo");

                 PortalContainer.setInstance(container);

             

                 RepositoryService repositoryService = (RepositoryService) container.getComponentInstanceOfType(RepositoryService.class);

                 repositoryService.setCurrentRepositoryName("repository");

             

                 Repository repository = repositoryService.getCurrentRepository();

                 Credentials cred = new SimpleCredentials("root","gtn".toCharArray());

             

                 Session session = repository.login(cred, "collaboration");

                 Workspace workspace = session.getWorkspace();

             

                 //JCR Stuff

                 workspace.getNamespaceRegistry().registerNamespace("myn", "mynamespace");

             

                 session.logout();

             

             

             

            Thanks

            • 3. Re: Could not create a new Tx
              Nicolas Filotto Novice

              This is weird, anyway your code even if it worked would only register the namespace at Runtime so it is not enough. If you want to register a namespace and persist it, you will need to add it in your configuration file. In the next example, I register 2 namespaces with their corresponding prefixes.

              ...
                <external-component-plugins>
                    <target-component>org.exoplatform.services.jcr.RepositoryService</target-component>
                  <component-plugin>
                    <name>add.namespaces</name>
                    <set-method>addPlugin</set-method>
                    <type>org.exoplatform.services.jcr.impl.AddNamespacesPlugin</type>
                    <init-params>
                      <properties-param>
                        <name>namespaces</name>
                        <property name="imd" value="http://www.exoplatform.com/image/metadata/1.0/"/>
                        <property name="mmd" value="http://www.exoplatform.com/media/metadata/1.0/"/>
                      </properties-param>
                    </init-params>
                  </component-plugin>
                </external-component-plugins>
              ...
              
              • 4. Re: Could not create a new Tx
                Rory Sambrano Newbie

                What abou if I need to remove node types that I registered within the content manager.  Anyway, any operation for create, update or delete gave the previous error

                • 5. Re: Could not create a new Tx
                  Nicolas Filotto Novice

                  I believe that your issue is not related to this, it is probably a consequence of a more general issue. Which product do you use? What is the exact version of it? Please provide the log file of your application server.