6 Replies Latest reply on Mar 29, 2013 8:06 AM by bwallis42

    Configuration for Modeshape 3.1.x, JBoss 7.1.1 and PostgreSQL

    amberg

      I'm looking for a configuration example where Modeshape 3.1.x  is used in JBoss 7.1.1.Final and the Modeshape data i stored in PostgreSQL.

      I think I've managed to figure out that I at least need to add these entries to the standalone.xml file used when starting JBoss

      1. A JDBC driver for PostgreSQL, described in the comments here (https://community.jboss.org/wiki/JBossAS7-DatasourceConfigurationForPostgresql)
      2. A datasource where the PostgreSQL driver is used
      3. An Infinispan local-cache using the new datasource
      4. A Modeshape repository using the new infinispan local cache

      but it's a bit unclear how the configuration should look.

      The best examples I've found so far is from this thread https://community.jboss.org/thread/204068  but when I base my configuration

      on the example in that thread and try to access my repository using http://localhost:8080/modeshape-rest/postgres I get an exception with a message stating "The 'postgres' repository cannot be started because transactions are not enabled. Please check your configuration."

       

      Anyone have a better configuration exemple or maybe a clue why I get the "transactions are not enabled" exception when i try to access the repository?

       

      /Pontus

        • 1. Re: Configuration for Modeshape 3.1.x, JBoss 7.1.1 and PostgreSQL
          rhauch
          1. A JDBC driver for PostgreSQL, described in the comments here (https://community.jboss.org/wiki/JBossAS7-DatasourceConfigurationForPostgresql)
          2. A datasource where the PostgreSQL driver is used
          3. An Infinispan local-cache using the new datasource
          4. A Modeshape repository using the new infinispan local cache

          These are the basic steps. Be sure that you've also set up a security domain (see our steps for configuring ModeShape in AS7 using CLI, or this section of our "standalone-modeshape.xml" file).

           

          Can you post the relevant parts of your "standalone.xml" file? It's easier for us to help you with your configuration if we can see it.

           

          The "repository cannot be started because transactions are not enabled" happens when the repository is started but there is no transaction manager available (from Infinispan). This typically means that the Infinispan cache you've configured does not have transactions enabled. Check the "transaction" element (see our example).

          • 2. Re: Configuration for Modeshape 3.1.x, JBoss 7.1.1 and PostgreSQL
            amberg

            I think I just found the reason for the "transaction not enabled". I had removed the "java:" part from the datasource as described in the https://community.jboss.org/thread/204068 thread. Inserting "java:" in front of the datasources at least let me access the repository through the modeshape-rest service without the encountering the "transaction not enabled" exception. Instead I now get tons of exceptions and warnings in the console about transaction problems so there is still something  wrong with the config.

             

            Some parts of the standalone.xml:

             

            The driver

            {code:xml}<driver name="postgresql" module="postgresql.postgresql"><xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class></driver>{code}

             

            The datasource using the driver

            {code:xml}<datasource jndi-name="java:jboss/datasources/JcrDataDS" pool-name="JcrData" enabled="true" use-java-context="true">

              <connection-url>jdbc:postgresql://localhost:5432/modeshape</connection-url>

              <driver>postgresql</driver>

              <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>

              <pool>

                <min-pool-size>3</min-pool-size>

                <max-pool-size>15</max-pool-size>

                <prefill>true</prefill>

              </pool>

              <security>

                <user-name>x</user-name>

                <password>y</password>

              </security>

              <validation>

                <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>

                <validate-on-match>true</validate-on-match>

                <background-validation>false</background-validation>

                <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>

              </validation>

              <timeout>

                <blocking-timeout-millis>60000</blocking-timeout-millis>

                <idle-timeout-minutes>15</idle-timeout-minutes>

              </timeout>

            </datasource>{code}

             

            The Infinspan cache using the datasource

            {code:xml}<local-cache name="postgres">

              <transaction mode="FULL_XA"/>

              <eviction strategy="LIRS" max-entries="5000"/>

              <string-keyed-jdbc-store datasource="java:jboss/datasources/JcrDataDS" preload="false" passivation="false" purge="false">

                <property name="databaseType">postgres</property>

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

                <string-keyed-table prefix="stringbased">

                  <id-column name="id" type="VARCHAR(200)"/>

                  <data-column name="data" type="BYTEA"/>

                  <timestamp-column name="version" type="BIGINT"/>

                </string-keyed-table>

              </string-keyed-jdbc-store>

            </local-cache>{code}

             

            The repository using the Infinispan cache

            {code:xml}<repository name="postgres" cache-name="postgres" cache-container="modeshape">

              <workspaces allow-workspace-creation="false">

                <workspace name="default"/>

              </workspaces>

              <sequencers>

                <sequencer name="delimited-text-sequencer" classname="org.modeshape.sequencer.text.DelimitedTextSequencer" module="org.modeshape.sequencer.text" splitPattern="," path-expression="/files(//*.csv[*])/jcr:content[@jcr:data] => /derived/text/delimited/$1"/>

                <sequencer name="fixed-width-text-sequencer" classname="org.modeshape.sequencer.text.FixedWidthTextSequencer" module="org.modeshape.sequencer.text" commentMarker="#" path-expression="/files(//*.txt[*])/jcr:content[@jcr:data] => /derived/text/fixedWidth/$1"/>

                <sequencer name="ddl-sequencer" classname="org.modeshape.sequencer.ddl.DdlSequencer" module="org.modeshape.sequencer.ddl" path-expression="/files(//*.ddl[*])/jcr:content[@jcr:data] => /derived/ddl/$1"/>

                <sequencer name="java-source-sequencer" classname="org.modeshape.sequencer.javafile.JavaFileSequencer" module="org.modeshape.sequencer.java" path-expression="/files//(*.java[*])/jcr:content[@jcr:data] => /derived/java"/>

                <sequencer name="java-class-sequencer" classname="org.modeshape.sequencer.classfile.ClassFileSequencer" module="org.modeshape.sequencer.java" path-expression="/files//(*.class[*])/jcr:content[@jcr:data] => /derived/class"/>

                <sequencer name="cnd-sequencer" classname="cnd" module="org.modeshape" path-expression="/files(//*.cnd[*])/jcr:content[@jcr:data] => /derived/cnd/$1"/>

                <sequencer name="msoffice-sequencer" classname="msoffice" module="org.modeshape.sequencer.msoffice" path-expression="/files(//*.(xls|ppt|doc)[*])/jcr:content[@jcr:data] => /derived/msoffice/$1"/>

                <sequencer name="teiid-model-sequencer" classname="model" module="org.modeshape.sequencer.teiid" path-expression="/files(//*.xmi[*])/jcr:content[@jcr:data] => /derived/teiid/models/$1"/>

                <sequencer name="teiid-vdb-sequencer" classname="vdb" module="org.modeshape.sequencer.teiid" path-expression="/files(//*.vdb[*])/jcr:content[@jcr:data] => /derived/teiid/vdbs/$1"/>

                <sequencer name="xsd-sequencer" classname="xsd" module="org.modeshape.sequencer.xsd" path-expression="/files(//*).xsd[*]/jcr:content[@jcr:data] => /derived/xsd/$1"/>

                <sequencer name="wsdl-sequencer" classname="wsdl" module="org.modeshape.sequencer.wsdl" path-expression="/files(//)*.wsdl[*]/jcr:content[@jcr:data] => /derived/wsdl/$1"/>

                <sequencer name="xml-sequencer" classname="xml" module="org.modeshape.sequencer.xml" path-expression="/files(//)*.xml[*]/jcr:content[@jcr:data] => /derived/xml/$1"/>

                <sequencer name="zip-sequencer" classname="zip" module="org.modeshape.sequencer.zip" path-expression="/files(//*.zip[*])/jcr:content[@jcr:data] => /derived/zip/$1"/>

                <sequencer name="image-sequencer" classname="image" module="org.modeshape.sequencer.image" path-expression="/files(//*.(png|jpg|gif)[*])/jcr:content[@jcr:data] => /derived/image/$1"/>

                <sequencer name="mp3-sequencer" classname="mp3" module="org.modeshape.sequencer.mp3" path-expression="/files(//*.mp3[*])/jcr:content[@jcr:data] => /derived/mp3/$1"/>

              </sequencers>

              <text-extractors>

                <text-extractor name="tika-extractor" classname="tika" module="org.modeshape.extractor.tika"/>

              </text-extractors>

            </repository>{code}

             

            Here are some of the warnings and errors I can see in the console when I access the repository using http://localhost:8080/modeshape-rest/postgres

            {noformat}22:33:17,003 ERROR [org.infinispan.loaders.jdbc.connectionfactory.ManagedConnectionFactory] (modeshape-cron-2-thread-1) ISPN008018: Sql failure retrieving connection from datasource: java.sql.SQLException: javax.resource.ResourceException: IJ000460: Error checking for a transaction

            Caused by: javax.resource.ResourceException: IJ000460: Error checking for a transaction

            Caused by: javax.resource.ResourceException: IJ000459: Transaction is not active: tx=TransactionImple < ac, BasicAction: 0:ffffc0a8000c:-5ddb2753:5123ee70:c status: ActionStatus.COMMITTING >

            22:28:24,881 ERROR [org.infinispan.interceptors.InvocationContextInterceptor] (http-localhost-127.0.0.1-8080-1) ISPN000136: Execution error: org.infinispan.loaders.CacheLoaderException: This might be related to https://jira.jboss.org/browse/ISPN-604

            Caused by: java.sql.SQLException: javax.resource.ResourceException: IJ000460: Error checking for a transaction

            Caused by: javax.resource.ResourceException: IJ000460: Error checking for a transaction

            Caused by: javax.resource.ResourceException: IJ000459: Transaction is not active: tx=TransactionImple < ac, BasicAction: 0:ffffc0a8000c:-5ddb2753:5123ee70:c status: ActionStatus.COMMITTING >

            22:28:24,912 ERROR [org.infinispan.transaction.TransactionCoordinator] (http-localhost-127.0.0.1-8080-1) ISPN000097: Error while processing 1PC PrepareCommand: org.infinispan.CacheException: org.infinispan.loaders.CacheLoaderException: This might be related to https://jira.jboss.org/browse/ISPN-604

            Caused by: org.infinispan.loaders.CacheLoaderException: This might be related to https://jira.jboss.org/browse/ISPN-604

            Caused by: java.sql.SQLException: javax.resource.ResourceException: IJ000460: Error checking for a transaction

            Caused by: javax.resource.ResourceException: IJ000460: Error checking for a transaction

            Caused by: javax.resource.ResourceException: IJ000459: Transaction is not active: tx=TransactionImple < ac, BasicAction: 0:ffffc0a8000c:-5ddb2753:5123ee70:c status: ActionStatus.COMMITTING >{noformat}

             

            I also get tons of these in the console

            {noformat}22:34:59,392 WARN  [com.arjuna.ats.jta] (Periodic Recovery) ARJUNA016037: Could not find new XAResource to use for recovering non-serializable XAResource XAResourceRecord < resource:null, txid:< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffc0a8000c:-17c7c6a:5123dfec:104, node_name=1, branch_uid=0:ffffc0a8000c:-17c7c6a:5123dfec:105, subordinatenodename=null, eis_name=unknown eis name >, heuristic: TwoPhaseOutcome.FINISH_OK com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord@3164af87 >

            22:34:59,393 WARN  [com.arjuna.ats.jta] (Periodic Recovery) ARJUNA016038: No XAResource to recover < formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffc0a8000c:-17c7c6a:5123dfec:104, node_name=1, branch_uid=0:ffffc0a8000c:-17c7c6a:5123dfec:105, subordinatenodename=null, eis_name=unknown eis name >

            22:34:59,397 WARN  [com.arjuna.ats.jta] (Periodic Recovery) ARJUNA016037: Could not find new XAResource to use for recovering non-serializable XAResource XAResourceRecord < resource:null, txid:< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffc0a8000c:-17c7c6a:5123dfec:10b, node_name=1, branch_uid=0:ffffc0a8000c:-17c7c6a:5123dfec:10c, subordinatenodename=null, eis_name=unknown eis name >, heuristic: TwoPhaseOutcome.FINISH_OK com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord@493fe166 >

            22:34:59,398 WARN  [com.arjuna.ats.jta] (Periodic Recovery) ARJUNA016038: No XAResource to recover < formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffc0a8000c:-17c7c6a:5123dfec:10b, node_name=1, branch_uid=0:ffffc0a8000c:-17c7c6a:5123dfec:10c, subordinatenodename=null, eis_name=unknown eis name >{noformat}

             

            /Pontus

            • 3. Re: Configuration for Modeshape 3.1.x, JBoss 7.1.1 and PostgreSQL
              rhauch

              Did you see this thread? AS7 string-keyed-jdbc-store configuration:

               

              Brian said this on the thread:

               

              Hmm. Got it to work by removing the leading "java:" from the datasource name.

               

              but he ran into a new problem. Brian, are you watching this thread? Did you ever get it to work?

              • 4. Re: Configuration for Modeshape 3.1.x, JBoss 7.1.1 and PostgreSQL
                amberg

                Yes I did see that thread and the https://community.jboss.org/thread/204068 thread and that was the reason

                I didn't include the "java:" part in my initial config. But I seem to get further by actually specifying

                the "java:" part in the datasource attribute. Might this be something that has changed in the latest releases

                (I'm using 3.1.2.Final)?

                 

                /Pontus

                • 5. Re: Configuration for Modeshape 3.1.x, JBoss 7.1.1 and PostgreSQL
                  amberg

                  After reading this thread https://community.jboss.org/thread/206688 i decided to skip the JBoss 7.1.1 & Modeshape 3.1.2 combination. I also noticed that theres a 7.1.3.Final tag availbale at https://github.com/jbossas/jboss-as/tags and that version at least seem to use Infinispan 5.1.7.Final.

                   

                  I did try to use 3.1.2 in 7.1.3 and it almost to works. Modeshape starts with no exceptions and it is possible to access the file based repositories. Accessing a repository using an Infinispan cache with a JDBC loader will still fail but in this case it fails since it hasn't been able to fully initialize the repository (after 10 minutes).

                   

                  If anyone else want to try the JBoss 7.1.3.Final + Modeshape 3.1.2.Final combination then you will probably encounter a ClassNotFoundException where a Hibernate annotation class is missing. The reason for this is that the annotation classes has been moved to its own module in 7.1.3. The fix for this seem to be to replace the dependency

                  {code:xml}<module name="org.hibernate"/>{code}

                  in /modules/org/hibernate/search-engine/4.1/module.xml with

                  {code:xml}<module name="org.hibernate.commons-annotations"/>{code}

                  Also notice that the standalone-modeshape.xml included in the modeshape-3.1.2.Final-jbossas-71-dist.zip probably can't be used directly since there's other changes in the 7.1.3 standalone.xml. The fix for this is to add the Modeshape stuff to your own standalone.xml based on the one included in 7.1.3.

                   

                  /Pontus

                  • 6. Re: Configuration for Modeshape 3.1.x, JBoss 7.1.1 and PostgreSQL
                    bwallis42

                    Randall Hauch wrote:

                     

                    Did you see this thread? AS7 string-keyed-jdbc-store configuration:

                     

                    Brian said this on the thread:

                     

                    Hmm. Got it to work by removing the leading "java:" from the datasource name.

                     

                    but he ran into a new problem. Brian, are you watching this thread? Did you ever get it to work?

                     

                    (6 weeks later, sorry, not watching) Unfortunatly not. I moved on to other things since the combination of infinispan, as 7.1.1 and modeshape was not working well. In the meantime the problem described in AS7-5424 seems to have been fixed in EAP 6.1 Alpha1.

                     

                    I've just restarted on this task with my performance testing of modeshape 3.2 (a snapshot from the 28th) in EAP 6.1 Alpha1. Having some familiar looking transaction problems again with a full database configuration (repository, binary and indexes all in the database).

                     

                    I'll start a new ticket once I have a bit more info on the problem, or maybe I'll find out I've just mucked up the configuration. Wouldn't be the first time