0 Replies Latest reply on Apr 21, 2015 4:22 AM by zhoule

    Modeshape can't load custom binaryStorage in grails project

    zhoule

      @

      Hi Guys,

       

      I was trying to setup a grails application with modeshape 3.7.2 Final, I met two issues, one is "Unable to load component metadata!" and the other is grails can't load custom binaryStorage, the first issue was resolved by comment out one line code in SpringLoadedPreProcessor.java and replace springloaded-*.jar in grails library directory. For the details please check https://github.com/spring-projects/spring-loaded/issues/95. But I have no idea how to fix the second issue, grails can't load the custom binary storage class when app start, the follow codes in RepositoryConfiguration.java will return null value.

      
      /*
       * Instantiates custom binary store.
       */
      private AbstractBinaryStore createInstance() throws Exception {
        ClassLoader classLoader = environment().getClassLoader(getClass().getClassLoader(), classPath);
         return (AbstractBinaryStore)classLoader.loadClass(classname).newInstance();
      }
      
      
      

      Would you guys give me a hand?

       

      Actually, the same codes works well with java + spring, failed in grails.

       

      Here are my project information:

      • Grails 2.4.3
      • Java 7
      • Modeshape 3.7.2
      • infinispan-cachestore-jdbc:5.3.0.Final
      • infinispan-core:5.3.0.Final

       

      Here is my repository-config.json

      
      {
        "name" : "Test-CMS",
        "jndiName" : "",
        "workspaces" : {
         "default" : "default",
         "predefined" : ["asset"],
         "allowCreation" : true
        },
        "storage" : {
         "cacheConfiguration" : "infinispan-configuration.xml",
         "cacheName" : "persisted_repository",
         "binaryStorage" : {
         "type" : "custom",
         "classname" : "com.test.jcr.EpicDatabaseBinaryStore",
         "driverClass": "org.postgresql.Driver",
         "connectionURL" : "jdbc:postgresql://localhost:5432/test",
         "username" : "test",
         "password" : "test"
         }
        }
      }
      
      
      

       

      Here is my infinspace-configuration.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="urn:infinispan:config:5.1 http://www.infinispan.org/schemas/infinispan-config-5.1.xsd"
         xmlns="urn:infinispan:config:5.1">
         <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://localhost:5432/test"/>
         <property name="driverClass" value="org.postgresql.Driver"/>
         <property name="userName" value="test"/>
         <property name="password" value="test"/>
         <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.test.jcr.AtomikosTransactionManagerLookup"
         transactionMode="TRANSACTIONAL" lockingMode="OPTIMISTIC" />
         </namedCache>
      
      </infinispan>