1 2 Previous Next 26 Replies Latest reply on May 2, 2014 5:50 AM by antonid Go to original post
      • 15. Re: mode shape with sql server
        antonid

        i spent my week end to understand this modeshape.(difficult to understand)(is it possible to upload the project in a zip format.)

         

         

         

        should start with jcr

        http://www.day.com/specs/jcr/2.0/3_Repository_Model.html.

         

         

         

         

        i still could not resolve the problem of version.

        as per your infomation i use modeshape version.

        <modeshape.version>3.7.2.Final</modeshape.version>( but all  exemples are changed version 4....alpha)/

         

        i have tried from 5.1 to 5.3 ( Index of /infinispan)  infinispan versions. my main program could not be loaded.

         

        so i came to back to version 3.1.1 modeshape and 5.1 infinispan version.

        is there any refrence table  for modeshape with corresponding infinispan versions.

         

         

         

        on the contrary the program creates table without any value. with the help of debugging tool   the program raises the exeption at login of the session.

         

         

        as per the logic ; configutration(json) file is called in the programs which points to my infinispan.xml that maps to a sqlserver.

        i ask myself whether i should create a repository manually ????

         

        modeshape-examples/modeshape-jdbc-store-example at master · ModeShape/modeshape-examples · GitHub(i use this exemple)

         

         

         

         

        it starts with a sql error if i get down i could not start the repository

         

        javax.jcr.RepositoryException: Error while starting 'Persisted_Repository' repository: Could not commit implicit transaction

         

         

         

         

        Session session = null;

         

                try {

                    // Get the repository

                    repository = engine.getRepository(repositoryName);

                    System.out.println(" the name repos : " + repository);

         

                    // Create a session ...

        //////The PROBLEM STARTS HERE///////

                    session = repository.login("default"); ///

         

                    // System.out.println(" the name login : " + repository);

                    // Get the root node ...

                    Node root = session.getRootNode(); // this returns null pointer

         

                    System.out.println(" the root : " + root);

         

                    assert root != null;

         

                    System.out.println("Found the root node in the \""

                            + session.getWorkspace().getName() + "\" workspace");

         

                    Node n = root.addNode("Node" + rnd.nextInt());

         

                    InputStream stream = new BufferedInputStream(new FileInputStream("C:\\downloads\\modeshape-basic-example\\modeshape-basic-example\\src\\main\\resources\\text.txt"));

         

                    n.setProperty("key", "value");

         

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

        THE LOG :::::

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

        test -- 1

        test -- url file:/C:/Projet_Gestion_Documents/Projects/modeshape_2/target/classes/my_repository_config.json

        test -- congi { "name" : "Persisted_Repository" , "workspaces" : { "default" : "default" , "predefined" : [ "otherWorkspace" ] , "allowCreation" : true } , "security" : { "anonymous" : { "roles" : [ "readonly" , "readwrite" , "admin" ] , "useOnFailedLogin" : false } } , "storage" : { "cacheConfiguration" : "infinispan_config.xml" , "cacheName" : "Persisted_Repository" , "binaryStorage" : { "type" : "file" , "directory" : "target/content/binaries" , "minimumBinarySizeInBytes" : 4096 } } , "query" : { "enabled" : true , "rebuildUponStartup" : "if_missing" , "indexStorage" : { "type" : "filesystem" , "location" : "target/content/index" , "lockingStrategy" : "simple" , "fileSystemAccessType" : "auto" } } }

        Engine started.

        17:44:09,585  INFO ModeShape version 3.1.1.Final

        repository  . org.modeshape.jcr.JcrRepository@7ec677d5

        config Name. Persisted_Repository

        the name repos : org.modeshape.jcr.JcrRepository@7ec677d5

        17:44:09,905  INFO ISPN000128: Infinispan version: Infinispan 'Brahma' 5.1.2.FINAL

        17:44:10,066  INFO MLog clients using log4j logging.

        17:44:10,115  INFO Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]

        17:44:10,235  INFO Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hge0wz911aw65i61oayojq|7e61458a, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.microsoft.sqlserver.jdbc.SQLServerDriver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hge0wz911aw65i61oayojq|7e61458a, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:sqlserver://localhost:1433;DatabaseName=modeshape, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 15, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]

        17:44:10,925 ERROR ISPN008024: Error while storing string key to database; key: 'repository:info', buffer size of value: 849 bytes

        com.microsoft.sqlserver.jdbc.SQLServerException: String or binary data would be truncated.

            at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:196)

            at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1454)

            at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:388)

            at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:338)

            at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4026)

            at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1416)

            at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:185)

            at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:160)

            at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:306)

            at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)

            at org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore.storeLockSafe(JdbcStringBasedCacheStore.java:243)

            at org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore.storeLockSafe(JdbcStringBasedCacheStore.java:87)

            at org.infinispan.loaders.LockSupportCacheStore.store(LockSupportCacheStore.java:193)

            at org.infinispan.loaders.AbstractCacheStore.applyModifications(AbstractCacheStore.java:121)

            at org.infinispan.loaders.AbstractCacheStore.commit(AbstractCacheStore.java:154)

            at org.infinispan.interceptors.CacheStoreInterceptor.visitCommitCommand(CacheStoreInterceptor.java:137)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)

            at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:130)

            at org.infinispan.commands.AbstractVisitor.visitCommitCommand(AbstractVisitor.java:121)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)

            at org.infinispan.interceptors.EntryWrappingInterceptor.visitCommitCommand(EntryWrappingInterceptor.java:90)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)

            at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:130)

            at org.infinispan.commands.AbstractVisitor.visitCommitCommand(AbstractVisitor.java:121)

            at org.infinispan.interceptors.locking.AbstractTxLockingInterceptor.visitCommitCommand(AbstractTxLockingInterceptor.java:104)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)

            at org.infinispan.interceptors.NotificationInterceptor.visitCommitCommand(NotificationInterceptor.java:65)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)

            at org.infinispan.interceptors.TxInterceptor.visitCommitCommand(TxInterceptor.java:120)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)

            at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:130)

            at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:89)

            at org.infinispan.commands.AbstractVisitor.visitCommitCommand(AbstractVisitor.java:121)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:345)

            at org.infinispan.transaction.TransactionCoordinator.commit(TransactionCoordinator.java:181)

            at org.infinispan.transaction.xa.TransactionXaAdapter.commit(TransactionXaAdapter.java:125)

            at org.infinispan.transaction.tm.DummyTransaction.runCommitTx(DummyTransaction.java:308)

            at org.infinispan.transaction.tm.DummyTransaction.commit(DummyTransaction.java:90)

            at org.infinispan.transaction.tm.DummyBaseTransactionManager.commit(DummyBaseTransactionManager.java:100)

            at org.infinispan.CacheImpl.executeCommandAndCommitIfNeeded(CacheImpl.java:954)

            at org.infinispan.CacheImpl.putIfAbsent(CacheImpl.java:670)

            at org.infinispan.CacheImpl.putIfAbsent(CacheImpl.java:661)

            at org.infinispan.CacheSupport.putIfAbsent(CacheSupport.java:74)

            at org.infinispan.schematic.internal.CacheSchematicDb.putIfAbsent(CacheSchematicDb.java:290)

            at org.modeshape.jcr.cache.document.LocalDocumentStore.putIfAbsent(LocalDocumentStore.java:98)

            at org.modeshape.jcr.cache.RepositoryCache.<init>(RepositoryCache.java:160)

            at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:1089)

            at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:966)

            at org.modeshape.jcr.JcrRepository.doStart(JcrRepository.java:354)

            at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:611)

            at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:580)

            at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:149)

            at org.modeshape.example.sequencing.ModeShapeExample.main(ModeShapeExample.java:79)

        17:44:10,927 ERROR ISPN000136: Execution error

        org.infinispan.loaders.CacheLoaderException: Error while storing string key to database; key: 'repository:info', buffer size of value: 849 bytes

            at org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore.storeLockSafe(JdbcStringBasedCacheStore.java:246)

            at org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore.storeLockSafe(JdbcStringBasedCacheStore.java:87)

            at org.infinispan.loaders.LockSupportCacheStore.store(LockSupportCacheStore.java:193)

            at org.infinispan.loaders.AbstractCacheStore.applyModifications(AbstractCacheStore.java:121)

            at org.infinispan.loaders.AbstractCacheStore.commit(AbstractCacheStore.java:154)

            at org.infinispan.interceptors.CacheStoreInterceptor.visitCommitCommand(CacheStoreInterceptor.java:137)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)

            at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:130)

            at org.infinispan.commands.AbstractVisitor.visitCommitCommand(AbstractVisitor.java:121)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)

            at org.infinispan.interceptors.EntryWrappingInterceptor.visitCommitCommand(EntryWrappingInterceptor.java:90)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)

            at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:130)

            at org.infinispan.commands.AbstractVisitor.visitCommitCommand(AbstractVisitor.java:121)

            at org.infinispan.interceptors.locking.AbstractTxLockingInterceptor.visitCommitCommand(AbstractTxLockingInterceptor.java:104)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)

            at org.infinispan.interceptors.NotificationInterceptor.visitCommitCommand(NotificationInterceptor.java:65)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)

            at org.infinispan.interceptors.TxInterceptor.visitCommitCommand(TxInterceptor.java:120)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)

            at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:130)

            at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:89)

            at org.infinispan.commands.AbstractVisitor.visitCommitCommand(AbstractVisitor.java:121)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:345)

            at org.infinispan.transaction.TransactionCoordinator.commit(TransactionCoordinator.java:181)

            at org.infinispan.transaction.xa.TransactionXaAdapter.commit(TransactionXaAdapter.java:125)

            at org.infinispan.transaction.tm.DummyTransaction.runCommitTx(DummyTransaction.java:308)

            at org.infinispan.transaction.tm.DummyTransaction.commit(DummyTransaction.java:90)

            at org.infinispan.transaction.tm.DummyBaseTransactionManager.commit(DummyBaseTransactionManager.java:100)

            at org.infinispan.CacheImpl.executeCommandAndCommitIfNeeded(CacheImpl.java:954)

            at org.infinispan.CacheImpl.putIfAbsent(CacheImpl.java:670)

            at org.infinispan.CacheImpl.putIfAbsent(CacheImpl.java:661)

            at org.infinispan.CacheSupport.putIfAbsent(CacheSupport.java:74)

            at org.infinispan.schematic.internal.CacheSchematicDb.putIfAbsent(CacheSchematicDb.java:290)

            at org.modeshape.jcr.cache.document.LocalDocumentStore.putIfAbsent(LocalDocumentStore.java:98)

            at org.modeshape.jcr.cache.RepositoryCache.<init>(RepositoryCache.java:160)

            at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:1089)

            at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:966)

            at org.modeshape.jcr.JcrRepository.doStart(JcrRepository.java:354)

            at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:611)

            at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:580)

            at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:149)

            at org.modeshape.example.sequencing.ModeShapeExample.main(ModeShapeExample.java:79)

        Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: String or binary data would be truncated.

            at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:196)

            at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1454)

            at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:388)

            at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:338)

            at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4026)

            at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1416)

            at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:185)

            at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:160)

            at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:306)

            at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)

            at org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore.storeLockSafe(JdbcStringBasedCacheStore.java:243)

            ... 49 more

        17:44:10,928 ERROR ISPN000097: Error while processing 1PC PrepareCommand

        org.infinispan.CacheException: org.infinispan.loaders.CacheLoaderException: Error while storing string key to database; key: 'repository:info', buffer size of value: 849 bytes

            at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:353)

            at org.infinispan.transaction.TransactionCoordinator.commit(TransactionCoordinator.java:181)

            at org.infinispan.transaction.xa.TransactionXaAdapter.commit(TransactionXaAdapter.java:125)

            at org.infinispan.transaction.tm.DummyTransaction.runCommitTx(DummyTransaction.java:308)

            at org.infinispan.transaction.tm.DummyTransaction.commit(DummyTransaction.java:90)

            at org.infinispan.transaction.tm.DummyBaseTransactionManager.commit(DummyBaseTransactionManager.java:100)

            at org.infinispan.CacheImpl.executeCommandAndCommitIfNeeded(CacheImpl.java:954)

            at org.infinispan.CacheImpl.putIfAbsent(CacheImpl.java:670)

            at org.infinispan.CacheImpl.putIfAbsent(CacheImpl.java:661)

            at org.infinispan.CacheSupport.putIfAbsent(CacheSupport.java:74)

            at org.infinispan.schematic.internal.CacheSchematicDb.putIfAbsent(CacheSchematicDb.java:290)

            at org.modeshape.jcr.cache.document.LocalDocumentStore.putIfAbsent(LocalDocumentStore.java:98)

            at org.modeshape.jcr.cache.RepositoryCache.<init>(RepositoryCache.java:160)

            at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:1089)

            at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:966)

            at org.modeshape.jcr.JcrRepository.doStart(JcrRepository.java:354)

            at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:611)

            at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:580)

            at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:149)

            at org.modeshape.example.sequencing.ModeShapeExample.main(ModeShapeExample.java:79)

        Caused by: org.infinispan.loaders.CacheLoaderException: Error while storing string key to database; key: 'repository:info', buffer size of value: 849 bytes

            at org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore.storeLockSafe(JdbcStringBasedCacheStore.java:246)

            at org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore.storeLockSafe(JdbcStringBasedCacheStore.java:87)

            at org.infinispan.loaders.LockSupportCacheStore.store(LockSupportCacheStore.java:193)

            at org.infinispan.loaders.AbstractCacheStore.applyModifications(AbstractCacheStore.java:121)

            at org.infinispan.loaders.AbstractCacheStore.commit(AbstractCacheStore.java:154)

            at org.infinispan.interceptors.CacheStoreInterceptor.visitCommitCommand(CacheStoreInterceptor.java:137)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)

            at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:130)

            at org.infinispan.commands.AbstractVisitor.visitCommitCommand(AbstractVisitor.java:121)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)

            at org.infinispan.interceptors.EntryWrappingInterceptor.visitCommitCommand(EntryWrappingInterceptor.java:90)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)

            at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:130)

            at org.infinispan.commands.AbstractVisitor.visitCommitCommand(AbstractVisitor.java:121)

            at org.infinispan.interceptors.locking.AbstractTxLockingInterceptor.visitCommitCommand(AbstractTxLockingInterceptor.java:104)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)

            at org.infinispan.interceptors.NotificationInterceptor.visitCommitCommand(NotificationInterceptor.java:65)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)

            at org.infinispan.interceptors.TxInterceptor.visitCommitCommand(TxInterceptor.java:120)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:116)

            at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:130)

            at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:89)

            at org.infinispan.commands.AbstractVisitor.visitCommitCommand(AbstractVisitor.java:121)

            at org.infinispan.commands.tx.CommitCommand.acceptVisitor(CommitCommand.java:66)

            at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:345)

            ... 19 more

        Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: String or binary data would be truncated.

            at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:196)

            at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1454)

            at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:388)

            at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:338)

            at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4026)

            at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1416)

            at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:185)

            at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:160)

            at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:306)

            at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)

            at org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore.storeLockSafe(JdbcStringBasedCacheStore.java:243)

            ... 49 more

        17:44:10,930  WARN ISPN000112: exception while committing

        javax.transaction.xa.XAException

            at org.infinispan.transaction.TransactionCoordinator.handleCommitFailure(TransactionCoordinator.java:219)

            at org.infinispan.transaction.TransactionCoordinator.commit(TransactionCoordinator.java:184)

            at org.infinispan.transaction.xa.TransactionXaAdapter.commit(TransactionXaAdapter.java:125)

            at org.infinispan.transaction.tm.DummyTransaction.runCommitTx(DummyTransaction.java:308)

            at org.infinispan.transaction.tm.DummyTransaction.commit(DummyTransaction.java:90)

            at org.infinispan.transaction.tm.DummyBaseTransactionManager.commit(DummyBaseTransactionManager.java:100)

            at org.infinispan.CacheImpl.executeCommandAndCommitIfNeeded(CacheImpl.java:954)

            at org.infinispan.CacheImpl.putIfAbsent(CacheImpl.java:670)

            at org.infinispan.CacheImpl.putIfAbsent(CacheImpl.java:661)

            at org.infinispan.CacheSupport.putIfAbsent(CacheSupport.java:74)

            at org.infinispan.schematic.internal.CacheSchematicDb.putIfAbsent(CacheSchematicDb.java:290)

            at org.modeshape.jcr.cache.document.LocalDocumentStore.putIfAbsent(LocalDocumentStore.java:98)

            at org.modeshape.jcr.cache.RepositoryCache.<init>(RepositoryCache.java:160)

            at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:1089)

            at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:966)

            at org.modeshape.jcr.JcrRepository.doStart(JcrRepository.java:354)

            at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:611)

            at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:580)

            at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:149)

            at org.modeshape.example.sequencing.ModeShapeExample.main(ModeShapeExample.java:79)

         

         

        javax.jcr.RepositoryException: Error while starting 'Persisted_Repository' repository: Could not commit implicit transaction

            at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:613)

            at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:580)

            at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:149)

            at org.modeshape.example.sequencing.ModeShapeExample.main(ModeShapeExample.java:79)

        Caused by: org.infinispan.CacheException: Could not commit implicit transaction

            at org.infinispan.CacheImpl.executeCommandAndCommitIfNeeded(CacheImpl.java:958)

            at org.infinispan.CacheImpl.putIfAbsent(CacheImpl.java:670)

            at org.infinispan.CacheImpl.putIfAbsent(CacheImpl.java:661)

            at org.infinispan.CacheSupport.putIfAbsent(CacheSupport.java:74)

            at org.infinispan.schematic.internal.CacheSchematicDb.putIfAbsent(CacheSchematicDb.java:290)

            at org.modeshape.jcr.cache.document.LocalDocumentStore.putIfAbsent(LocalDocumentStore.java:98)

            at org.modeshape.jcr.cache.RepositoryCache.<init>(RepositoryCache.java:160)

            at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:1089)

            at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:966)

            at org.modeshape.jcr.JcrRepository.doStart(JcrRepository.java:354)

            at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:611)

            ... 3 more

        Caused by: javax.transaction.HeuristicMixedException

            at org.infinispan.transaction.tm.DummyTransaction.runCommitTx(DummyTransaction.java:311)

            at org.infinispan.transaction.tm.DummyTransaction.commit(DummyTransaction.java:90)

            at org.infinispan.transaction.tm.DummyBaseTransactionManager.commit(DummyBaseTransactionManager.java:100)

            at org.infinispan.CacheImpl.executeCommandAndCommitIfNeeded(CacheImpl.java:954)

            ... 13 more

        Success!

        ---- Fin ----

         

        CONFIG FILE :

         

         

        {

            "name" : "Persisted_Repository",

            "workspaces" : {

                "default" : "default",

                "predefined" : ["otherWorkspace"],

                "allowCreation" : true

            },

           

            "security" : {

                "anonymous" : {

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

                    "useOnFailedLogin" : false

                }

            },

           

            "storage" : {

                "cacheConfiguration" : "infinispan_config.xml",

                "cacheName" : "Persisted_Repository",

                "binaryStorage" : {

                    "type" : "file",

                    "directory": "target/content/binaries",

                    "minimumBinarySizeInBytes" : 4096

                }

            },

            

             "query":{

                "enabled":true,

                "rebuildUponStartup":"if_missing",

                "indexStorage": {

                    "type":"filesystem",

                    "location":"target/content/index",

                    "lockingStrategy":"simple",

                    "fileSystemAccessType":"auto"

                }

            },

        }

         

        <?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

                                    urn:infinispan:config:jdbc:5.1 http://www.infinispan.org/schemas/infinispan-cachestore-jdbc-config-5.1.xsd"

                xmlns="urn:infinispan:config:5.1">

           

            <global>

                <globalJmxStatistics enabled="false" allowDuplicateDomains="true"/>

            </global>

           

             <default>

             </default>

             <namedCache name="Persisted_Repository">

                 <transaction

                     transactionManagerLookupClass="org.infinispan.transaction.lookup.DummyTransactionManagerLookup"

                     transactionMode="TRANSACTIONAL" lockingMode="OPTIMISTIC" />

                    <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:sqlserver://localhost:1433;DatabaseName=modeshape"/>

                          <property name="driverClass" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>

                          <property name="userName" value="sa1"/>

                          <property name="password" value="sa"/>

                          <property name="idColumnType" value="VARCHAR(512)"/>

                          <property name="dataColumnType" value="BINARY"/>

                          <property name="dropTableOnExit" value="false"/>

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

                       </properties>

                    </loader>

                 </loaders>

            </namedCache>

        </infinispan>

         

         

         

        Advance thanks

        • 16. Re: mode shape with sql server
          rhauch

          I think you are making this much harder than it needs to be.

           

          If you're using our Maven BOM file, then it specifies the correct version of Infinispan and you shouldn't be specifying the Infinispan version. All of this is documented here, and our examples use this same technique. You'll note that in the POM file for this example does not specify Infinispan as a dependency at all (though the JDBC cache store is specified as a dependency without a version).

           

          Now, as far as configuration files go, you should have 2 configuration files: one JSON file for each ModeShape repository, and an Infinispan configuration file that defines the cache(s) that the ModeShape repository will use. Please be careful with the names of these files: the ModeShape configuration file will contain the path of the Infinispan configuration file. Here's a snippet from your repository configuration file:

           

             "storage" : {

                  "cacheConfiguration" : "infinispan_config.xml",

                  "cacheName" : "Persisted_Repository",

           

          This means that the above-mentioned Infinispan configuration should be in the "infinispan_config.xml" file that (because there is no absolute or relative path in the "cacheConfiguration" value) is accessible either in the same directory the JVM is running or on the classpath.

           

          Please try to compile and run this example as-is with no changes.

           

          Once that runs, try to modify the example to use SQLServer. You'll have to change the POM file to add the SQLServer JDBC driver, and the Infinispan configuration file to point to your new DB. Otherwise, the example should run and you should see content saved in your SQLServer database.

           

          At this point, you will have seen that ModeShape does work, and does store content in SQLServer. You will also have a working system that you can use to base your application upon.

          • 17. Re: mode shape with sql server
            antonid

            hello,

            Please try to compile and run this example as-is with no changes.

            i followed the instruction exactly i have the class not found error ; ERROR

            but if it is in 3.1.1 final ; i can create a table in my sql server(as mentione in previous message)

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

            ERROR :

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

            Class not found org.modeshape.example.sequencing.ModeShapeExampleTest

            java.lang.ClassNotFoundException: org.modeshape.example.sequencing.ModeShapeExampleTest

                at java.net.URLClassLoader$1.run(Unknown Source)

                at java.net.URLClassLoader$1.run(Unknown Source)

                at java.security.AccessController.doPrivileged(Native Method)

                at java.net.URLClassLoader.findClass(Unknown Source)

                at java.lang.ClassLoader.loadClass(Unknown Source)

                at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

                at java.lang.ClassLoader.loadClass(Unknown Source)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:693)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:429)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

             

             

             

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

            POM

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

            <?xml version="1.0"?>

            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

                <modelVersion>4.0.0</modelVersion>

                <groupId>org.modeshape.example</groupId>

                <artifactId>modeshape-jdbc-store-example</artifactId>

                <packaging>jar</packaging>

            <name>Example that uses ModeShape w/ JDBC-based storage</name>

                <description>A simple example application that creates an embedded ModeShape engine using local H2 JDBC database for storage, and the file system for indexes and binaries.</description>

                <version>1.0-SNAPSHOT</version>

                <properties>

            <!-- Instruct the build to use only UTF-8 encoding for source code -->

                    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

             

            <!--Global dependency version information-->

                    <modeshape.version>3.7.2.Final</modeshape.version>

                    <jdbc.h2.version>1.2.124</jdbc.h2.version>

                    <c3p0.version>0.9.1.2</c3p0.version>

             

            <!--Maven plugin versions-->

                    <maven.surefire.report.plugin.version>2.4.3</maven.surefire.report.plugin.version>

                    <maven.surefire.plugin.version>2.7.1</maven.surefire.plugin.version>

                    <maven.assembly.plugin.version>2.2</maven.assembly.plugin.version>

                    <maven.install.plugin.version>2.3.1</maven.install.plugin.version>

                    <maven.jar.plugin.version>2.3.1</maven.jar.plugin.version>

                    <maven.compiler.plugin.version>2.3.2</maven.compiler.plugin.version>

                    <maven.source.plugin.version>2.1.2</maven.source.plugin.version>

                    <maven.resources.plugin.version>2.4.3</maven.resources.plugin.version>

                </properties>

             

                <dependencyManagement>

                    <dependencies>

                        <!-- Import the ModeShape BOM for embedded usage. This adds to the "dependenciesManagement" section

            defaults for all of the modules we might need, but we still have to include in the

            "dependencies" section the modules we DO need. The benefit is that we don't have to

            specify the versions of any of those modules.-->

                        <dependency>

                            <groupId>org.modeshape.bom</groupId>

                            <artifactId>modeshape-bom-embedded</artifactId>

                            <version>${modeshape.version}</version>

                            <type>pom</type>

                            <scope>import</scope>

                        </dependency>

                    </dependencies>

                </dependencyManagement>

                <dependencies>

                    <dependency>

                        <groupId>org.modeshape</groupId>

                        <artifactId>modeshape-jcr-api</artifactId>

                    </dependency>

                    <dependency>

                        <groupId>org.modeshape</groupId>

                        <artifactId>modeshape-jcr</artifactId>

                    </dependency>

                    <dependency>

                        <groupId>org.modeshape</groupId>

                        <artifactId>modeshape-common</artifactId>

                    </dependency>

                    <dependency>

                        <groupId>junit</groupId>

                        <artifactId>junit</artifactId>

                    </dependency>

                    <!--This examples uses Infinispan's JDBC cache store, which requires C3P0 and a JDBC database driver -->

                    <dependency>

                        <groupId>org.infinispan</groupId>

                        <artifactId>infinispan-cachestore-jdbc</artifactId>

                    </dependency>

                    <dependency>

                        <groupId>c3p0</groupId>

                        <artifactId>c3p0</artifactId>

                        <version>${c3p0.version}</version>

                    </dependency>

                    <dependency>

                        <groupId>com.h2database</groupId>

                        <artifactId>h2</artifactId>

                        <version>${jdbc.h2.version}</version>

                    </dependency>

                </dependencies>

               

                <build>

                    <resources>

                        <resource>

                            <directory>src/main/resources</directory>

                        </resource>

                        <resource>

                            <directory>src/main/java</directory>

                            <includes>

                                <include>**</include>

                            </includes>

                            <excludes>

                                <exclude>**/*.java</exclude>

                            </excludes>

                        </resource>

                    </resources>

                    <pluginManagement>

                        <plugins>

                            <plugin>

                                <groupId>org.apache.maven.plugins</groupId>

                                <artifactId>maven-surefire-plugin</artifactId>

                                <configuration>

                                    <includes>

                                        <include>**/*Test.java</include>

                                    </includes>

                                </configuration>

                            </plugin>

                        </plugins>

                    </pluginManagement>

                    <plugins>

            <!-- Specify the compiler options and settings -->

                        <plugin>

                            <groupId>org.apache.maven.plugins</groupId>

                            <artifactId>maven-compiler-plugin</artifactId>

                            <version>${maven.compiler.plugin.version}</version>

                            <configuration>

                                <source>1.6</source>

                                <target>1.6</target>

                                <showDeprecation>false</showDeprecation>

                                <showWarnings>false</showWarnings>

                            </configuration>

                        </plugin>

                        <plugin>

                            <artifactId>maven-surefire-plugin</artifactId>

                            <version>${maven.surefire.plugin.version}</version>

                            <configuration>

                                <includes>

                                    <include>**/*TestCase.java</include>

                                    <include>**/*Test.java</include>

                                </includes>

                            </configuration>

                        </plugin>

            <!-- Produce source jars during the 'verify' phase -->

                        <plugin>

                            <groupId>org.apache.maven.plugins</groupId>

                            <artifactId>maven-source-plugin</artifactId>

                            <version>${maven.source.plugin.version}</version>

                            <executions>

                                <execution>

                                    <id>attach-sources</id>

                                    <phase>verify</phase>

                                    <goals>

                                        <goal>jar</goal>

                                    </goals>

                                </execution>

                            </executions>

                        </plugin>

            <!--

            Build a test-jar for each project, so that src/test/* resources and

            classes can be used in other projects. Also customize how the jar

            files are assembled.

            -->

                        <plugin>

                            <groupId>org.apache.maven.plugins</groupId>

                            <artifactId>maven-jar-plugin</artifactId>

                            <version>${maven.jar.plugin.version}</version>

                            <executions>

                                <execution>

                                    <id>test-jar</id>

                                    <goals>

                                        <goal>test-jar</goal>

                                    </goals>

                                </execution>

                            </executions>

                        </plugin>

                    </plugins>

                </build>

                <repositories>

                    <repository>

                        <id>JBoss-Releases</id>

                        <url>https://repository.jboss.org/nexus/content/repositories/releases/</url>

                    </repository>

                </repositories>

            </project>

             

            -------------------CONFIG FILE(JSON)-------------------------

             

            {

                "name" : "Persisted_Repository",

                "workspaces" : {

                    "default" : "default",

                    "predefined" : ["otherWorkspace"],

                    "allowCreation" : true

                },

               

                "security" : {

                    "anonymous" : {

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

                        "useOnFailedLogin" : false

                    }

                },

               

                "storage" : {

                   "cacheConfiguration" : "infinispan_config.xml",

                   "cacheName" : "Persisted_Repository",

                    "binaryStorage" : {

                        "type" : "file",

                        "directory": "target/content/binaries",

                        "minimumBinarySizeInBytes" : 4096

                    }

                },

                

                 "query":{

                    "enabled":true,

                    "rebuildUponStartup":"if_missing",

                    "indexStorage": {

                        "type":"filesystem",

                        "location":"target/content/index",

                        "lockingStrategy":"simple",

                        "fileSystemAccessType":"auto"

                    }

                },

            }

             

            -------------------------------------------------INFINISPAN-------------------------

             

             

            <?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:h2:file:target/content/db;DB_CLOSE_DELAY=-1"/>

                             <property name="userName" value="sa"/>

                             <property name="driverClass" value="org.h2.Driver"/>

                             <property name="idColumnType" value="VARCHAR(255)"/>

                             <property name="dataColumnType" value="BINARY"/>

                             <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>

            ------------------------------------Program java main embeds the machine----------------------------------

             

             

             

            package org.modeshape.example.sequencing;

             

            import java.io.ByteArrayInputStream;

            import java.net.URL;

            import java.util.Random;

            import javax.jcr.*;

            import org.modeshape.common.collection.Problems;

            import org.modeshape.jcr.ModeShapeEngine;

            import org.modeshape.jcr.RepositoryConfiguration;

            import org.modeshape.jcr.value.BinaryValue;

             

            public class ModeShapeExample {

             

                public static void main( String[] argv ) {

             

                    Random rnd = new Random();

             

                    // Create and start the engine ...

                    ModeShapeEngine engine = new ModeShapeEngine();

                    engine.start();

             

                    // Load the configuration for a repository via the classloader (can also use path to a file)...

                    Repository repository = null;

                    String repositoryName = null;

                    try {

                        URL url = ModeShapeExample.class.getClassLoader().getResource("my_repository_config.json");

                        RepositoryConfiguration config = RepositoryConfiguration.read(url);

             

                        // We could change the name of the repository programmatically ...

                        // config = config.withName("Some Other Repository");

             

                        // Verify the configuration for the repository ...

                        Problems problems = config.validate();

                        if (problems.hasErrors()) {

                            System.err.println("Problems starting the engine.");

                            System.err.println(problems);

                            System.exit(-1);

                        }

             

                        // Deploy the repository ...

                        repository = engine.deploy(config);

                        repositoryName = config.getName();

                    } catch (Throwable e) {

                        e.printStackTrace();

                        System.exit(-1);

                        return;

                    }

             

                    Session session = null;

                    try {

                        // Get the repository

                        repository = engine.getRepository(repositoryName);

             

                        // Create a session ...

                        session = repository.login("default");

             

                        // Get the root node ...

                        Node root = session.getRootNode();

                        assert root != null;

             

                        System.out.println("Found the root node in the \"" + session.getWorkspace().getName() + "\" workspace");

             

                        Node n = root.addNode("Node" + rnd.nextInt());

             

                        n.setProperty("key", "value");

                        n.setProperty("content", session.getValueFactory().createBinary(new ByteArrayInputStream(new byte[1000])));

             

                        session.save();

             

                        System.out.println("Added one node under root");

                        System.out.println("+ Root childs");

             

                        NodeIterator it = root.getNodes();

                        while (it.hasNext()) {

                            System.out.println("+---> " + it.nextNode().getName());

                        }

                    } catch (Exception e) {

                        e.printStackTrace();

                    } finally {

                        if (session != null) session.logout();

                        System.out.println("Shutting down engine ...");

                        try {

                            engine.shutdown().get();

                            System.out.println("Success!");

                        } catch (Exception e) {

                            e.printStackTrace();

                        }

                    }

             

                }

            }

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

            ERROR :

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

            Class not found org.modeshape.example.sequencing.ModeShapeExampleTest

            java.lang.ClassNotFoundException: org.modeshape.example.sequencing.ModeShapeExampleTest

                at java.net.URLClassLoader$1.run(Unknown Source)

                at java.net.URLClassLoader$1.run(Unknown Source)

                at java.security.AccessController.doPrivileged(Native Method)

                at java.net.URLClassLoader.findClass(Unknown Source)

                at java.lang.ClassLoader.loadClass(Unknown Source)

                at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

                at java.lang.ClassLoader.loadClass(Unknown Source)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:693)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:429)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

            • 18. Re: mode shape with sql server
              antonid
              • 19. Re: mode shape with sql server
                antonid

                if i use

                 

                15:26:33,791  INFO ModeShape version 3.1.1.Final

                15:26:34,109  INFO ISPN000128: Infinispan version: Infinispan 'Brahma' 5.1.2.FINAL

                javax.jcr.RepositoryException: Error while starting 'persisted_repository' repository: The 'persisted_repository' repository cannot be started because transactions are not enabled. Please check your configuration.

                    at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:613)

                    at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:580)

                    at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:149)

                    at org.modeshape.example.sequencing.ModeShapeExample.main(ModeShapeExample.java:83)

                Caused by: java.lang.IllegalStateException: The 'persisted_repository' repository cannot be started because transactions are not enabled. Please check your configuration.

                    at org.modeshape.jcr.JcrRepository$RunningState.validateTransactionsEnabled(JcrRepository.java:1235)

                    at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:1062)

                    at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:966)

                    at org.modeshape.jcr.JcrRepository.doStart(JcrRepository.java:354)

                    at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:611)

                    ... 3 more

                Shutting down engine ...

                Success!

                 

                 

                if i use version 3.7.2.Final


                15:51:23,645  INFO Log4j located in the classpath. It will be used by ModeShape for logging.

                15:51:23,838  INFO ModeShape version 3.7.2.Final

                15:51:24,256  INFO ISPN000128: Infinispan version: Infinispan 'Brahma' 5.1.2.FINAL

                javax.jcr.RepositoryException: Error while starting 'persisted_repository' repository: java.lang.NoSuchFieldError: DELTA_WRITE

                    at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:650)

                    at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:619)

                    at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:155)

                    at org.modeshape.example.sequencing.ModeShapeExample.main(ModeShapeExample.java:83)

                Caused by: java.lang.RuntimeException: java.lang.NoSuchFieldError: DELTA_WRITE

                    at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:1233)

                    at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:971)

                    at org.modeshape.jcr.JcrRepository.doStart(JcrRepository.java:404)

                    at org.modeshape.jcr.JcrRepository.login(JcrRepository.java:648)

                    ... 3 more

                Caused by: java.lang.NoSuchFieldError: DELTA_WRITE

                    at org.infinispan.schematic.internal.CacheContext.<init>(CacheContext.java:63)

                    at org.infinispan.schematic.internal.CacheSchematicDb.<init>(CacheSchematicDb.java:84)

                    at org.infinispan.schematic.Schematic.get(Schematic.java:99)

                    at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:1070)

                    ... 6 more

                Shutting down engine ...

                Success!

                • 20. Re: mode shape with sql server
                  antonid

                  <?xml version="1.0"?>

                  <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

                      <modelVersion>4.0.0</modelVersion>

                      <groupId>org.modeshape.example</groupId>

                      <artifactId>modeshape-jdbc-store-example</artifactId>

                      <packaging>jar</packaging>

                      <name>Example that uses ModeShape w/ JDBC-based storage</name>

                      <description>A simple example application that creates an embedded ModeShape engine using local H2 JDBC database for storage, and the file system for indexes and binaries.</description>

                      <version>1.0-SNAPSHOT</version>

                      <properties>

                          <!-- Instruct the build to use only UTF-8 encoding for source code -->

                          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

                          <!-- Global dependency version information -->

                          <modeshape.version>3.7.2.Final</modeshape.version><!--3.1.1.Final  -->

                          <jdbc.sql.version>4.0</jdbc.sql.version>

                          <c3p0.version>0.9.1.2</c3p0.version>

                          <!-- Maven plugin versions -->

                          <maven.surefire.report.plugin.version>2.4.3</maven.surefire.report.plugin.version>

                          <maven.surefire.plugin.version>2.7.1</maven.surefire.plugin.version>

                          <maven.assembly.plugin.version>2.2</maven.assembly.plugin.version>

                          <maven.install.plugin.version>2.3.1</maven.install.plugin.version>

                          <maven.jar.plugin.version>2.3.1</maven.jar.plugin.version>

                          <maven.compiler.plugin.version>2.3.2</maven.compiler.plugin.version>

                          <maven.source.plugin.version>2.1.2</maven.source.plugin.version>

                          <maven.resources.plugin.version>2.4.3</maven.resources.plugin.version>

                      </properties>

                   

                      <dependencyManagement>

                          <dependencies>

                              <!-- Import the ModeShape BOM for embedded usage. This adds to the "dependenciesManagement"

                                  section defaults for all of the modules we might need, but we still have

                                  to include in the "dependencies" section the modules we DO need. The benefit

                                  is that we don't have to specify the versions of any of those modules. -->

                              <dependency>

                                  <groupId>org.modeshape.bom</groupId>

                                  <artifactId>modeshape-bom-embedded</artifactId>

                                  <version>3.7.2.Final</version><!-- 3.1.1.Final -->

                                  <type>pom</type>

                                  <scope>import</scope>

                              </dependency>

                          </dependencies>

                      </dependencyManagement>

                      <dependencies>

                          <dependency>

                              <groupId>org.modeshape</groupId>

                              <artifactId>modeshape-jcr-api</artifactId>

                          </dependency>

                          <dependency>

                              <groupId>org.modeshape</groupId>

                              <artifactId>modeshape-jcr</artifactId>

                          </dependency>

                          <dependency>

                              <groupId>org.modeshape</groupId>

                              <artifactId>modeshape-common</artifactId>

                          </dependency>

                          <dependency>

                              <groupId>junit</groupId>

                              <artifactId>junit</artifactId>

                          </dependency>

                          <!--This examples uses Infinispan's JDBC cache store, which requires C3P0

                              and a JDBC database driver -->

                          <dependency>

                              <groupId>org.infinispan</groupId>

                              <artifactId>infinispan-cachestore-jdbc</artifactId>

                          </dependency>

                          <dependency>

                              <groupId>c3p0</groupId>

                              <artifactId>c3p0</artifactId>

                              <version>${c3p0.version}</version>

                          </dependency>

                          <dependency>

                              <groupId>com.microsoft.sqlserver</groupId>

                              <artifactId>sqljdbc4</artifactId>

                              <version>4.0</version>

                          </dependency>

                      </dependencies>

                   

                      <build>

                          <resources>

                              <resource>

                                  <directory>src/main/resources</directory>

                              </resource>

                              <resource>

                                  <directory>src/main/java</directory>

                                  <includes>

                                      <include>**</include>

                                  </includes>

                                  <excludes>

                                      <exclude>**/*.java</exclude>

                                  </excludes>

                              </resource>

                          </resources>

                          <pluginManagement>

                              <plugins>

                                  <plugin>

                                      <groupId>org.apache.maven.plugins</groupId>

                                      <artifactId>maven-surefire-plugin</artifactId>

                                      <configuration>

                                          <includes>

                                              <include>**/*Test.java</include>

                                          </includes>

                                      </configuration>

                                  </plugin>

                              </plugins>

                          </pluginManagement>

                          <plugins>

                              <!-- Specify the compiler options and settings -->

                              <plugin>

                                  <groupId>org.apache.maven.plugins</groupId>

                                  <artifactId>maven-compiler-plugin</artifactId>

                                  <version>${maven.compiler.plugin.version}</version>

                                  <configuration>

                                      <source>1.6</source>

                                      <target>1.6</target>

                                      <showDeprecation>false</showDeprecation>

                                      <showWarnings>false</showWarnings>

                                  </configuration>

                              </plugin>

                              <plugin>

                                  <artifactId>maven-surefire-plugin</artifactId>

                                  <version>${maven.surefire.plugin.version}</version>

                                  <configuration>

                                      <includes>

                                          <include>**/*TestCase.java</include>

                                          <include>**/*Test.java</include>

                                      </includes>

                                  </configuration>

                              </plugin>

                              <!-- Produce source jars during the 'verify' phase -->

                              <plugin>

                                  <groupId>org.apache.maven.plugins</groupId>

                                  <artifactId>maven-source-plugin</artifactId>

                                  <version>${maven.source.plugin.version}</version>

                                  <executions>

                                      <execution>

                                          <id>attach-sources</id>

                                          <phase>verify</phase>

                                          <goals>

                                              <goal>jar</goal>

                                          </goals>

                                      </execution>

                                  </executions>

                              </plugin>

                              <!-- Build a test-jar for each project, so that src/test/* resources and

                                  classes can be used in other projects. Also customize how the jar files are

                                  assembled. -->

                              <plugin>

                                  <groupId>org.apache.maven.plugins</groupId>

                                  <artifactId>maven-jar-plugin</artifactId>

                                  <version>${maven.jar.plugin.version}</version>

                                  <executions>

                                      <execution>

                                          <id>test-jar</id>

                                          <goals>

                                              <goal>test-jar</goal>

                                          </goals>

                                      </execution>

                                  </executions>

                              </plugin>

                          </plugins>

                      </build>

                      <repositories>

                          <repository>

                              <id>JBoss-Releases</id>

                              <url>https://repository.jboss.org/nexus/content/repositories/releases/</url>

                          </repository>

                      </repositories>

                  </project>

                  • 21. Re: mode shape with sql server
                    rhauch

                    Regarding the error you get when running the 'modeshape-jdbc-store-example', I just tried the following and it works with no problems. First, I temporarily moved by "~/.m2/repository" to another location so that Maven will download everything from the Maven repository rather than use JARs it already cached. Then I ran the following commands on the command line:

                     

                    $ git clone https://github.com/ModeShape/modeshape-examples.git

                    $ cd modeshape-examples

                    $ git checkout 3.x

                    $ cd modeshape-jdbc-store-example

                    $ mvn clean install

                     

                    This completes with no problems.

                     

                    $ mvn --version

                    Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 10:22:22-0500)

                    Maven home: /usr/local/maven

                    Java version: 1.7.0_45, vendor: Oracle Corporation

                    Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre

                    Default locale: en_US, platform encoding: UTF-8

                    OS name: "mac os x", version: "10.9.2", arch: "x86_64", family: "mac"

                     

                    Please run these commands on the command line, and I suspect that it will work. (If not, then make sure that you're using Maven 3.1 or later and JDK 1.6 or later.)

                     

                    Only once this is working should you try to run them from within an IDE or try to change versions or use SQLServer.

                     

                    And please stop using ModeShape 3.1.x -- it's well over a year old and many issues have been fixed since then.

                    • 22. Re: mode shape with sql server
                      antonid

                      How are you forcing ModeShape 3.7.2.Final to use Infinispan 5.1.2.Final? The ModeShape 3.7.2.Final embedded BOM is clearly using Infinispan 5.2.7.Final. ModeShape 3.7.2.Final must use this specific version of Infinispan, otherwise you will get errors.

                       

                      where did u see that i have used infinispan version(5.1.2.final)

                       

                       

                       

                      myinfinspan :

                       

                       

                       

                      <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">

                       

                       

                       

                      in POM.xml i have put it(infinispan version) in commentaire

                       

                       

                       

                      should i download a repository ; i havent created any repository in windows

                       

                       

                       

                      i dont use git !! is it necessary ?

                       

                      i used the command

                       

                      $ mvn --version

                       

                      C:\Maven\apache-maven-3.2.1\bin>mvn --version

                       

                       

                       

                      Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T18:37:52+01:00)

                       

                       

                       

                      Maven home: C:\Maven\apache-maven-3.2.1

                       

                      Java version: 1.7.0_51, vendor: Oracle Corporation

                       

                      java home: C:\Program Files\Java\jdk1.7.0_51\jre

                       

                      Default locale: en_US, platform encoding: Cp1252

                       

                      OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

                       

                      C:\Maven\apache-maven-3.2.1\bin>

                       

                      itz just a question of parameter. sorry to ask is there any zip that contains a maven project. so that i can learn it at my rhyhtm.

                       

                       

                       

                      thanking you

                       

                      often i have this error message

                      • 23. Re: mode shape with sql server
                        rhauch

                        where did u see that i have used infinispan version(5.1.2.final)

                         

                        Because I see this in the log output you posted above:

                        if i use version 3.7.2.Final


                        15:51:23,645  INFO Log4j located in the classpath. It will be used by ModeShape for logging.

                        15:51:23,838  INFO ModeShape version 3.7.2.Final

                        15:51:24,256  INFO ISPN000128: Infinispan version: Infinispan 'Brahma' 5.1.2.FINAL    <--------------------------------

                         

                        This means that somewhere you have to be specifying the version of Infinispan.

                        myinfinspan :

                         

                         

                         

                        <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">

                         

                         

                        This is still okay. It's just saying that you want to define the Infinispan configuration using the 5.1 XSD. There is a 5.2 XSD, and it changes the XML structure a fair amount, but again it is not necessary to use.

                         

                        should i download a repository ; i havent created any repository in windows

                        No, there's nothing to download. I'm not even sure what this means.

                         

                        i dont use git !! is it necessary ?

                        Well, it's the easiest way to play with our examples that are at https://github.com/ModeShape/modeshape-examples/tree/3.x. If you don't want to use Git, then you can use the "Download ZIP" button on that page, or just follow this link: https://github.com/ModeShape/modeshape-examples/archive/3.x.zip. When you extract that ZIP file, you will have a directory with all of the examples, and you should be able to run them as-is, either by typing "mvn clean install" at the top-level directory (to run all of the examples) or by going into one of the examples (e.g., "modeshape-jdbc-store-example") and running "mvn clean install" in that directory (to just run that one example).

                         

                        i used the command

                         

                        $ mvn --version

                         

                        C:\Maven\apache-maven-3.2.1\bin>mvn --version

                         

                         

                         

                        Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T18:37:52+01:00)

                         

                         

                         

                        Maven home: C:\Maven\apache-maven-3.2.1

                         

                        Java version: 1.7.0_51, vendor: Oracle Corporation

                         

                        java home: C:\Program Files\Java\jdk1.7.0_51\jre

                         

                        Default locale: en_US, platform encoding: Cp1252

                         

                        OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

                        This is good.

                         

                        itz just a question of parameter. sorry to ask is there any zip that contains a maven project. so that i can learn it at my rhyhtm.

                         

                         

                         

                        thanking you

                         

                        often i have this error message

                        That's why I would like you to use our existing example and get that working. Until you do, many of these other problems are not at all related to ModeShape directly but rather errors in your POM files, such as using incompatible ModeShape and Infinispan versions.

                        • 24. Re: mode shape with sql server
                          antonid

                          Hello sir,

                          after a struggle i insert things in the table.

                           

                          with the error

                          16:41:26,633  INFO ISPN000031: MBeans were successfully registered to the platform MBean server.

                          16:41:26,968  INFO ISPN000031: MBeans were successfully registered to the platform MBean server.

                          16:41:27,030 ERROR ISPN008024: Error while storing string key to database; key: 'a7ca237317f1e7jcr:system', buffer size of value: 1099 bytes

                           

                          i have a doubt(sorry i cant find it in the doc) :

                           

                          Java(Main) :

                           

                                     // Get the root node ...

                                      Node root = session.getRootNode();

                                      assert root != null;

                           

                                      System.out.println("Found the root node in the \"" + session.getWorkspace().getName() + "\" workspace");

                           

                                      //create a node under the root

                                      Node n = root.addNode("Node" + rnd.nextInt());

                                   

                                      //????why 2 set property ??????? 

                                      n.setProperty("key", "value");

                                      n.setProperty("content", session.getValueFactory().createBinary(new ByteArrayInputStream(new byte[512])));

                           

                           

                                    // i try to create the second node under root  like this

                          Node n1 = root.addNode("Node child " + rnd.nextInt());

                          n1.setProperty("key", "value");

                          n1.setProperty("content", session.getValueFactory().createBinary(new ByteArrayInputStream(new byte[512])));

                          System.out.println("the node is " +n1);

                           

                           

                           

                          what shoud i do in the infinspan.xml ???

                           

                           

                          <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:sqlserver://localhost:1433;DatabaseName=modeshape"/>

                          <property name="userName" value="sa1"/>

                          <property name="password" value="sa"/>

                          <property name="driverClass" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>

                          <property name="idColumnType" value="VARCHAR(255)"/>

                          <property name="dataColumnType" value="BINARY(1024)"/>

                          <property name="dropTableOnExit" value="false"/>

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

                           

                           

                          Either should i add the the properties in for easch node ????

                           

                           

                           

                           

                           

                          SQL :

                          this is my sql

                          i imagine since there are 2 nodes (root and node n) there are 4 rows ???

                           

                           

                          ID_COLUMN =key((n1.setProperty("key", "value");)

                          DATA_COLUMN == (n1.setProperty("content", session.getValueFactory().createBinary(new ByteArrayInputStream(new byte[512])));)

                           


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

                          further i want to add another node n2 to n1 like this :


                          FileInputStream fis = new FileInputStream("C:\\test_modeshape\\test.txt");

                          String inputStreamString = new Scanner(fis,"UTF-8").useDelimiter("\\A").next();

                          System.out.println(inputStreamString);

                           

                           

                          Node n2 = root.addNode("Node child " + rnd.nextInt());

                          n2.setProperty("key", "value");

                          n2.setProperty("content", inputStreamString));

                           

                          what should i do in infinispan(once again i could not find it in doc)

                           

                           

                          my plan is to add severale nodes and each node might be an image ; text ; zips etc....i think of converting all into binary and stroing it into the database ?

                           

                          and i dont know to retreive it and displaying the content ?(

                           

                          advance thanks for all .......

                          • 25. Re: mode shape with sql server
                            rhauch

                            16:41:27,030 ERROR ISPN008024: Error while storing string key to database; key: 'a7ca237317f1e7jcr:system', buffer size of value: 1099 bytes

                            What versions of ModeShape and Infinispan are you now running? Both should be output in the log. What is your Infinispan configuration, and are you using ASYNC? If so, change this to SYNC.

                             

                                        //create a node under the root

                                        Node n = root.addNode("Node" + rnd.nextInt());

                                    

                                        //????why 2 set property ??????? 

                                        n.setProperty("key", "value");

                                        n.setProperty("content", session.getValueFactory().createBinary(new ByteArrayInputStream(new byte[512])));

                             

                             

                            This is likely just an example. You can create whatever structure of nodes and properties you want. This is where you have to figure out how to best represent the kind of data you want. Once again, I'll suggest that you read our documentation and even the JSR-283 specification. I can't design your whole application.

                             

                                      // i try to create the second node under root  like this

                            Node n1 = root.addNode("Node child " + rnd.nextInt());

                            n1.setProperty("key", "value");

                            n1.setProperty("content", session.getValueFactory().createBinary(new ByteArrayInputStream(new byte[512])));

                            System.out.println("the node is " +n1);

                             

                            You need to save your session before the information is actually persisted. BTW, this is all very introductory JCR stuff covered in our documentation and the JSR-283 specification.

                             

                            what shoud i do in the infinspan.xml ???

                             

                             

                            <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:sqlserver://localhost:1433;DatabaseName=modeshape"/>

                            <property name="userName" value="sa1"/>

                            <property name="password" value="sa"/>

                            <property name="driverClass" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>

                            <property name="idColumnType" value="VARCHAR(255)"/>

                            <property name="dataColumnType" value="BINARY(1024)"/>

                            <property name="dropTableOnExit" value="false"/>

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

                            Nothing. This looks fine. I think "VARCHAR(255)" is okay. If you happen to get errors about the column being too small (I don't think you will), then simply try "VARCHAR(512)".

                             

                            <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:sqlserver://localhost:1433;DatabaseName=modeshape"/>

                            <property name="userName" value="sa1"/>

                            <property name="password" value="sa"/>

                            <property name="driverClass" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>

                            <property name="idColumnType" value="VARCHAR(255)"/>

                            <property name="dataColumnType" value="BINARY(1024)"/>

                            <property name="dropTableOnExit" value="false"/>

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

                             

                            Either should i add the the properties in for easch node ????

                            No, you absolutely would not add node-specific information in the Infinispan configuration file.

                             

                             

                            SQL :

                            this is my sql

                            i imagine since there are 2 nodes (root and node n) there are 4 rows ???

                             

                             

                            There will actually be a lot more nodes under the '/jcr:system' node, so there should be a lot more rows. Something is still wrong in your ISPN configuration. We know that ModeShape works well with SQLServer, so you still have something messed up.

                             

                            ID_COLUMN =key((n1.setProperty("key", "value");)

                            DATA_COLUMN == (n1.setProperty("content", session.getValueFactory().createBinary(new ByteArrayInputStream(new byte[512])));)

                             

                             

                            No. The ID_COLUMN is used to store the identifier of the node, which basically corresponds to the result of node.getIdentifier(). The data column stores a Java serialized form of the BSON representation of the whole node (you can't see this representation using ModeShape's JCR API; it's an internal representation). Once again, YOU WILL NOT BE ABLE TO USE THIS INFORMATION IN ANY WAY OTHER THAN BY USING MODESHAPE.

                             

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

                            further i want to add another node n2 to n1 like this :


                            FileInputStream fis = new FileInputStream("C:\\test_modeshape\\test.txt");

                            String inputStreamString = new Scanner(fis,"UTF-8").useDelimiter("\\A").next();

                            System.out.println(inputStreamString);

                             

                             

                            Node n2 = root.addNode("Node child " + rnd.nextInt());

                            n2.setProperty("key", "value");

                            n2.setProperty("content", inputStreamString));

                             

                            what should i do in infinispan(once again i could not find it in doc)

                            Nothing. You don't ever do this via Infinispan (or SQLServer for that matter). You use ModeShape, ModeShape uses Infinispan, Infinispan stores stuff in SQLServer. The Infinispan XML file is a configuration file for Infinispan, which you set up once to tell Infinispan how to run and how to use SQLServer. ModeShape's configuration file tells ModeShape how to run, and how to find/use Infinispan.

                             

                            my plan is to add severale nodes and each node might be an image ; text ; zips etc....i think of converting all into binary and stroing it into the database ?

                             

                            and i dont know to retreive it and displaying the content ?(

                            Please see https://docs.jboss.org/author/display/MODE/Binary+values for information about how to store and read binary values (as properties). Please see https://docs.jboss.org/author/display/MODE/Concepts to learn about nodes, properties, and node types. Please see https://docs.jboss.org/author/display/MODE/Repository+and+Session about what sessions are and how to use them.

                             

                            As for displaying the content in your application, you can do this however you want using whatever technology you want.

                            • 26. Re: mode shape with sql server
                              antonid

                              10:38:37,661  INFO Log4j located in the classpath. It will be used by ModeShape for logging.

                              10:38:37,826  WARN The 'query.rebuildUponStartup' field in the repository configuration file is deprecated and is no longer used. { "name" : "Persisted-Repository" , "workspaces" : { "predefined" : [ "otherWorkspace" ] , "default" : "default" , "allowCreation" : true } , "security" : { "anonymous" : { "roles" : [ "readonly" , "readwrite" , "admin" ] , "useOnFailedLogin" : false } } , "storage" : { "cacheConfiguration" : "infinispan-configuration.xml" , "cacheName" : "persisted_repository" , "binaryStorage" : { "type" : "file" , "directory" : "target/content/binaries" , "minimumBinarySizeInBytes" : 999 } } , "query" : { "enabled" : true , "rebuildUponStartup" : "if_missing" , "indexStorage" : { "type" : "filesystem" , "location" : "target/content/index" , "lockingStrategy" : "simple" , "fileSystemAccessType" : "auto" } } }

                              10:38:37,866  INFO ModeShape version 3.7.2.Final

                              10:38:38,265  INFO ISPN000128: Infinispan version: Infinispan 'Delirium' 5.2.7.Final

                              10:38:38,479  INFO MLog clients using log4j logging.

                              10:38:38,499  INFO Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]

                              10:38:38,619  INFO Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hge0wz911g6qbvf6e1em2|2261414d, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.microsoft.sqlserver.jdbc.SQLServerDriver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hge0wz911g6qbvf6e1em2|2261414d, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:sqlserver://localhost:1433;DatabaseName=modeshape, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 15, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]

                              10:38:38,867  INFO ISPN000031: MBeans were successfully registered to the platform MBean server.

                              10:38:39,209  INFO ISPN000031: MBeans were successfully registered to the platform MBean server.

                              10:38:40,081  INFO HSEARCH000034: Hibernate Search 4.3.0.Final

                              10:38:40,095  INFO HCANN000001: Hibernate Commons Annotations {4.0.2.Final}

                              10:38:41,316 ERROR HSEARCH000058: Exception occurred org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: SimpleFSLock@target\content\index\nodeinfo\write.lock

                              Primary Failure:

                                  Entity org.modeshape.jcr.query.lucene.basic.NodeInfo  Id a7ca237317f1e7mode:repository  Work Type  org.hibernate.search.backend.AddLuceneWork

                               

                              otherwise i have some 206 records in sql ; hope i'm on the good path.

                              (206 row(s) affected)

                              1 2 Previous Next