1 2 Previous Next 21 Replies Latest reply on Jun 21, 2013 11:12 AM by rhauch

    ModeShape not commiting using Atomikos and Spring

    singhl1

      We have the following scenario, Tomcat 6.0.37, Spring 3.1, ModeShape 3.3.0, and i have the follwoing problem, if i add node to the repository workspace, they are visibe on the web screen i add them through. I am adding an nt:folder node to an existing nt:folder in the workspace. If i naviate away from the web page and back to the same web page the newly added node is no longer there, it seems as though my new node has not been commited to the repository (or rolled back by atomikos???)

       

      My config is as follows:

      dataRepository.json

      {

          "name": "Repository",

          "jndiName": "",

          "workspaces": {

              "predefined": ["Library"],

              "default": "Library",

              "allowCreation": true

          },

          "security": {

              "anonymous": {

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

                  "useOnFailedLogin": false

              }

          },

          "storage": {

              "cacheName": "Repository",

              "binaryStorage": {

                  "type": "file",

                  "directory": "/repo/Library/binaries"

              }

          },

          "query": {

              "enabled": true,

              "enableFullTextSearch": true,

              "indexStorage": {

                  "type" : "filesystem",

                  "location" : "/repo/Library/indexes",

                  "lockingStrategy" : "simple",

                  "fileSystemAccessType" : "auto"

              },

              "indexing" : {

                  "rebuildOnStartup": {

                      "includeSystemContent": true,

                      "mode" : "sync"

                  }

              },

              "textExtracting": {

                  "extractors": {

                      "tikaExtractor": {

                          "name": "Tika content-based extractor",

                          "classname": "tika"

                      }

                  }

              }

          },

          "sequencing": {

              "removeDerivedContentWithOriginal": true,

              "sequencers": {

                  "Images in separate location": {

                      "classname": "ImageSequencer",

                      "pathExpression": "Library://(*.(gif|png|pict|jpg))/jcr:content[@jcr:data] => Library:/sequenced/images"

                  }

              }

          },

          "node-types" : ["common_mixin.cnd"]

      }

       

       

       

      I am extending RepositoryFactoryBean in java as follows:

       

      import java.util.concurrent.Future;

      import javax.jcr.Node;

      import javax.jcr.PathNotFoundException;

      import org.apache.commons.logging.Log;

      import org.apache.commons.logging.LogFactory;

      import org.modeshape.common.collection.Problems;

      import org.modeshape.jcr.RepositoryConfiguration;

      import org.springframework.extensions.jcr.RepositoryFactoryBean;

       

       

      import javax.jcr.Repository;

      import javax.jcr.RepositoryException;

      import javax.jcr.Session;

      import org.infinispan.configuration.cache.Configuration;

      import org.infinispan.configuration.cache.ConfigurationBuilder;

      import org.infinispan.transaction.LockingMode;

      import org.infinispan.transaction.TransactionMode;

      import org.modeshape.jcr.LocalEnvironment;

      import org.modeshape.jcr.ModeShapeEngine;

      import org.springframework.beans.factory.annotation.Autowired;

      import org.springframework.beans.factory.annotation.Value;

      import org.springframework.core.io.Resource;

       

       

      public class ModeShapeRepositoryFactoryBean extends RepositoryFactoryBean {

       

       

          private final static Log log = LogFactory.getLog(ModeShapeRepositoryFactoryBean.class);

          @Value("${modeshape.jsonfile}")

          private Resource jcrconfigresource;

          @Value("${modeshape.defaultworkspace}")

          private String modeshapeDefaultworkspace;

          @Autowired

          private ModeShapeEngine engine;

          @Autowired

          private GetInfinispanTransactionmanager getInfinispanTransactionmanager;

          private RepositoryConfiguration repositoryConfiguration;

       

       

          @Override

          protected void resolveConfigurationResource() throws Exception {

              log.debug("resolveConfigurationResource - start");

              if (repository == null) {

                  try {

                      repositoryConfiguration = RepositoryConfiguration.read(jcrconfigresource.getFile());

                     

                      ConfigurationBuilder builder = new ConfigurationBuilder();

                      Configuration cacheConfig =

                              builder

                              .transaction()

                              .transactionManagerLookup(getInfinispanTransactionmanager)

                              .transactionMode(TransactionMode.TRANSACTIONAL)

      //                        .autoCommit(true)

                              .lockingMode(LockingMode.PESSIMISTIC)

                              .loaders()

                              .passivation(false)

                              .shared(false)

                              .preload(false)

                              .addFileCacheStore().async().threadPoolSize(10).enabled(true)

                              .fetchPersistentState(false)

                              .purgeOnStartup(false)

                              .addProperty("location", "/repo/Library/content")

                              .build();

       

       

                      LocalEnvironment environment = new LocalEnvironment();

                      environment.defineCache("Repository", cacheConfig); // Must match the cacheName property in your modeshape config

       

       

                      if (repositoryConfiguration == null) {

                          repositoryConfiguration = RepositoryConfiguration.read(jcrconfigresource.getFile());

                      }

                      repositoryConfiguration = repositoryConfiguration.with(environment);

       

       

                  } catch (Throwable e) {

                      log.error(e);

                  }

                  log.debug("resolveConfigurationResource - end");

              }

          }

       

       

          @Override

          public Repository getObject() throws Exception {

              return this.repository;

          }

       

          @Override

          protected Repository createRepository() throws Exception {

       

       

              log.debug("createRepository - start");

              if (repository == null) {

                  try {

       

       

                      if (repositoryConfiguration == null) {

                          resolveConfigurationResource();

                      }

       

       

                      engine.start();

       

       

                      // Verify the configuration for the repository ...

                      Problems problems = repositoryConfiguration.validate();

                      if (problems.hasErrors()) {

                          log.error("Problems starting the engine.");

                          log.error(problems);

                      }

       

       

                      repository = engine.deploy(repositoryConfiguration);

                      engine.start();

                      Session session = repository.login(modeshapeDefaultworkspace);

                      Node root = session.getRootNode();

                

                      try {

                          Node library = session.getNode("/Library");

                      } catch (PathNotFoundException e){

                          root.addNode("Library", "nt:folder");

                      } catch (RepositoryException e){

                          root.addNode("Library", "nt:folder");

                      }

                      session.save();

                      session.logout();

       

       

                  } catch (Throwable e) {

                      log.error(e);

                  }

       

       

              }

       

       

              return repository;

       

       

          }

       

       

          @Override

          public void destroy() throws Exception {

              Future<Boolean> future = engine.undeploy(repositoryConfiguration.getName());

              if (future.get()) {

                  log.debug("Undeployed " + repositoryConfiguration.getName() + repositoryConfiguration.getName());

       

       

              }

       

       

              future = engine.shutdown();

              if (future.get()) {   // optional, but blocks until engine is completely shutdown or interrupted

                  log.debug("Shut down ModeShape");

              }

          }

      }

       

       

       

       

       

       

      The transactionmanager is retrieved by the following code:

       

      import javax.transaction.TransactionManager;

      import org.infinispan.transaction.lookup.TransactionManagerLookup;

      import org.springframework.beans.factory.annotation.Autowired;

      import org.springframework.transaction.jta.JtaTransactionManager;

       

      public class GetInfinispanTransactionmanager implements TransactionManagerLookup {

         

          @Autowired

          JtaTransactionManager JtaTransactionManager;

       

       

          @Override

          public TransactionManager getTransactionManager() throws Exception {

              return JtaTransactionManager.getTransactionManager();

          }   

      }

       

       

       

       

      My atomikos cofig is as follows in spring:

       

          <beans:bean id="userTransactionService" 

                  class="com.atomikos.icatch.config.UserTransactionServiceImp" 

                  init-method="init" destroy-method="shutdownForce" depends-on="setMyAtomikosSystemProps">

              <beans:constructor-arg>

                  <!-- IMPORTANT: specify all Atomikos properties here -->

                  <beans:props>

                      <beans:prop key="com.atomikos.icatch.service">

                          com.atomikos.icatch.standalone.UserTransactionServiceFactory

                      </beans:prop>

                  </beans:props>

              </beans:constructor-arg>

          </beans:bean>

       

      <!-- 

           Construct Atomikos UserTransactionManager, 

           needed to configure Spring 

      -->

          <beans:bean id="AtomikosTransactionManager" 

            class="com.atomikos.icatch.jta.UserTransactionManager" 

            init-method="init" destroy-method="close" 

            depends-on="userTransactionService,setMyAtomikosSystemProps">

       

              <!-- IMPORTANT: disable startup because the userTransactionService above does this -->

              <beans:property name="startupTransactionService" value="false"/>

       

              <!--  

               when close is called, 

               should we force transactions to terminate or not? 

              -->

              <beans:property name="forceShutdown" value="false" />

          </beans:bean>

       

      <!-- 

           Also use Atomikos UserTransactionImp, 

           needed to configure Spring  

      --> 

          <beans:bean id="AtomikosUserTransaction" 

                  class="com.atomikos.icatch.jta.UserTransactionImp"  

                  depends-on="userTransactionService,setMyAtomikosSystemProps">

              <beans:property name="transactionTimeout" value="300" />

          </beans:bean>

       

      <!-- 

         Configure the Spring framework to use JTA transactions from Atomikos  

      -->

          <beans:bean id="JtaTransactionManager" 

              class="org.springframework.transaction.jta.JtaTransactionManager" 

              depends-on="userTransactionService,setMyAtomikosSystemProps">

              <beans:property name="transactionManager" ref="AtomikosTransactionManager" />

              <beans:property name="userTransaction" ref="AtomikosUserTransaction" />

          </beans:bean>

         

           <tx:annotation-driven transaction-manager="JtaTransactionManager" />

         

          <beans:bean id="setMyAtomikosSystemProps"

            class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">

              <beans:property name="targetObject">

                  <!-- System.getProperties() -->

                  <beans:bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">

                      <beans:property name="targetClass" value="java.lang.System" />

                      <beans:property name="targetMethod" value="getProperties" />

                  </beans:bean>

              </beans:property>

              <beans:property name="targetMethod" value="putAll" />

              <beans:property name="arguments">

                  <!-- The new Properties -->

                  <util:properties>

                      <beans:prop key="com.atomikos.icatch.file">jta.properties</beans:prop>

                      <beans:prop key="com.atomikos.icatch.hide_init_file_path">true</beans:prop>

                  </util:properties>

              </beans:property>

          </beans:bean>

       

      The transactiona are annotated with @Transactional("JtaTransactionManager")

       

      My jta.properties are:

      com.atomikos.icatch.service=com.atomikos.icatch.standalone.UserTransactionServiceFactory

      com.atomikos.icatch.console_file_name = tm.out

      com.atomikos.icatch.console_file_limit=-1

      com.atomikos.icatch.output_dir = ./

      com.atomikos.icatch.log_base_dir = ./

      com.atomikos.icatch.log_base_name = tmlog

      com.atomikos.icatch.max_actives = -1

      com.atomikos.icatch.default_jta_timeout = 100000

      com.atomikos.icatch.max_timeout = 300000

      com.atomikos.icatch.tm_unique_name = tm

       

       

      For some reason any updates to the repository are not persisted, my thinking is that the ModeShapeRepositoryFactoryBean ConfigurationBuilder code is not correct, if i set the transaction to autocommit off i get execeptions thrown if the repository is added to. The strange thing is while i add to the repository in a web page all changes are visible, but when i navigate away and back to the same page, the changes have disappeared (rolled back?).....

        • 1. Re: ModeShape not commiting using Atomikos and Spring
          rhauch

          First of all, you cannot use Infinispan's "autoCommit" transactions with ModeShape. ModeShape (or any user-transaction) has to be able to control the transaction boundary.

           

          Secondly (this probably doesn't matter for the test), but your ModeShapeRepositoryFactoryBean.createRepository() method is not very safe: if a repository is created but your obtaining a session fails, the method will not create your initial nodes but the 'repository' field will be set; upon subsequent calls, the 'repository' field is set and the initialization logic will not be run. BTW, you might consider using ModeShape's initial content feature to define these nodes; upon repository startup, ModeShape will correctly create initial content only when the repository is created.

           

          Third, I'm trying to replicate a simple test with code that is similar to your ModeShapeRepositoryFactoryBean to see if the LocalEnvironment usage is incorrect. Have you tried setting ModeShape set up the cache container by putting the path to the Infinispan cache configuration XML file inside your ModeShape configuration? If that works, then we know that it's an issue with the way you're using LocalEnvironment.

           

          If you try the Infinispan XML configuration file approach and you get the same behavior, then try enabling DEBUG or TRACE logging on ModeShape's logging in the transaction/save logic (the "org.modeshape.jcr.txn" logging scope). That should log all kinds of information about transaction-related operations. If that's not sufficiently useful, try enabling DEBUG logging on Infinispan and/or Atomikos.

          • 2. Re: ModeShape not commiting using Atomikos and Spring
            singhl1

            Hi Randall,

            The autocommit is commented out, but i assum it will default to true, if i set it to true, i get exceptions thrown when i try to add nodes (will post the exact exception later).

             

            I cannot put the path to the Infinispan cache configuration XML file inside my ModeShape configuration, becuase it requires an instance of the TransactionManagerLookup, and it does not work in spring (this is why i have done it in java).

             

            I suspect it is the LocalEnvironment, but i cannot figure out why.

             

            Will add the extra,  logging. and re-post results.

            • 3. Re: ModeShape not commiting using Atomikos and Spring
              rhauch

              Oh, one more thing. The ModeShapeEngine instance in your ModeShapeRepositoryFactoryBean class is auto-wired. Can you verify that you get the same ModeShapeEngine instance every time the bean is used?

              • 4. Re: ModeShape not commiting using Atomikos and Spring
                rhauch

                The autocommit is commented out, but i assum it will default to true, if i set it to true, i get exceptions thrown when i try to add nodes (will post the exact exception later).

                Don't bother. You cannot set it to 'true'. If anything, you should set it to 'false'.

                 

                Ignore this comment. You shouldn't have to set this, because the default value of 'true' is correct. If you are getting exceptions when setting autoCommit to true, then please let me know what they are. I get the following exception if I set it to 'false':

                 

                javax.jcr.RepositoryException: Error while starting 'Repository' repository: Cannot create a transactional context without a valid Transaction instance.

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

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

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

                  ...

                Caused by: java.lang.IllegalArgumentException: Cannot create a transactional context without a valid Transaction instance.

                          at org.infinispan.context.TransactionalInvocationContextContainer.createInvocationContext(TransactionalInvocationContextContainer.java:112)

                          at org.infinispan.CacheImpl.getInvocationContext(CacheImpl.java:531)

                          at org.infinispan.CacheImpl.getInvocationContextWithImplicitTransaction(CacheImpl.java:515)

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

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

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

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

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

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

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

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

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

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

                          ... 28 more

                 

                 

                 

                I cannot put the path to the Infinispan cache configuration XML file inside my ModeShape configuration, becuase it requires an instance of the TransactionManagerLookup, and it does not work in spring (this is why i have done it in java).

                Okay. I'll keep investigating.

                • 5. Re: ModeShape not commiting using Atomikos and Spring
                  singhl1

                  Should be it is defined as a singleton in application context:

                  <!-- engine -->

                      <beans:bean id="engine" class="org.modeshape.jcr.ModeShapeEngine" />

                   

                  Also i am correct in thinking that that, the save to file system should be transactional - i am using Windows 7 by the way, if that makes any difference.

                   

                  ON startup of my app - with autocommit set to false i get the following debug message:

                  2013-06-19 14:36:51 org.modeshape.common.logging.slf4j.SLF4JLoggerImpl [DEBUG] Starting cache manager with global configuration

                  GlobalConfiguration{asyncListenerExecutor=ExecutorFactoryConfiguration{factory=org.infinispan.executors.DefaultExecutorFactory@4f432acf}, asyncTransportExecutor=ExecutorFactoryConfiguration{factory=org.infinispan.executors.DefaultExecutorFactory@42afa4b0}, evictionScheduledExecutor=ScheduledExecutorFactoryConfiguration{factory=org.infinispan.executors.DefaultScheduledExecutorFactory@19654104}, replicationQueueScheduledExecutor=ScheduledExecutorFactoryConfiguration{factory=org.infinispan.executors.DefaultScheduledExecutorFactory@468f7aa2}, globalJmxStatistics=GlobalJmxStatisticsConfiguration{allowDuplicateDomains=true, enabled=false, jmxDomain='org.infinispan', mBeanServerLookup=org.infinispan.jmx.PlatformMBeanServerLookup@75bc45de, cacheManagerName='DefaultCacheManager', properties={}}, transport=TransportConfiguration{clusterName='ISPN', machineId='null', rackId='null', siteId='null', strictPeerToPeer=false, distributedSyncTimeout=240000, transport=null, nodeName='null', properties={}}, serialization=SerializationConfiguration{advancedExternalizers={}, marshaller=org.infinispan.marshall.VersionAwareMarshaller@1b8f2e35, version=52, classResolver=null}, shutdown=ShutdownConfiguration{hookBehavior=DEFAULT}, modules={}, site=SiteConfiguration{localSite='null'}, cl=WebappClassLoader

                    context: /repo

                    delegate: false

                    repositories:

                      /WEB-INF/classes/

                  ----------> Parent Classloader:

                  org.apache.catalina.loader.StandardClassLoader@1264ab4d

                  }

                  and default configuration:

                  Configuration{classLoader=null, clustering=ClusteringConfiguration{async=AsyncConfiguration{asyncMarshalling=false, replicationQueue=null, replicationQueueInterval=5000, replicationQueueMaxElements=1000, useReplicationQueue=false}, cacheMode=LOCAL, hash=HashConfiguration{consistentHashFactory=null, hash=MurmurHash3, numOwners=2, numSegments=60, groupsConfiguration=GroupsConfiguration{enabled=false, groupers=[]}, stateTransferConfiguration=StateTransferConfiguration{chunkSize=10000, fetchInMemoryState=false, originalFetchInMemoryState=null, timeout=240000, awaitInitialTransfer=false, originalAwaitInitialTransfer=null}}, l1=L1Configuration{enabled=false, invalidationThreshold=0, lifespan=600000, onRehash=false, cleanupTaskFrequency=600000}, stateTransfer=StateTransferConfiguration{chunkSize=10000, fetchInMemoryState=false, originalFetchInMemoryState=null, timeout=240000, awaitInitialTransfer=false, originalAwaitInitialTransfer=null}, sync=SyncConfiguration{replTimeout=15000}}, customInterceptors=CustomInterceptorsConfiguration{interceptors=[]}, dataContainer=DataContainerConfiguration{dataContainer=null}, deadlockDetection=DeadlockDetectionConfiguration{enabled=false, spinDuration=100}, eviction=EvictionConfiguration{maxEntries=-1, strategy=NONE, threadPolicy=DEFAULT}, expiration=ExpirationConfiguration{lifespan=-1, maxIdle=-1, reaperEnabled=true, wakeUpInterval=60000}, indexing=IndexingConfiguration{enabled=false, indexLocalOnly=false}, invocationBatching=InvocationBatchingConfiguration{enabled=false}, jmxStatistics=JMXStatisticsConfiguration{enabled=false}, loaders=LoadersConfiguration{cacheLoaders=[], passivation=false, preload=false, shared=false}, locking=LockingConfiguration{concurrencyLevel=32, isolationLevel=READ_COMMITTED, lockAcquisitionTimeout=10000, useLockStriping=false, writeSkewCheck=false}, modules={}, storeAsBinary=StoreAsBinaryConfiguration{enabled=false, storeKeysAsBinary=true, storeValuesAsBinary=true}, transaction=TransactionConfiguration{autoCommit=true, cacheStopTimeout=30000, eagerLockingSingleNode=false, lockingMode=PESSIMISTIC, syncCommitPhase=true, syncRollbackPhase=false, transactionManagerLookup=org.infinispan.transaction.lookup.GenericTransactionManagerLookup@5522a7b5, transactionSynchronizationRegistryLookup=null, transactionMode=TRANSACTIONAL, useEagerLocking=false, useSynchronization=true, recovery=RecoveryConfiguration{enabled=true, recoveryInfoCacheName='__recoveryInfoCacheName__'}, reaperWakeUpInterval=1000, completedTxTimeout=15000, use1PcForAutoCommitTransactions=false}, versioning=VersioningConfiguration{enabled=false, scheme=NONE}, unsafe=UnsafeConfiguration{unreliableReturnValues=false}, sites=SiteConfiguration{allBackups=[], backupFor=BackupForConfiguration{remoteCache='null', remoteSite='null'}, disableBackups=false, inUseBackupSites=[]}}

                   

                  And with autocommit = false the following exception is thrown when trying ot add a node:

                   

                  2013-06-19 14:40:41 ModeShapeRepositoryFactoryBean [ERROR] javax.jcr.RepositoryException: Error while starting 'Repository' repository: Cannot create a transactional context without a valid Transaction instance.

                  • 6. Re: ModeShape not commiting using Atomikos and Spring
                    rhauch

                    ... transactionManagerLookup=org.infinispan.transaction.lookup.GenericTransactionManagerLookup@5522a7b5,...

                    This is interesting. The cache should not be using the GenericTransactionManagerLookup class (which is the default), since you set it to your getInfinispanTransactionmanager field. Check that this is being autowired correctly and is not null.

                    • 7. Re: ModeShape not commiting using Atomikos and Spring
                      singhl1

                      I have made sure the transaction manage is the correct one by changing my code to:

                                     ConfigurationBuilder builder = new ConfigurationBuilder();

                                      Configuration cacheConfig =

                                              builder

                                              .transaction()

                                              .transactionManagerLookup(new GetTransactionManager())

                                              .transactionMode(TransactionMode.TRANSACTIONAL)

                                              .autoCommit(false)

                                              .lockingMode(LockingMode.PESSIMISTIC)

                                              .loaders()

                                              .passivation(false)

                                              .shared(false)

                                              .preload(false)

                                              .addFileCacheStore().async().threadPoolSize(10).enabled(true)

                                              .fetchPersistentState(false)

                                              .purgeOnStartup(false)

                                              .addProperty("location", "/isis-repo/Library/content")

                                              .build();

                       

                       

                                      LocalEnvironment environment = new LocalEnvironment();

                                      environment.defineCache("isisRepository", cacheConfig); // Must match the cacheName property in your modeshape config

                       

                      And when I try to create a node in createRepository Method the following error occurs (the error is at end of log - but included more for information purposes)

                       

                       

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING core version: 3.8.0

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING com.atomikos.icatch.console_file_name = tm.out

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING com.atomikos.icatch.console_file_count = 1

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING com.atomikos.icatch.automatic_resource_registration = true

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING com.atomikos.icatch.client_demarcation = false

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING com.atomikos.icatch.threaded_2pc = true

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING com.atomikos.icatch.serial_jta_transactions = true

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING com.atomikos.icatch.log_base_dir = target/atomikos/log

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING com.atomikos.icatch.console_log_level = DEBUG

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING com.atomikos.icatch.max_actives = -1

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING com.atomikos.icatch.checkpoint_interval = 500

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING com.atomikos.icatch.enable_logging = true

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING com.atomikos.icatch.output_dir = target/atomikos/out

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING com.atomikos.icatch.log_base_name = tmlog

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING com.atomikos.icatch.console_file_limit = -1

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING com.atomikos.icatch.max_timeout = 300000

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING com.atomikos.icatch.tm_unique_name = 9aa8055f-d2ba-458f-8bfc-98c23c43f08d

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING java.naming.factory.initial = com.sun.jndi.rmi.registry.RegistryContextFactory

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING java.naming.provider.url = rmi://localhost:1099

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING com.atomikos.icatch.service = com.atomikos.icatch.standalone.UserTransactionServiceFactory

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING com.atomikos.icatch.force_shutdown_on_vm_exit = true

                      2013-06-19 15:13:17 com.atomikos.logging.Slf4jLogger [INFO] USING com.atomikos.icatch.default_jta_timeout = 100000

                      2013-06-19 15:15:04 org.modeshape.common.logging.slf4j.SLF4JLoggerImpl [DEBUG] Starting cache manager with global configuration

                      GlobalConfiguration{asyncListenerExecutor=ExecutorFactoryConfiguration{factory=org.infinispan.executors.DefaultExecutorFactory@7a4b35d5}, asyncTransportExecutor=ExecutorFactoryConfiguration{factory=org.infinispan.executors.DefaultExecutorFactory@5fbb71ac}, evictionScheduledExecutor=ScheduledExecutorFactoryConfiguration{factory=org.infinispan.executors.DefaultScheduledExecutorFactory@b24044e}, replicationQueueScheduledExecutor=ScheduledExecutorFactoryConfiguration{factory=org.infinispan.executors.DefaultScheduledExecutorFactory@6996a298}, globalJmxStatistics=GlobalJmxStatisticsConfiguration{allowDuplicateDomains=true, enabled=false, jmxDomain='org.infinispan', mBeanServerLookup=org.infinispan.jmx.PlatformMBeanServerLookup@208cdf50, cacheManagerName='DefaultCacheManager', properties={}}, transport=TransportConfiguration{clusterName='ISPN', machineId='null', rackId='null', siteId='null', strictPeerToPeer=false, distributedSyncTimeout=240000, transport=null, nodeName='null', properties={}}, serialization=SerializationConfiguration{advancedExternalizers={}, marshaller=org.infinispan.marshall.VersionAwareMarshaller@990de2, version=52, classResolver=null}, shutdown=ShutdownConfiguration{hookBehavior=DEFAULT}, modules={}, site=SiteConfiguration{localSite='null'}, cl=WebappClassLoader

                        context: /

                        delegate: false

                        repositories:

                          /WEB-INF/classes/

                      ----------> Parent Classloader:

                      org.apache.catalina.loader.StandardClassLoader@1264ab4d

                      }

                      and default configuration:

                      Configuration{classLoader=null, clustering=ClusteringConfiguration{async=AsyncConfiguration{asyncMarshalling=false, replicationQueue=null, replicationQueueInterval=5000, replicationQueueMaxElements=1000, useReplicationQueue=false}, cacheMode=LOCAL, hash=HashConfiguration{consistentHashFactory=null, hash=MurmurHash3, numOwners=2, numSegments=60, groupsConfiguration=GroupsConfiguration{enabled=false, groupers=[]}, stateTransferConfiguration=StateTransferConfiguration{chunkSize=10000, fetchInMemoryState=false, originalFetchInMemoryState=null, timeout=240000, awaitInitialTransfer=false, originalAwaitInitialTransfer=null}}, l1=L1Configuration{enabled=false, invalidationThreshold=0, lifespan=600000, onRehash=false, cleanupTaskFrequency=600000}, stateTransfer=StateTransferConfiguration{chunkSize=10000, fetchInMemoryState=false, originalFetchInMemoryState=null, timeout=240000, awaitInitialTransfer=false, originalAwaitInitialTransfer=null}, sync=SyncConfiguration{replTimeout=15000}}, customInterceptors=CustomInterceptorsConfiguration{interceptors=[]}, dataContainer=DataContainerConfiguration{dataContainer=null}, deadlockDetection=DeadlockDetectionConfiguration{enabled=false, spinDuration=100}, eviction=EvictionConfiguration{maxEntries=-1, strategy=NONE, threadPolicy=DEFAULT}, expiration=ExpirationConfiguration{lifespan=-1, maxIdle=-1, reaperEnabled=true, wakeUpInterval=60000}, indexing=IndexingConfiguration{enabled=false, indexLocalOnly=false}, invocationBatching=InvocationBatchingConfiguration{enabled=false}, jmxStatistics=JMXStatisticsConfiguration{enabled=false}, loaders=LoadersConfiguration{cacheLoaders=[], passivation=false, preload=false, shared=false}, locking=LockingConfiguration{concurrencyLevel=32, isolationLevel=READ_COMMITTED, lockAcquisitionTimeout=10000, useLockStriping=false, writeSkewCheck=false}, modules={}, storeAsBinary=StoreAsBinaryConfiguration{enabled=false, storeKeysAsBinary=true, storeValuesAsBinary=true}, transaction=TransactionConfiguration{autoCommit=true, cacheStopTimeout=30000, eagerLockingSingleNode=false, lockingMode=PESSIMISTIC, syncCommitPhase=true, syncRollbackPhase=false, transactionManagerLookup=org.infinispan.transaction.lookup.GenericTransactionManagerLookup@405e70bc, transactionSynchronizationRegistryLookup=null, transactionMode=TRANSACTIONAL, useEagerLocking=false, useSynchronization=true, recovery=RecoveryConfiguration{enabled=true, recoveryInfoCacheName='__recoveryInfoCacheName__'}, reaperWakeUpInterval=1000, completedTxTimeout=15000, use1PcForAutoCommitTransactions=false}, versioning=VersioningConfiguration{enabled=false, scheme=NONE}, unsafe=UnsafeConfiguration{unreliableReturnValues=false}, sites=SiteConfiguration{allBackups=[], backupFor=BackupForConfiguration{remoteCache='null', remoteSite='null'}, disableBackups=false, inUseBackupSites=[]}}

                      2013-06-19 15:15:04 org.infinispan.util.ModuleProperties [DEBUG] No module lifecycle SPI classes available

                      2013-06-19 15:15:04 org.infinispan.util.ModuleProperties [DEBUG] No module command extensions to load

                      2013-06-19 15:15:04 org.infinispan.manager.DefaultCacheManager [DEBUG] Started cache manager ISPN on null

                      2013-06-19 15:15:08 jcr.ModeShapeRepositoryFactoryBean [DEBUG] resolveConfigurationResource - end

                      2013-06-19 15:15:29 jcr.ModeShapeRepositoryFactoryBean [DEBUG] createRepository - start

                      2013-06-19 15:15:30 org.modeshape.common.logging.slf4j.SLF4JLoggerImpl [INFO] ModeShape version 3.3.0.Final

                      2013-06-19 15:15:30 org.modeshape.common.logging.slf4j.SLF4JLoggerImpl [DEBUG] Activating 'Repository' repository

                      2013-06-19 15:15:33 com.atomikos.logging.Slf4jLogger [DEBUG] getCompositeTransaction() returning NULL!

                      2013-06-19 15:15:33 com.atomikos.logging.Slf4jLogger [DEBUG] Coordinator tm0000100012 entering state: ACTIVE

                      2013-06-19 15:15:33 com.atomikos.logging.Slf4jLogger [DEBUG] TaskManager: initializing...

                      2013-06-19 15:15:33 com.atomikos.logging.Slf4jLogger [INFO] THREADS: using JDK thread pooling...

                      2013-06-19 15:15:33 com.atomikos.logging.Slf4jLogger [DEBUG] THREADS: using executor class com.atomikos.icatch.imp.thread.Java15ExecutorFactory$Executor

                      2013-06-19 15:15:33 com.atomikos.logging.Slf4jLogger [DEBUG] (1.5) executing task: com.atomikos.timing.PooledAlarmTimer@2d3b52e

                      2013-06-19 15:15:33 com.atomikos.logging.Slf4jLogger [DEBUG] ThreadFactory: creating new thread: Atomikos:0

                      2013-06-19 15:15:33 com.atomikos.logging.Slf4jLogger [DEBUG] Creating composite transaction: tm0000100012

                      2013-06-19 15:15:33 com.atomikos.logging.Slf4jLogger [INFO] createCompositeTransaction ( 300000 ): created new ROOT transaction with id tm0000100012

                      2013-06-19 15:15:35 org.modeshape.common.logging.slf4j.SLF4JLoggerImpl [DEBUG] Starting 'Repository' repository with configuration:

                      { "name" : "Repository" , "jndiName" : "" , "workspaces" : { "predefined" : [ "Library" ] , "default" : "Library" , "allowCreation" : true } , "security" : { "anonymous" : { "roles" : [ "readonly" , "readwrite" , "admin" ] , "useOnFailedLogin" : false } } , "storage" : { "cacheName" : "Repository" , "binaryStorage" : { "type" : "file" , "directory" : "/-repo/Library/binaries" } } , "query" : { "enabled" : true , "enableFullTextSearch" : true , "indexStorage" : { "type" : "filesystem" , "location" : "/-repo/Library/indexes" , "lockingStrategy" : "simple" , "fileSystemAccessType" : "auto" } , "indexing" : { "rebuildOnStartup" : { "includeSystemContent" : true , "mode" : "sync" } } , "textExtracting" : { "extractors" : { "tikaExtractor" : { "name" : "Tika content-based extractor" , "classname" : "tika" } } } } , "sequencing" : { "removeDerivedContentWithOriginal" : true , "sequencers" : { "Images in separate location" : { "classname" : "ImageSequencer" , "pathExpression" : "Library://(*.(gif|png|pict|jpg))/jcr:content[@jcr:data] => Library:/sequenced/images" } } } , "node-types" : [ "common_mixin.cnd" ] }

                      2013-06-19 15:15:36 org.modeshape.common.logging.slf4j.SLF4JLoggerImpl [DEBUG] Loading cache 'Repository' from cache container org.infinispan.manager.DefaultCacheManager@5085ec1b@Address:null

                      2013-06-19 15:15:36 org.infinispan.factories.GlobalComponentRegistry [INFO] ISPN000128: Infinispan version: Infinispan 'Delirium' 5.2.6.Final

                      2013-06-19 15:15:36 org.infinispan.marshall.jboss.JBossMarshaller [DEBUG] Using JBoss Marshalling

                      2013-06-19 15:15:36 org.infinispan.marshall.jboss.JBossMarshaller [DEBUG] Using JBoss Marshalling

                      2013-06-19 15:15:37 com.atomikos.logging.Slf4jLogger [DEBUG] getCompositeTransaction() returning NULL!

                      2013-06-19 15:15:37 com.atomikos.logging.Slf4jLogger [INFO] suspend() called without a transaction context

                      2013-06-19 15:15:37 org.infinispan.loaders.decorators.AsyncStore [DEBUG] Async cache loader starting org.infinispan.loaders.decorators.AsyncStore@168ca4dd

                      2013-06-19 15:15:37 org.infinispan.loaders.file.FileCacheStore [DEBUG] Using DEFAULT file sync mode

                      2013-06-19 15:15:37 org.infinispan.interceptors.InterceptorChain [DEBUG] Interceptor chain size: 9

                      2013-06-19 15:15:37 org.infinispan.interceptors.InterceptorChain [DEBUG] Interceptor chain is:

                                >> org.infinispan.interceptors.InvocationContextInterceptor

                                >> org.infinispan.interceptors.IsMarshallableInterceptor

                                >> org.infinispan.interceptors.TxInterceptor

                                >> org.infinispan.interceptors.NotificationInterceptor

                                >> org.infinispan.interceptors.locking.PessimisticLockingInterceptor

                                >> org.infinispan.interceptors.EntryWrappingInterceptor

                                >> org.infinispan.interceptors.CacheLoaderInterceptor

                                >> org.infinispan.interceptors.CacheStoreInterceptor

                                >> org.infinispan.interceptors.CallInterceptor

                      2013-06-19 15:15:37 org.infinispan.jmx.JmxUtil [DEBUG] Object name org.infinispan:type=Cache,name="Repository(local)",manager="DefaultCacheManager",component=Cache already registered

                      2013-06-19 15:15:37 org.infinispan.jmx.CacheJmxRegistration [INFO] ISPN000031: MBeans were successfully registered to the platform MBean server.

                      2013-06-19 15:15:37 org.infinispan.CacheImpl [DEBUG] Started cache Repository on null

                      2013-06-19 15:15:37 com.atomikos.logging.Slf4jLogger [DEBUG] getCompositeTransaction() returning NULL!

                      2013-06-19 15:15:37 com.atomikos.logging.Slf4jLogger [DEBUG] getCompositeTransaction() returning NULL!

                      2013-06-19 15:15:37 org.infinispan.schematic.internal.CacheContext [DEBUG] Deltas will be used to serializing changes to documents in 'Repository'.

                      2013-06-19 15:15:37 org.infinispan.schematic.internal.CacheContext [DEBUG] Passivation? false

                      2013-06-19 15:15:37 org.infinispan.schematic.internal.CacheContext [DEBUG] Eviction? NONE

                      2013-06-19 15:15:37 org.infinispan.schematic.internal.CacheContext [DEBUG] Clustering mode? LOCAL

                      2013-06-19 15:15:37 org.infinispan.schematic.internal.CacheContext [DEBUG] Using cache with flags [SKIP_REMOTE_LOOKUP, DELTA_WRITE] during SchematicEntry updates

                      2013-06-19 15:15:37 org.infinispan.schematic.internal.CacheContext [DEBUG] Explicit locks will be used when modifying documents in 'Repository' (Infinispan's locking mode is PESSIMISTIC).

                      2013-06-19 15:15:37 com.atomikos.logging.Slf4jLogger [DEBUG] getCompositeTransaction() returning NULL!

                      2013-06-19 15:15:37 com.atomikos.logging.Slf4jLogger [INFO] suspend() called without a transaction context

                      2013-06-19 15:15:37 org.modeshape.common.logging.slf4j.SLF4JLoggerImpl [DEBUG] org.modeshape.extractor.tika is not a valid url

                      2013-06-19 15:15:38 org.modeshape.common.logging.slf4j.SLF4JLoggerImpl [DEBUG] Initializing the Tika MIME type detectors

                      2013-06-19 15:15:38 org.modeshape.common.logging.slf4j.SLF4JLoggerImpl [DEBUG]  - Found detector: org.gagravarr.tika.OggDetector

                      2013-06-19 15:15:38 org.modeshape.common.logging.slf4j.SLF4JLoggerImpl [DEBUG]  - Found detector: org.apache.tika.parser.microsoft.POIFSContainerDetector

                      2013-06-19 15:15:38 org.modeshape.common.logging.slf4j.SLF4JLoggerImpl [DEBUG]  - Found detector: org.apache.tika.parser.pkg.ZipContainerDetector

                      2013-06-19 15:15:39 org.modeshape.common.logging.slf4j.SLF4JLoggerImpl [DEBUG]  - Found detector: org.apache.tika.mime.MimeTypes

                      2013-06-19 15:15:39 org.modeshape.common.logging.slf4j.SLF4JLoggerImpl [DEBUG] Starting cache manager using configuration at 'org/modeshape/jcr/default-workspace-cache-config.xml'

                      2013-06-19 15:15:39 org.infinispan.util.ModuleProperties [DEBUG] No module lifecycle SPI classes available

                      2013-06-19 15:15:39 org.infinispan.util.ModuleProperties [DEBUG] No module command extensions to load

                      2013-06-19 15:15:39 org.infinispan.manager.DefaultCacheManager [DEBUG] Started cache manager ISPN on null

                      2013-06-19 15:15:39 com.atomikos.logging.Slf4jLogger [DEBUG] getCompositeTransaction() returning NULL!

                      2013-06-19 15:15:39 com.atomikos.logging.Slf4jLogger [DEBUG] getCompositeTransaction() returning NULL!

                      2013-06-19 15:15:40 com.atomikos.logging.Slf4jLogger [DEBUG] getCompositeTransaction() returning NULL!

                      2013-06-19 15:17:37 jcr.ModeShapeRepositoryFactoryBean [ERROR] javax.jcr.RepositoryException: Error while starting 'Repository' repository: Cannot create a transactional context without a valid Transaction instance.

                       

                      So it looks like my transactinmanagerlookup is not being recognised.

                      • 8. Re: ModeShape not commiting using Atomikos and Spring
                        rhauch

                        Please set 'autoCommit' to true. See my previous (updated) comment.

                        • 9. Re: ModeShape not commiting using Atomikos and Spring
                          rhauch

                          I can run the following code in a local test case. It does the following:

                           

                          1. starts up one engine
                          2. sets up a RepositoryConfiguration with a new LocalEnvironment that contains the defined cache
                          3. deploys the repository
                          4. uses the repository to create some content
                          5. shuts down the engine (and repository)
                          6. starts up a new engine
                          7. sets up a RepositoryConfiguration with a new LocalEnvironment that contains the defined cache
                          8. deploys the repository
                          9. verifies the previously persisted content is available
                          10. shuts down the engine (and repository)

                           

                          Note that step 7 is required because the Infinispan cache containers don't completely clean themselves up within a single process, and starting a second cache container and cache with the same configuration tends to leak. This really isn't a problem in production, but it is in a single test case. See this Infinispan documentation about always creating test cache managers in unit tests.

                           

                          The code does a couple of things I'd recommend you have your code do:

                           

                          • When defining the cache on the LocalEnvironment, you have to supply the same cache name as what is in your repository's configuration file. If you have already read in your repository configuration, you can get the repository's cache name from the RepositoryConfiguration instance.
                          • Deploying a repository will validate the RepositoryConfiguration instance before anything else, and if there are any problems will thrown an exception.

                           

                          Here's the code:

                           

                              String pathToStorage = "target/repo/Library/content";
                              FileUtil.delete(pathToStorage);
                          
                          
                              // Create the repository configuration ...
                              String configFilePath = "config/repo-config-inmemory-local-environment.json";
                              InputStream configFileStream = getClass().getClassLoader().getResourceAsStream(configFilePath);
                              RepositoryConfiguration repositoryConfiguration = RepositoryConfiguration.read(configFileStream, "doesn't matter");
                          
                          
                              // Create the Infinispan configuration via a Local Environment ...
                              ConfigurationBuilder builder = new ConfigurationBuilder();
                              Configuration cacheConfig = builder.transaction()
                                                                 .transactionManagerLookup(new AtomikosStandaloneJTAManagerLookup())
                                                                 .transactionMode(TransactionMode.TRANSACTIONAL)
                                                                 .autoCommit(true)
                                                                 .lockingMode(LockingMode.PESSIMISTIC)
                                                                 .loaders()
                                                                 .passivation(false)
                                                                 .shared(false)
                                                                 .preload(false)
                                                                 .addFileCacheStore()
                                                                 .async()
                                                                 .threadPoolSize(10)
                                                                 .enabled(true)
                                                                 .fetchPersistentState(false)
                                                                 .purgeOnStartup(false)
                                                                 .addProperty("location", pathToStorage)
                                                                 .build();
                          
                          
                              LocalEnvironment environment = new LocalEnvironment();
                              Configuration newConfig = environment.defineCache(repositoryConfiguration.getCacheName(), cacheConfig);
                              System.out.println(newConfig);
                              repositoryConfiguration = repositoryConfiguration.with(environment);
                          
                          
                              // Start the engine and repository ...
                              ModeShapeEngine engine = new ModeShapeEngine();
                              engine.start();
                          
                          
                              try {
                                  JcrRepository repository = engine.deploy(repositoryConfiguration);
                                  Session session = repository.login();
                                  Node root = session.getRootNode();
                                  root.addNode("Library", "nt:folder");
                                  session.save();
                                  session.logout();
                          
                          
                                  session = repository.login();
                                  Node library = session.getNode("/Library");
                                  assertThat(library, is(notNullValue()));
                                  assertThat(library.getPrimaryNodeType().getName(), is("nt:folder"));
                                  session.logout();
                              } finally {
                                  engine.shutdown().get();
                                  environment.shutdown(); // make sure all of the cache containers are shut down
                              }
                          
                          
                              // Redefine the LocalEnvironment, since we want to replicate the case where a new process is started,
                              // and the previously used CacheContainer tends to stick around and not get cleaned up entirely within
                              // the same process...
                              environment = new LocalEnvironment();
                              newConfig = environment.defineCache(repositoryConfiguration.getCacheName(), cacheConfig);
                              System.out.println(newConfig);
                              repositoryConfiguration = repositoryConfiguration.with(environment);
                          
                          
                              // Start the engine and repository again to verify the content is being persisted ...
                              engine = new ModeShapeEngine();
                              engine.start();
                              try {
                                  Repository repository = engine.deploy(repositoryConfiguration);
                                  Session session = repository.login();
                                  Node library = session.getNode("/Library");
                                  assertThat(library, is(notNullValue()));
                                  assertThat(library.getPrimaryNodeType().getName(), is("nt:folder"));
                                  session.logout();
                              } finally {
                                  engine.shutdown().get();
                                  environment.shutdown(); // make sure all of the cache containers are shut down
                              }
                          

                           

                          My repository configuration is very simple (since I'm just trying to make sure it works):

                           

                          {
                              "name" : "Repository",
                              "storage" : {
                                  "cacheName" : "inmemoryRepository",
                              },
                              "workspaces" : {
                                  "default" : "default",
                                  "allowCreation" : true
                              },
                              "security" : {
                                  "anonymous" : {
                                      "roles" : ["readonly","readwrite","admin"],
                                      "useOnFailedLogin" : false
                                  }
                              },
                          }
                          
                          • 10. Re: ModeShape not commiting using Atomikos and Spring
                            singhl1

                            Hi Randall - thanks for that, i am a little confused, i understand:

                             

                            The code does a couple of things I'd recommend you have your code do:

                             

                            • When defining the cache on the LocalEnvironment, you have to supply the same cache name as what is in your repository's configuration file. If you have already read in your repository configuration, you can get the repository's cache name from the RepositoryConfiguration instance.
                            • Deploying a repository will validate the RepositoryConfiguration instance before anything else, and if there are any problems will thrown an exception.

                             

                            With regards to point 7 - is there anything else i should be doing?

                            • 11. Re: ModeShape not commiting using Atomikos and Spring
                              rhauch

                              With regards to point 7 - is there anything else i should be doing?

                               

                              I'm not sure I understand. First of all, my code is a test case, and of the 10 steps I mentioned earlier, my test case is doing steps 6-10 only to verify that the information is being persisted by the first 5 steps. Your application only has to do steps 1-5.

                               

                              • When defining the cache on the LocalEnvironment, you have to supply the same cache name as what is in your repository's configuration file. If you have already read in your repository configuration, you can get the repository's cache name from the RepositoryConfiguration instance.

                               

                              This suggestion of mine basically is that this line in your code:

                               

                              environment.defineCache("Repository", cacheConfig); // Must match the cacheName property in your modeshape config
                              

                               

                              should instead be something like this:

                               

                              environment.defineCache(repositoryConfiguration.getCacheName(), cacheConfig);
                              

                               

                              because that actually does ensure that the first parameter always exactly matches the cacheName field in the ModeShape configuration

                               

                               

                              • Deploying a repository will validate the RepositoryConfiguration instance before anything else, and if there are any problems will thrown an exception.

                              Perhaps these lines in your code are for debugging purposes, but my point was that these lines are (strictly speaking) unnecessary since the "engine.deployRepository(...)" method essentially does the same thing internally and will throw an exception if there are any errors:

                               

                                              // Verify the configuration for the repository ...
                                              Problems problems = repositoryConfiguration.validate();
                                              if (problems.hasErrors()) {
                                                  log.error("Problems starting the engine.");
                                                  log.error(problems);
                                              }
                              
                              • 12. Re: ModeShape not commiting using Atomikos and Spring
                                singhl1

                                Could you please confirm something for me please:

                                 

                                I my web application, should i be:

                                1. starts up one engine
                                2. sets up a RepositoryConfiguration with a new LocalEnvironment that contains the defined cache
                                3. deploys the repository
                                4. uses the repository to create some content
                                5. shuts down the engine (and repository)

                                 

                                If the web app creates the repository on startup  - as above, and a user requires to use the repository - i need to

                                1. starts up a new engine
                                2. sets up a RepositoryConfiguration with a new LocalEnvironment that contains the defined cache
                                3. deploys the repository
                                4. do whatever in the repository - add or remove nodes for example
                                5. shuts down the engine (and repository)

                                And if the user need to use the repository again (the web app is still running) i need to repeat the steps in bold italics above.

                                 

                                What my app was doing was starting and deploying the repository at startup, and using the reposiory to get sessions, modify repository, and then when web app shuts down, it would shut the engine and repository.

                                • 13. Re: ModeShape not commiting using Atomikos and Spring
                                  rhauch

                                  What my app was doing was starting and deploying the repository at startup, and using the reposiory to get sessions, modify repository, and then when web app shuts down, it would shut the engine and repository.

                                  This is exactly what your application should do. Keep it simple.

                                  • 14. Re: ModeShape not commiting using Atomikos and Spring
                                    singhl1

                                    That is what i am doing, but it still does not work, on webapp start the library folder is created, then when i go to other pages in the web app, and add a folder, the folder is there whilst i am in that particular page, and with the webapp still running, if i go to another page, then navigate back to the page where i should see the new folder, the new folder has disappeared.

                                     

                                    It is as though the new folder is not commited to the repository.

                                     

                                    Is theree any further debuging i can set to see if the folder is commited to the repository?

                                    1 of 1 people found this helpful
                                    1 2 Previous Next