8 Replies Latest reply on Oct 25, 2012 11:34 AM by Randall Hauch

    Problem saving data in database via infinispan

    forcam Newbie

      Hi,

       

      my goal is to save alle data (also binary) in an database instance. In my infinispan configuration i configure three caches (repositoryCache, dataCache

      and metadataCache).

      Here is my configuration file:

       

      <?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>
             <!-- Defines the global settings shared by all caches -->
          </global>
      
          <default>
             <!--
               Defines the default behavior for all caches, including those created dynamically (e.g., when a
               repository uses a cache that doesn't exist in this configuration).
             -->
          </default>
      
          <namedCache name="repositoryCache">
              <eviction strategy="LIRS" maxEntries="10" />
              <loaders passivation="false" shared="false" preload="true">
                  <loader class="org.infinispan.loaders.jdbc.binary.JdbcBinaryCacheStore" fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false">
                      <properties>
                          <property name="connectionFactoryClass" value="org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory"/>
                          <property name="connectionUrl" value="${database.jdbc.url}"/>
                          <property name="userName" value="${database.jdbc.username}"/>
                          <property name="password" value="${database.jdbc.password}"/>
                          <property name="driverClass" value="${database.jdbc.driverClassName}"/>
                          <property name="bucketTableNamePrefix" value="FR_MD"/>
                          <property name="idColumnName" value="ID_COLUMN"/>
                          <property name="idColumnType" value="CHARACTER VARYING(255)"/>
                          <property name="dataColumnName" value="DATA_COLUMN"/>
                          <property name="dataColumnType" value="BYTEA"/>
                          <property name="timestampColumnName" value="TIMESTAMP_COLUMN"/>
                          <property name="timestampColumnType" value="BIGINT"/>
                          <property name="dropTableOnExit" value="false"/>
                          <property name="createTableOnStart" value="true"/>
                      </properties>
                  </loader>
              </loaders>
      
              <transaction transactionManagerLookupClass="org.infinispan.transaction.lookup.DummyTransactionManagerLookup"
                           transactionMode="TRANSACTIONAL" lockingMode="OPTIMISTIC" />
             
          </namedCache>
          
          <namedCache name="dataCache">
              <eviction strategy="LIRS" maxEntries="10"/>
              <loaders passivation="false" shared="false" preload="true">
                  <loader class="org.infinispan.loaders.jdbc.binary.JdbcBinaryCacheStore" fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false">
                      <properties>
                          <property name="connectionFactoryClass" value="org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory"/>
                          <property name="connectionUrl" value="${database.jdbc.url}"/>
                          <property name="userName" value="${database.jdbc.username}"/>
                          <property name="password" value="${database.jdbc.password}"/>
                          <property name="driverClass" value="${database.jdbc.driverClassName}"/>
                          <property name="bucketTableNamePrefix" value="FR_MD"/>
                          <property name="idColumnName" value="ID_COLUMN"/>
                          <property name="idColumnType" value="CHARACTER VARYING(255)"/>
                          <property name="dataColumnName" value="DATA_COLUMN"/>
                          <property name="dataColumnType" value="BYTEA"/>
                          <property name="timestampColumnName" value="TIMESTAMP_COLUMN"/>
                          <property name="timestampColumnType" value="BIGINT"/>
                          <property name="dropTableOnExit" value="false"/>
                          <property name="createTableOnStart" value="true"/>
                      </properties>
                  </loader>
              </loaders>
              
              <transaction transactionManagerLookupClass="org.infinispan.transaction.lookup.DummyTransactionManagerLookup"
                           transactionMode="TRANSACTIONAL" lockingMode="OPTIMISTIC" />
             
          </namedCache>
          
          <namedCache name="metadataCache">
              <eviction strategy="LIRS" maxEntries="10"/>
              <loaders passivation="false" shared="false" preload="true">
                  <loader class="org.infinispan.loaders.jdbc.binary.JdbcBinaryCacheStore" fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false">
                      <properties>
                          <property name="connectionFactoryClass" value="org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory"/>
                          <property name="connectionUrl" value="${database.jdbc.url}"/>
                          <property name="userName" value="${database.jdbc.username}"/>
                          <property name="password" value="${database.jdbc.password}"/>
                          <property name="driverClass" value="${database.jdbc.driverClassName}"/>
                          <property name="bucketTableNamePrefix" value="FR_MD"/>
                          <property name="idColumnName" value="ID_COLUMN"/>
                          <property name="idColumnType" value="CHARACTER VARYING(255)"/>
                          <property name="dataColumnName" value="DATA_COLUMN"/>
                          <property name="dataColumnType" value="BYTEA"/>
                          <property name="timestampColumnName" value="TIMESTAMP_COLUMN"/>
                          <property name="timestampColumnType" value="BIGINT"/>
                          <property name="dropTableOnExit" value="false"/>
                          <property name="createTableOnStart" value="true"/>
                      </properties>
                  </loader>
              </loaders>
              
              <transaction transactionManagerLookupClass="org.infinispan.transaction.lookup.DummyTransactionManagerLookup"
                           transactionMode="TRANSACTIONAL" lockingMode="OPTIMISTIC" />
             
          </namedCache>
      
      </infinispan>
      

       

      Here is my json configuration file:

       

      {
          "name" : "configuration",
          "transactionMode" : "auto",
          "monitoring" : {
              "enabled" : true,
          },
          "workspaces" : {
              "predefined" : ["primaryWorkspace"],
              "default" : "default",
              "allowCreation" : true,
          },
          "node-types" : ["jcr/configurationNodeType.cnd"],
          "storage" : {
              "cacheName" : "repositoryCache",
              "binaryStorage" : {
                  "type" : "cache",
                  "dataCacheName" : "dataCache",
                  "metadataCacheName" : "metadataCache",
              },
          },
          "security" : {
              "anonymous" : {
                  "roles" : ["readonly","readwrite","admin"],
                  "useOnFailedLogin" : false
              },
          },
      }
      

       

      Here is my java code:

       

      final LocalEnvironment  env = new LocalEnvironment();
      env.defineCache("repositoryCache", mCache.getCacheConfiguration("repositoryCache"));
      env.defineCache("dataCache", mCache.getCacheConfiguration("dataCache"));
      env.defineCache("metadataCache", mCache.getCacheConfiguration("metadataCache"));
      
      // Konfiguration als Resource laden und mit dem Environment verbinden
      final URL  url = super.getClass().getClassLoader().getResource("jcr/repositoryConfiguration.json");
      final RepositoryConfiguration  repositoryConfiguration = RepositoryConfiguration.read(url).with(env);
      
      // Wenn Fehler bei dem Erstellen der Konfiguration aufgetreten sind, diese mitloggen
      final Problems  problems = repositoryConfiguration.validate();
      if (problems.hasErrors()) {
          for (Problem problem : problems) {
              LOGGER.error(problem.getMessageString());
          }
      }
      
      // Engine starten
      mEngine = new ModeShapeEngine();
      mEngine.start();
      mRepository = mEngine.deploy(repositoryConfiguration);
      
      // Login durchführen für eine Session
      final Session  session = mRepository.login("primaryWorkspace");
      

       

      When i start this program the following exception is thrown:

       

      Caused by: java.io.InvalidClassException: org.modeshape.jcr.value.binary.infinispan.Metadata; Class is non-public or has no public no-arg constructor

       

      Here is the complete stack strace:

       

      [ERROR]                             
      JdbcUtil.unmarshall(90): ISPN008009: I/O error while unmarshalling from stream
      
      java.io.InvalidClassException: org.modeshape.jcr.value.binary.infinispan.Metadata; Class is non-public or has no public no-arg constructor
      
      
      at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1254) ~[jboss-marshalling-river-1.3.11.GA.jar:1.3.11.GA]
      
      
      at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272) ~[jboss-marshalling-river-1.3.11.GA.jar:1.3.11.GA]
      
      
      at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209) ~[jboss-marshalling-river-1.3.11.GA.jar:1.3.11.GA]
      
      
      at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37) ~[jboss-marshalling-1.3.11.GA.jar:1.3.11.GA]
      
      
      at org.infinispan.container.entries.ImmortalCacheEntry$Externalizer.readObject(ImmortalCacheEntry.java:160) ~[infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.container.entries.ImmortalCacheEntry$Externalizer.readObject(ImmortalCacheEntry.java:150) ~[infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.marshall.jboss.ExternalizerTable$ExternalizerAdapter.readObject(ExternalizerTable.java:391) ~[infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.marshall.jboss.ExternalizerTable.readObject(ExternalizerTable.java:222) ~[infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:351) ~[jboss-marshalling-river-1.3.11.GA.jar:1.3.11.GA]
      
      
      at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209) ~[jboss-marshalling-river-1.3.11.GA.jar:1.3.11.GA]
      
      
      at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37) ~[jboss-marshalling-1.3.11.GA.jar:1.3.11.GA]
      
      
      at org.infinispan.loaders.bucket.Bucket$Externalizer.readObject(Bucket.java:157) ~[infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.loaders.bucket.Bucket$Externalizer.readObject(Bucket.java:139) ~[infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.marshall.jboss.ExternalizerTable$ExternalizerAdapter.readObject(ExternalizerTable.java:391) ~[infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.marshall.jboss.ExternalizerTable.readObject(ExternalizerTable.java:222) ~[infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:351) ~[jboss-marshalling-river-1.3.11.GA.jar:1.3.11.GA]
      
      
      at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209) ~[jboss-marshalling-river-1.3.11.GA.jar:1.3.11.GA]
      
      
      at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37) ~[jboss-marshalling-1.3.11.GA.jar:1.3.11.GA]
      
      
      at org.infinispan.marshall.jboss.AbstractJBossMarshaller.objectFromObjectStream(AbstractJBossMarshaller.java:154) ~[infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.marshall.VersionAwareMarshaller.objectFromByteBuffer(VersionAwareMarshaller.java:114) ~[infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.marshall.AbstractMarshaller.objectFromInputStream(AbstractMarshaller.java:112) ~[infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.marshall.AbstractDelegatingMarshaller.objectFromInputStream(AbstractDelegatingMarshaller.java:65) ~[infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.loaders.jdbc.JdbcUtil.unmarshall(JdbcUtil.java:88) ~[infinispan-cachestore-jdbc-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.loaders.jdbc.binary.JdbcBinaryCacheStore$1.loadAllProcess(JdbcBinaryCacheStore.java:125) ~[infinispan-cachestore-jdbc-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.loaders.jdbc.DataManipulationHelper.loadSome(DataManipulationHelper.java:249) ~[infinispan-cachestore-jdbc-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.loaders.jdbc.binary.JdbcBinaryCacheStore.loadLockSafe(JdbcBinaryCacheStore.java:312) ~[infinispan-cachestore-jdbc-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.loaders.LockSupportCacheStore.load(LockSupportCacheStore.java:165) ~[infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.loaders.CacheLoaderManagerImpl.loadState(CacheLoaderManagerImpl.java:202) [infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.loaders.CacheLoaderManagerImpl.preload(CacheLoaderManagerImpl.java:165) [infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_09]
      
      
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_09]
      
      
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_09]
      
      
      at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_09]
      
      
      at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:236) [infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.factories.AbstractComponentRegistry$PrioritizedMethod.invoke(AbstractComponentRegistry.java:885) [infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.factories.AbstractComponentRegistry.invokeStartMethods(AbstractComponentRegistry.java:639) [infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.factories.AbstractComponentRegistry.internalStart(AbstractComponentRegistry.java:628) [infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.factories.AbstractComponentRegistry.start(AbstractComponentRegistry.java:531) [infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.factories.ComponentRegistry.start(ComponentRegistry.java:174) [infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.CacheImpl.start(CacheImpl.java:521) [infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.manager.DefaultCacheManager.createCache(DefaultCacheManager.java:656) [infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.infinispan.manager.DefaultCacheManager.getCache(DefaultCacheManager.java:549) [infinispan-core-5.1.4.FINAL.jar:5.1.4.FINAL]
      
      
      at org.modeshape.jcr.value.binary.infinispan.InfinispanBinaryStore.start(InfinispanBinaryStore.java:145) [modeshape-jcr-3.0.0.CR2.jar:3.0.0.CR2]
      
      
      at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:1051) [modeshape-jcr-3.0.0.CR2.jar:3.0.0.CR2]
      
      
      at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:960) [modeshape-jcr-3.0.0.CR2.jar:3.0.0.CR2]
      
      
      at org.modeshape.jcr.JcrRepository.doStart(JcrRepository.java:352) [modeshape-jcr-3.0.0.CR2.jar:3.0.0.CR2]
      
      
      at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:609) [modeshape-jcr-3.0.0.CR2.jar:3.0.0.CR2]
      
      
      at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:578) [modeshape-jcr-3.0.0.CR2.jar:3.0.0.CR2]
      
      
      at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:147) [modeshape-jcr-3.0.0.CR2.jar:3.0.0.CR2]
      
      
      at com.forcam.na.configuration.ConfigurationService.initialize(ConfigurationService.java:324) [classes/:na]
      
      
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_09]
      
      
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_09]
      
      
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_09]
      
      
      at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_09]
      
      
      at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:346) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:299) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:132) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1448) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609) [spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) [spring-context-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469) [spring-context-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:103) [spring-test-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1) [spring-test-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.test.context.support.DelegatingSmartContextLoader.loadContext(DelegatingSmartContextLoader.java:228) [spring-test-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:124) [spring-test-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148) [spring-test-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109) [spring-test-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75) [spring-test-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321) [spring-test-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211) [spring-test-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288) [spring-test-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) [junit-4.10.jar:na]
      
      
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:290) [spring-test-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) [spring-test-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) [junit-4.10.jar:na]
      
      
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) [junit-4.10.jar:na]
      
      
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) [junit-4.10.jar:na]
      
      
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) [junit-4.10.jar:na]
      
      
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) [junit-4.10.jar:na]
      
      
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) [junit-4.10.jar:na]
      
      
      at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71) [spring-test-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.junit.runners.ParentRunner.run(ParentRunner.java:300) [junit-4.10.jar:na]
      
      
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) [spring-test-3.1.2.RELEASE.jar:3.1.2.RELEASE]
      
      
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) [.cp/:na]
      
      
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [.cp/:na]
      
      
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) [.cp/:na]
      
      
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) [.cp/:na]
      
      
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) [.cp/:na]
      
      
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) [.cp/:na]
      
      org.jboss.marshalling.TraceInformation: null
      

       

      Has anyone an idea?

       

       

      ------------------------------

      Peter

        • 1. Re: Problem saving data in database via infinispan
          Horia Chiorean Master

          I think this is definitively a bug, because the Metadata class implements Externalizable but does not have a public no-arg ctr, therefore violating the contract of the interface. Could you please log an issue against 3.0.Final ? (https://issues.jboss.org/browse/MODE)

          • 3. Re: Problem saving data in database via infinispan
            Randall Hauch Master

            forcam wrote:

             

            my goal is to save all data (also binary) in an database instance.

            I'm curious - have you considered using the JDBC binary store? If your goal is to persist everything in a relational database, then it'd probably make more sense to have the binary store talk directly to a database rather than to go through Infinispan. Anyway, you might want to try it to see what difference there is with your binary content.

            • 4. Re: Problem saving data in database via infinispan
              Randall Hauch Master

              forcam wrote:

               

              i've created an issue: https://issues.jboss.org/browse/MODE-1689

              Thanks for logging that, Peter. I've committed the fix (and some additional tests) into the 'master' branch, and this will be in the next release.

              • 5. Re: Problem saving data in database via infinispan
                forcam Newbie

                Hi Randall,

                 

                I took a sample and expanded it. Of a JDBC store, I read far nothing. Is there also an example?

                 

                --------

                Peter

                • 6. Re: Problem saving data in database via infinispan
                  Randall Hauch Master

                  We don't yet have an example, but it's easy enough to do. Unfortunately, 3.0.0.CR3 and earlier are limited to an environment that has JNDI; this will be fixed in 3.0.0.Final (see MODE-1691). Your JSON configuration file would change from this:

                   

                  {
                      "name" : "configuration",
                      "transactionMode" : "auto",
                      "monitoring" : {
                          "enabled" : true,
                      },
                      "workspaces" : {
                          "predefined" : ["primaryWorkspace"],
                          "default" : "default",
                          "allowCreation" : true,
                      },
                      "node-types" : ["jcr/configurationNodeType.cnd"],
                      "storage" : {
                          "cacheName" : "repositoryCache",
                          "binaryStorage" : {
                              "type" : "cache",
                              "dataCacheName" : "dataCache",
                              "metadataCacheName" : "metadataCache",
                          },
                      },
                      "security" : {
                          "anonymous" : {
                              "roles" : ["readonly","readwrite","admin"],
                              "useOnFailedLogin" : false
                          },
                      },
                  }
                  

                   

                  to this:

                   

                  {
                      "name" : "configuration",
                      "transactionMode" : "auto",
                      "monitoring" : {
                          "enabled" : true,
                      },
                      "workspaces" : {
                          "predefined" : ["primaryWorkspace"],
                          "default" : "default",
                          "allowCreation" : true,
                      },
                      "node-types" : ["jcr/configurationNodeType.cnd"],
                      "storage" : {
                          "cacheName" : "repositoryCache",
                          "binaryStorage" : {
                              "type" : "database",
                              "dataSourceJndiName" : "java:/myDataSource"
                          },
                      },
                      "security" : {
                          "anonymous" : {
                              "roles" : ["readonly","readwrite","admin"],
                              "useOnFailedLogin" : false
                          },
                      },
                  }
                  

                   

                  You can always look at our configuration file format's JSON Schema, which is here. See json-schema.org (and the latest draft proposal) for more information about JSON Schema itself.

                   

                  Once MODE-1691 is fixed, then you'll also be able to do specify the binary storage fragment as follows (of course, using values that match your own database):

                   

                          "binaryStorage" : {
                              "type" : "database",
                              "driverClass" : "org.h2.Driver",
                              "url" : "jdbc:h2:mem:target/db/h2/modeshape",
                              "username" : "jsmith"
                          },
                  
                  • 7. Re: Problem saving data in database via infinispan
                    forcam Newbie

                    Hi Randall,

                     

                    thanks for the answer.

                     

                    Is it possible in then final version of modeshape to use variable (like ${database.jdbc.url})  in the json-file?

                     

                    Example:

                     

                    "binaryStorage" : {
                                "type" : "database",
                                "driverClass" : "
                    ${database.jdbc.url}",
                                "url" : "
                    ${database.jdbc.url}",
                                "username" : "
                    ${database.jdbc.url}"
                            },

                     

                    --------

                    Peter

                    • 8. Re: Problem saving data in database via infinispan
                      Randall Hauch Master

                      Is it possible in then final version of modeshape to use variable (like ${database.jdbc.url})  in the json-file?

                      Absolutely. See our documentation about using variables.