6 Replies Latest reply on Mar 21, 2016 2:41 AM by rishianand50
      • 1. Re: Infinispan configuration for spring and storing data into mysql database ?
        zcc39r
        <?xml version="1.0" encoding="UTF-8"?>
        <infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xsi:schemaLocation="urn:infinispan:config:7.0 http://www.infinispan.org/schemas/infinispan-config-7.0.xsd
                    urn:infinispan:config:store:jdbc:7.0 http://www.infinispan.org/schemas/infinispan-cachestore-jdbc-config-7.0.xsd"
                    xmlns="urn:infinispan:config:7.0">
        
            <cache-container default-cache="mysqlrepo" statistics="false">
                <jmx duplicate-domains="true"/>
                <local-cache name="mysqlrepo">
                    <locking isolation="READ_COMMITTED"/>
                    <transaction mode="NON_DURABLE_XA" locking="PESSIMISTIC"/>
                    <eviction strategy="LIRS" max-entries="8192"/>
                    <mixed-keyed-jdbc-store purge="false" dialect="MYSQL" xmlns="urn:infinispan:config:store:jdbc:7.0">
                        <data-source jndi-url="java:jboss/datasources/MYSQLDS" />
                        <string-keyed-table prefix="stringbased">
                            <id-column name="id_column" type="VARCHAR(255) CHARACTER SET latin1 COLLATE latin1_general_cs"/>
                            <data-column name="data_column" type="BLOB"/>
                            <timestamp-column name="timestamp_column" type="BIGINT"/>
                        </string-keyed-table>
                        <binary-keyed-table prefix="binarybased">
                            <id-column name="id_column" type="VARCHAR(255) CHARACTER SET latin1 COLLATE latin1_general_cs"/>
                            <data-column name="data_column" type="BLOB"/>
                            <timestamp-column name="timestamp_column" type="BIGINT"/>
                        </binary-keyed-table>
                    </mixed-keyed-jdbc-store>
                </local-cache>
            </cache-container>
        </infinispan>
        
        • 2. Re: Infinispan configuration for spring and storing data into mysql database ?
          rishianand50

          How to configure mysql table as a data-source ? How can I set db ip, db username, db password ?

          <data-source jndi-url="java:jboss/datasources/MYSQLDS" /> 

          • 3. Re: Infinispan configuration for spring and storing data into mysql database ?
            rishianand50

            My repository-config.json file :

             

            {

                "name" : "sample",

                "monitoring" : {

                    "enabled" : true

                },

                "storage" : {

                    "cacheName" : "sampleRepository",

                    "cacheConfiguration" : "infinispan-configuration-mysql-async-eviction.xml",

                    "binaryStorage" : {

                        "type" : "file",

                        "directory": "${java.io.tmpdir}/modeshape_spring_sample/binaries",

                        "minimumBinarySizeInBytes" : 40

                    }

                },

                "workspaces" : {

                    "default" : "default",

                    "allowCreation" : true

                },

                "security" : {

                    "anonymous" : {

                        "roles" : ["readonly","readwrite","admin"],

                        "useOnFailedLogin" : false

                    }

                }

            }

            • 4. Re: Infinispan configuration for spring and storing data into mysql database ?
              zcc39r

              See Binary values

              You should have something like this:

                      "binaryStorage": {
                          "type"  : "database",
                          "driverClass" : "com.mysql.jdbc.Driver",
                          "url" : "jdbc:mysql://host/database",
              
              

              Tables will be created automatically.

              • 5. Re: Infinispan configuration for spring and storing data into mysql database ?
                zcc39r

                Yes, data-source is one of several ways to deal with database. You can use connection-pool or simple-connection also. See Infinispan User Guide.

                • 6. Re: Infinispan configuration for spring and storing data into mysql database ?
                  rishianand50

                  I am getting below error :


                  Cannot resolve reference to bean 'repositoryFactory' while setting bean property 'repository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'atomikosTransactionManagerLookup' defined in file [/usr/local/apache-tomcat-8.0.29/webapps/ROOT/WEB-INF/classes/spring/service/cliqr-mgmt-content-repository-context.xml]: Cannot resolve reference to bean 'transactionManager' while setting bean property 'atomikosTransactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in file [/usr/local/apache-tomcat-8.0.29/webapps/ROOT/WEB-INF/classes/spring/service/cliqr-mgmt-content-repository-context.xml]: Invocation of init method failed; nested exception is com.atomikos.icatch.SysException: UserTransactionServiceImp: property not defined: com.atomikos.icatch.service