10 Replies Latest reply on Apr 4, 2014 1:04 PM by rhauch

    Modeshape with MS SQL Server 2008 \ 2010

    kuzmenkov_leonid

      Hello, all!

       

      I want to ask if anyone of has actually used embedded modshape 3.7.1 Final with MSSQL Server 2008 or 2010... Because when I start jboss with application that is using modeshape (without even storing anything into it, but still it creates some system entries to DB table, eg about node types), stop it (controlled shutdown), and the start server with application again, I am getting a corrupted repository and application is refusing to start any further.

       

      I don't see any bugs related to this topic on issue tracker also, so I want to understand if this is issue of my enviromen (and everyone else don't have any problem related to this) or this is modeshape bug.

       

      No problem occurs when I use Oracle DB, but I need my application to be able to work with both, MS SQL Server and Oracle

      And I didn't notice such problem on modeshape 2.8.3 Final (I am trying to migrate from 2.8.3 Final to 3.7.1 Final version)

       

      Any advises are welcome!

       

      P.S. I can't use subsystem in jboss (if you are going to propose to try that), because I need my application also working on other Application Servers (for example, WebSphere)

        • 1. Re: Modeshape with MS SQL Server 2008 \ 2010
          rhauch

          Is this the same problem that is logged in MODE-2179? If so, please try the potential workaround described in a new comment I just added to that issue.

          • 2. Re: Re: Modeshape with MS SQL Server 2008 \ 2010
            kuzmenkov_leonid

            This is different problem. Thanks for the potential workaround problem with binary store, I will try and will tell results.

             

            This problem is more general and critical. Currently I have set no explicit settings for binary store (so it uses defaults, filesystem as a binary store).

            All functions seem to work normally (I can add content to the DB, view, modify).

            But when I shutdown Application Server, on the next start of AS server, on application load that uses modeshape next error occurs:

            16:08:22,384 ERROR [org.modeshape.jcr.RepositoryNodeTypeManager] (ServerService Thread Pool -- 49) Node types were read from the system content, and appear to be inconsistent or invalid: Persisted-Repository: java.lang.NullPointerException

             

                    at org.modeshape.jcr.SystemContent.first(SystemContent.java:647) [modeshape-jcr.jar:3.7.1.Final]

                    at org.modeshape.jcr.SystemContent.first(SystemContent.java:641) [modeshape-jcr.jar:3.7.1.Final]

                    at org.modeshape.jcr.SystemContent.readNodeTypeDefinition(SystemContent.java:533) [modeshape-jcr.jar:3.7.1.Final]

                    at org.modeshape.jcr.SystemContent.readAllNodeTypes(SystemContent.java:504) [modeshape-jcr.jar:3.7.1.Final]

                    at org.modeshape.jcr.RepositoryNodeTypeManager.refreshFromSystem(RepositoryNodeTypeManager.java:732) [modeshape-jcr.jar:3.7.1.Final]

                    at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:1124) [modeshape-jcr.jar:3.7.1.Final]

                    at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:971) [modeshape-jcr.jar:3.7.1.Final]

                    at org.modeshape.jcr.JcrRepository.doStart(JcrRepository.java:404) [modeshape-jcr.jar:3.7.1.Final]

                    at org.modeshape.jcr.JcrRepository.start(JcrRepository.java:328) [modeshape-jcr.jar:3.7.1.Final]

                    at org.modeshape.jcr.JcrRepositoriesContainer$FileRepositoryLookup.repository(JcrRepositoriesContainer.java:232) [modeshape-jcr.jar:3.7.1.Final]

                    at org.modeshape.jcr.JcrRepositoriesContainer.getRepository(JcrRepositoriesContainer.java:98) [modeshape-jcr.jar:3.7.1.Final]

                    at org.modeshape.jcr.JcrRepositoryFactory.getRepository(JcrRepositoryFactory.java:131) [modeshape-jcr.jar:3.7.1.Final]

                    at com.crif.cf.ecm.jcr.modeshape.ModeshapeConfiguration.onStartup(ModeshapeConfiguration.java:54) [modeshape-integration-filerepository.jar:]

                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_04]

                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_04]

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_04]

                    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_04]

                    at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptorFactory$ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptorFactory.java:130) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:95) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.as.ejb3.tx.EjbBMTInterceptor.handleInvocation(EjbBMTInterceptor.java:104) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at org.jboss.as.ejb3.tx.BMTInterceptor.processInvocation(BMTInterceptor.java:56) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:85) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at org.jboss.as.ejb3.component.singleton.SingletonComponent.getComponentInstance(SingletonComponent.java:126) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at org.jboss.as.ejb3.component.singleton.SingletonComponent.start(SingletonComponent.java:141) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:54) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_04]

                    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [rt.jar:1.7.0_04]

                    at java.util.concurrent.FutureTask.run(FutureTask.java:166) [rt.jar:1.7.0_04]

                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_04]

                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_04]

                    at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04]

                    at org.jboss.threads.JBossThread.run(JBossThread.java:122)

             

            16:09:08,627 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 49) MSC000001: Failed to start service jboss.deployment.subunit."modeshape-integration-ear.ear"."modeshape-integration-filerepository.jar".component.ModeshapeConfiguration.START: org.jboss.msc.service.StartException in service jboss.deployment.subunit."modeshape-integration-ear.ear"."modeshape-integration-filerepository.jar".component.ModeshapeConfiguration.START: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance

                    at org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:57) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_04]

                    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [rt.jar:1.7.0_04]

                    at java.util.concurrent.FutureTask.run(FutureTask.java:166) [rt.jar:1.7.0_04]

                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_04]

                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_04]

                    at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04]

                    at org.jboss.threads.JBossThread.run(JBossThread.java:122)

            Caused by: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance

                    at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:163) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:85) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at org.jboss.as.ejb3.component.singleton.SingletonComponent.getComponentInstance(SingletonComponent.java:126)

                    at org.jboss.as.ejb3.component.singleton.SingletonComponent.start(SingletonComponent.java:141)

                    at org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:54) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    ... 7 more

            Caused by: javax.ejb.EJBException: java.lang.RuntimeException: javax.jcr.RepositoryException: org.modeshape.jcr.cache.NodeNotFoundException: a7ca237317f1e7/jcr:system/jcr:nodeTypes/nt:unstructured/?/undefined/*

                    at org.jboss.as.ejb3.tx.BMTInterceptor.handleException(BMTInterceptor.java:78)

                    at org.jboss.as.ejb3.tx.EjbBMTInterceptor.checkStatelessDone(EjbBMTInterceptor.java:92)

                    at org.jboss.as.ejb3.tx.EjbBMTInterceptor.handleInvocation(EjbBMTInterceptor.java:107)

                    at org.jboss.as.ejb3.tx.BMTInterceptor.processInvocation(BMTInterceptor.java:56)

                    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)

                    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    ... 11 more

            Caused by: java.lang.RuntimeException: javax.jcr.RepositoryException: org.modeshape.jcr.cache.NodeNotFoundException: a7ca237317f1e7/jcr:system/jcr:nodeTypes/nt:unstructured/?/undefined/*

                    at com.crif.cf.ecm.jcr.modeshape.ModeshapeConfiguration.onStartup(ModeshapeConfiguration.java:66)

                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_04]

                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_04]

                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_04]

                    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_04]

                    at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptorFactory$ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptorFactory.java:130) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:95) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]

                    at org.jboss.as.ejb3.tx.EjbBMTInterceptor.handleInvocation(EjbBMTInterceptor.java:104)

                    ... 19 more

            Caused by: javax.jcr.RepositoryException: org.modeshape.jcr.cache.NodeNotFoundException: a7ca237317f1e7/jcr:system/jcr:nodeTypes/nt:unstructured/?/undefined/*

                    at org.modeshape.jcr.JcrRepositoriesContainer$FileRepositoryLookup.repository(JcrRepositoriesContainer.java:243)

                    at org.modeshape.jcr.JcrRepositoriesContainer.getRepository(JcrRepositoriesContainer.java:98)

                    at org.modeshape.jcr.JcrRepositoryFactory.getRepository(JcrRepositoryFactory.java:131)

                    at com.crif.cf.ecm.jcr.modeshape.ModeshapeConfiguration.onStartup(ModeshapeConfiguration.java:54)

                    ... 34 more

            Caused by: org.modeshape.jcr.cache.NodeNotFoundException: a7ca237317f1e7/jcr:system/jcr:nodeTypes/nt:unstructured/?/undefined/*

                    at org.modeshape.jcr.cache.document.SessionNode.getPath(SessionNode.java:478)

                    at org.modeshape.jcr.cache.PathCache.getPath(PathCache.java:49)

                    at org.modeshape.jcr.cache.document.WritableSessionCache.persistChanges(WritableSessionCache.java:958)

                    at org.modeshape.jcr.cache.document.WritableSessionCache.save(WritableSessionCache.java:456)

                    at org.modeshape.jcr.cache.document.WritableSessionCache.save(WritableSessionCache.java:420)

                    at org.modeshape.jcr.SystemContent.save(SystemContent.java:111)

                    at org.modeshape.jcr.RepositoryNodeTypeManager.registerNodeTypes(RepositoryNodeTypeManager.java:522)

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

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

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

                    at org.modeshape.jcr.JcrRepository.start(JcrRepository.java:328)

                    at org.modeshape.jcr.JcrRepositoriesContainer$FileRepositoryLookup.repository(JcrRepositoriesContainer.java:232)

                    ... 37 more

            • 3. Re: Re: Modeshape with MS SQL Server 2008 \ 2010
              rhauch

              Can you share your Infinispan configuration? It almost sounds like not all data is being persisted to the cache store (that you're using passivation).

              • 4. Re: Re: Re: Modeshape with MS SQL Server 2008 \ 2010
                kuzmenkov_leonid

                If there is no other option to accidently enable passivation, then in loader configuration passivation is set to false.

                That is exactly my thought, that something from memory is not saved to DB. Is there any way to check if this is the case or to force persistent state?

                Config is below:

                <infinispan

                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                   xsi:schemaLocation="urn:infinispan:config:5.2 http://www.infinispan.org/schemas/infinispan-config-5.2.xsd

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

                   xmlns="urn:infinispan:config:5.2"

                   xmlns:jdbc="urn:infinispan:config:jdbc:5.2" >

                 

                    <global>

                    </global>

                    <default>

                        <deadlockDetection enabled="true" spinDuration="500"/>

                    </default>

                 

                    <namedCache name="persisted_repository">

                        <loaders passivation="false" shared="false" preload="false">

                            <stringKeyedJdbcStore xmlns="urn:infinispan:config:jdbc:5.2" fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false">

                               <dataSource jndiUrl="java:/jdbc/DataDS" />

                               <stringKeyedTable dropOnExit="false" createOnStart="false" prefix="inf">

                                   <idColumn name="ID_COLUMN" type="VARCHAR(255)" />

                                   <dataColumn name="DATA_COLUMN" type="varbinary(max)" />

                                   <timestampColumn name="TIMESTAMP_COLUMN" type="NUMERIC(38,0)" />

                               </stringKeyedTable>

                            </stringKeyedJdbcStore>

                        </loaders>     

                        <locking lockAcquisitionTimeout="30000"/>

                    

                        <transaction transactionMode="TRANSACTIONAL"

                                     lockingMode="OPTIMISTIC">

                            <!--recovery enabled = "true"/-->

                        </transaction>

                    </namedCache>

                </infinispan>

                • 5. Re: Re: Re: Modeshape with MS SQL Server 2008 \ 2010
                  rhauch

                  Well, a few things.

                   

                  1. The "createOnStart" is false. Is that because you're manually setting up the database schema before starting ModeShape?
                  2. The "lockingMode" is "OPTIMISTIC". You should really start out with "PESSIMISTIC" and only switch to optimistic as an optimization only if your application will never be update the same nodes from separate threads.
                  3. You're 100% sure that nothing else is using this database, and that you're not re-initializing the database schema each time you start?
                  4. When it works with Oracle, what are you changing? Just the data source and any columns?

                   

                  After you shut down ModeShape, go into the database and count the number of rows in the "inf*" table. The stringKeyedJdbcStore stores each node in a separate row, so there should be several hundred rows minimum (just for starting the repository, logging in, logging out, and shutting the repository down gracefully).

                   

                  If none of this helps, you may want to ask in the Infinispan forum if there's any trick to using SQLServer and the StringKeyedJdbcStore. It makes no sense that it works with Oracle but does not work with SQLServer.

                  • 6. Re: Re: Re: Re: Modeshape with MS SQL Server 2008 \ 2010
                    kuzmenkov_leonid

                    1. I have set createOnStart to true one time, scripted table in DB, and recreate it manually if needed (mainly in case of corrupted repository)

                    2. I agree about transaction mode, however pessimistic transaction mode doesn't work well for my infinispan configuration. If I try to use pessimistic transaction mode with any transactionManagerLookup class other than Dummy (that is marked in documentation as for test purposes only) including not specifying it at all, I am getting next error (please, check attached text file). It happens both for Oracle and MS SQL Server DBs. Also, I have noticed, that when I have specified no infinispan config for cache in modeshape config (does it still use infinispan in that case? If yes, do I understand it correctly, that it uses defaults - GenericTransactionManagerLookup class with pessimistic mode?), I got no such error.

                     

                    3. Yes, I have separate local enviroment, and I do all calls on the same machine, except for DB - it is on the separate server, but these tables are currently being used only by me.

                    I do not reinititalize it manually each time I start (only when needed), that is certain.

                     

                    4. Only datasources in standalone.xml of jboss (eap 6.1), and types for columns of the table in infinispan config.

                     

                    After starting infinispan table in DB contains 248 rows after started, and same amount after shutting down (should its count change during shutdown process?)

                     

                    Is there any programmatic way to shutdown repository ? I couldn't find any...

                     

                    Thanks for you help, I will try to ask on infinispan forum too

                    • 7. Re: Re: Re: Re: Modeshape with MS SQL Server 2008 \ 2010
                      rhauch

                      2. I agree about transaction mode, however pessimistic transaction mode doesn't work well for my infinispan configuration. If I try to use pessimistic transaction mode with any transactionManagerLookup class other than Dummy (that is marked in documentation as for test purposes only) including not specifying it at all, I am getting next error (please, check attached text file). It happens both for Oracle and MS SQL Server DBs.

                      Are you using an XA data source? The Infinispan JDBC cache stores are not transactional, so I don't think you can use an XA data source with them. That'd be another question for the Infinispan folks.

                       

                      We definitely use transactions in our integration tests and even some of our EAP (in 3.x) and Wildfly (in 4.x) quickstarts, and we even have tests for embedded mode that use the transaction manager from JBoss Transactions and from Atomikos.

                       

                      Just be aware that you may very well run into consistency problems (lost data) if you continue to use OPTIMISTIC and your application has multiple threads attempting to simultaneously update the same node, whereas PESSIMISTIC ensures that there's never two concurrent writers.

                       

                      Also, I have noticed, that when I have specified no infinispan config for cache in modeshape config (does it still use infinispan in that case? If yes, do I understand it correctly, that it uses defaults - GenericTransactionManagerLookup class with pessimistic mode?), I got no such error.

                      When your repository configuration file doesn't specify an Infinispan configuration (or it even accidentally specifies a nonexistent Infinispan configuration), ModeShape uses an in-memory Infinispan cache. That means you lose all your data as soon as your process terminates.

                       

                      After starting infinispan table in DB contains 248 rows after started, and same amount after shutting down (should its count change during shutdown process?)

                       

                      That sounds about right. These are all the nodes in the "/jcr:system" area (e.g., mostly namespaces and node types) and any root nodes for any (used) workspaces. And no, the shutdown process won't add any content.

                       

                      Is there any programmatic way to shutdown repository ? I couldn't find any...

                      You mention using "embedded", but from your stack traces it looks like you're actually running within EAP. So if you using the ModeShape subsystem, then you can shutdown the repository using the CLI. If you're truly "embedding" the ModeShapeEngine inside your application, then you can shutdown a single repository using: the "ModeShapeEngine.shutdownRepository(String repoName)" method.

                      1 of 1 people found this helpful
                      • 8. Re: Re: Re: Re: Modeshape with MS SQL Server 2008 \ 2010
                        hchiorean

                        This may (or may not) help with the problem: while looking at [MODE-2179] Error using MS SQL Server 2008 DB as binary store - JBoss Issue Tracker I had to use a remote MS SQL Server 2008 environment, for which I have a lot of lag. On my machine I found out that using the JBossStandaloneJTAManagerLookup in ISPN (which is basically the default TX manager in EAP) was causing constant transaction timeouts and ISPN was aborting the initial "repository#startup()" transaction.

                         

                        The solution was to configure the JBoss JTA Manager and increase the default (60 seconds) timeout. In a local (non EAP) setup like mine, you do this by adding a jbossts-properties.xml file in the classpath with the following configuration:

                        <entry key="CoordinatorEnvironmentBean.defaultTimeout">360</entry>


                        In the case of EAP, you should have similar control and be able to configure & increase the JTA timeout (e.g. http://www.mastertheboss.com/jboss-configuration/configuring-transactions-jta-using-jboss-as7/wildfly)

                        • 9. Re: Modeshape with MS SQL Server 2008 \ 2010
                          kuzmenkov_leonid

                          1.

                          Are you using an XA data source? The Infinispan JDBC cache stores are not transactional, so I don't think you can use an XA data source with them. That'd be another question for the Infinispan folks.

                          No, I'm using same datasource that is specified in the MODE-2179, that is default, and is not XA (correct me if I am wrong):

                          <datasource jndi-name="java:/jdbc/DataDS" pool-name="DataDS" enabled="true" use-java-context="true">

                                 <connection-url>jdbc:sqlserver://servername;databaseName=DBName;instanceName=InstName</connection-url>
                                 <driver>sqlserver</driver>

                                 <security>

                                      <user-name>exampleuser</user-name>

                                      <password>examplepass</password>

                                 </security>

                          </datasource>

                           

                           

                          2.

                          When your repository configuration file doesn't specify an Infinispan configuration (or it even accidentally specifies a nonexistent Infinispan configuration), ModeShape uses an in-memory Infinispan cache. That means you lose all your data as soon as your process terminates.

                          That, actually, explains the why I am getting no error in this particular case, thanks

                           

                          ====

                           

                          I have solved main problem.

                           

                          I have checked DB for the node (in the logs above "a7ca237317f1e7/jcr:system/jcr:nodeTypes/nt:unstructured/?/undefined/*") that it can't find there (during second startup), and it is actually present in DB table. I have noticed this a while ago, but didn't gave much thought into it (my mistake). But than my collegaue pointed to this fact again, and we decided to check it more closely.

                           

                          So, it couldn't find this record that was already present. That was strange, especially considering that all characters seem to be ordinary. The only place that was suspicious - question mark. We checked DB in Oracle and there was a question mark upside down. Symbol wasn't recognized by character set in MS SQL Server.

                           

                          Long story short, this is all because I initially created table that had ID_COLUMN type "varchar" instead of "nvarchar" (that can store data in unicode, and all strange characters).

                           

                          With ID_COLUMN type set to "nvarchar" main problem (about "corrupted repository on restart") is solved.

                           

                          That didn't help bug with binary repository or transaction managers though. I will check next workaround about binary repository that you have proposed next.

                          Any thoughts about transaction managers and transaction modes (why none of them, except Dummy, are working in pessimistic mode) are still appriciated.

                           

                          I thank you both for all your help and advices

                          • 10. Re: Modeshape with MS SQL Server 2008 \ 2010
                            rhauch

                            Long story short, this is all because I initially created table that had ID_COLUMN type "varchar" instead of "nvarchar" (that can store data in unicode, and all strange characters).

                             

                            With ID_COLUMN type set to "nvarchar" main problem (about "corrupted repository on restart") is solved.

                             

                            Wow. That's a hard lesson to learn, and something I didn't even know.

                             

                            FWIW, Horia fixed the binary store problem (MODE-2179) this morning and did use NVARCHAR for the column types (instead of VARCHAR). Feel free to copy this properties file and place it on your classpath (in the correct directory); it should work in 3.7.1 as well.