1 2 Previous Next 21 Replies Latest reply on Jun 21, 2013 11:12 AM by rhauch Go to original post
      • 15. Re: ModeShape not commiting using Atomikos and Spring
        rhauch

        Turn on DEBUG or TRACE logging for "org.modeshape.jcr.cache" and/or "org.modeshape.jcr.txn" to see messages related to persistence and transactions (respectively).

         

        Also, even when you said that you changed how you were passing in the "GetInfinispanTransactionmanager" instance, the output you provided showed the following:

         

             ...transactionManagerLookup=org.infinispan.transaction.lookup.GenericTransactionManagerLookup@405e70bc...

         

        and you even said that it's not finding the Atomikos transaction manager instance. So, something is probably wrong with your Atomikos configuration, or Spring is not properly wiring your objects together. (Seven years ago I found it very difficult to get Spring to do what I wanted, and it's interesting to see it's not gotten easier.)

         

        And since something is wrong there, you probably need to verify that your application is not creating a new ModeShapeEngine for each request.

         

        BTW, are you using user transactions in your web application?

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

          Yes I am using transactions, but we have two transaction managers, atomikos and the other, and I refer to them individualy in the service layer. I will try your suggestion on debugging, what should i be looking ofr in the logs to show that the node is being saved (e.g when adding nt:folder).

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

            Yes I am using transactions, but we have two transaction managers, atomikos and the other, and I refer to them individualy in the service layer.

            Hmm... this seems really strange. Why would you run two separate transaction managers?

             

             

            I will try your suggestion on debugging, what should i be looking ofr in the logs to show that the node is being saved (e.g when adding nt:folder).

            The log messages will describe which nodes are being persisted upon "Session.save()" and when transactions are committed. For example, I used these Log4J settings:

             

            log4j.logger.org.modeshape.jcr.cache=DEBUG
            log4j.logger.org.modeshape.jcr.cache.document=TRACE
            log4j.logger.org.modeshape.jcr.txn=TRACE
            

             

            and saw messages like this in my aforementioned test case:

             

            09:02:58,421 TRACE Begin transaction
            09:02:58,422 DEBUG Locking nodes in Infinispan
            09:02:58,422 DEBUG Locking nodes in Infinispan
            09:02:58,422 TRACE Node 'dd0135d7505d64/' is not found in the 'default' workspace cache; looking in store
            09:02:58,422 TRACE Materialized document 'dd0135d7505d64/' in 'default' workspace from store: { "properties" : { "http://www.jcp.org/jcr/1.0" : { "primaryType" : { "$name" : "mode:root" } , "uuid" : "dd0135d7505d64/" } } , "children" : [ { "key" : "dd0135d317f1e7jcr:system" , "name" : "jcr:system" } ] , "childrenInfo" : { "count" : 1 } }
            09:02:58,424 TRACE Node 'dd0135d7505d64669eee4a-d1a6-49a2-8973-e89ec1a61450' is not found in the 'default' workspace cache; looking in store
            09:02:58,424 TRACE Node 'dd0135d7505d64669eee4a-d1a6-49a2-8973-e89ec1a61450' is not found in the 'default' workspace cache; looking in store
            09:02:58,424 TRACE Materialized document 'dd0135d7505d64669eee4a-d1a6-49a2-8973-e89ec1a61450' in 'default' workspace from store: { "key" : "dd0135d7505d64669eee4a-d1a6-49a2-8973-e89ec1a61450" , "parent" : "dd0135d7505d64/" , "properties" : { "http://www.jcp.org/jcr/1.0" : { "primaryType" : { "$name" : "nt:folder" } , "created" : { "$date" : "2013-06-20T09:02:58.419-05:00" } , "createdBy" : "<anonymous>" } } }
            09:02:58,425 DEBUG Altered 2 node(s)
            09:02:58,438 TRACE Committed transaction
            09:02:58,438 TRACE Cache for workspace 'default' received 4 changes from local sessions: Save by '<anonymous>' at 2013-06-20T09:02:58.423-05:00 with user data = {} in repository with key '3123868' and workspace 'default'
              Added node 'dd0135d7505d64669eee4a-d1a6-49a2-8973-e89ec1a61450' at "/{}Library" under 'dd0135d7505d64/'
              Added property {http://www.jcp.org/jcr/1.0}primaryType to node 'dd0135d7505d64669eee4a-d1a6-49a2-8973-e89ec1a61450' at path /{}Library with values:{http://www.jcp.org/jcr/1.0}primaryType = {http://www.jcp.org/jcr/nt/1.0}folder
              Added property {http://www.jcp.org/jcr/1.0}created to node 'dd0135d7505d64669eee4a-d1a6-49a2-8973-e89ec1a61450' at path /{}Library with values:{http://www.jcp.org/jcr/1.0}created = 2013-06-20T09:02:58.419-05:00
              Added property {http://www.jcp.org/jcr/1.0}createdBy to node 'dd0135d7505d64669eee4a-d1a6-49a2-8973-e89ec1a61450' at path /{}Library with values:{http://www.jcp.org/jcr/1.0}createdBy = <anonymous>
            changed 2 nodes:
              dd0135d7505d64669eee4a-d1a6-49a2-8973-e89ec1a61450
              dd0135d7505d64/
            
            • 18. Re: ModeShape not commiting using Atomikos and Spring
              rhauch

              Horia brilliantly created an example that uses ModeShape with Spring and Atomikos inside Tomcat.

               

                   https://github.com/ModeShape/modeshape-examples/tree/master/modeshape-spring-example

               

              It doesn't programmatically configure Infinispan, but you should be able to start with this running example and change it, making sure that along the way the application still runs correctly.

               

              I might suggest forking the https://github.com/ModeShape/modeshape-examples GitHub repository, then cloning locally (as we document on that repository page). By doing it this way, should you run into a problem you can always commit locally and push to your fork, where we could grab them and run the code.

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

                That's very helpful, but i think i have made some headway, in one of my spring classes, i was creating some folders and uploading some binary content to them, and witih in there i was

                 

                 

                getSession

                 

                create folders and upload files

                 

                session.save

                 

                But i forgot to do a session.logout(), and this might have been the source of my problems, I am just trying to verify that at the moment.

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

                  Yes, i think it was a combination of the transactionmanager lookup problem (thanjks for your solution for that) and my missing session.logOut().

                   

                  It it all works now.

                   

                  I will look at the modeshape-spring-example as suggested.

                   

                  Many thanks for you input Randall and Horia.

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

                    But i forgot to do a session.logout(), and this might have been the source of my problems, I am just trying to verify that at the moment.

                    That could very well be. It is okay in some circumstances to not log out of a session and continue using it, but you have to be careful about changes saved by other sessions, which you're session may or may not see.

                     

                    But, you definitely don't want to be using a session to service multiple web requests. See why.

                    1 2 Previous Next