10 Replies Latest reply on Jun 25, 2012 12:56 PM by Randall Hauch

    3.0 Alpha5, AS 7 kit, BDBJE, SLSB, BMT - nodes not seen until after restart

    Jonathan Fields Novice

      I may be jumping the gun since 3.0 is still just  Alpha, but I've been anxious to get started with 3.0, AS 7 and BDBJE so I've been starting with some tests.  Here is one that did not work. Configuration:

       

      • AS 7.1 and 3.0 Alpha 5 kit, using modified standalone-modeshape.xml (configured for BDBJE cache store instead of file store, with purge set to false)
      • modeshape-schematic jar installed directly in AS 7 infinispan module to avoid classloading issues (see JIRA), and added as a resource in module.xml
      • BDBJE cache loader jars installed directly in AS 7 infinispan module to avoid classloading issues (see JIRA), and added as a resource in module.xml
      • SLSB with BMT, creating a hierarchy of 1000 nodes, depth of 3, in batches of 100, each batch in a separate  transaction. (I've started with 1000, but ultimately want to see 1M working).

       

      The node hierarchy being created is:

       

        • node1
          • child1
            • grandchild1
            • ...
            • grandchild10
          • ...
          • child10
        • node2
        • ...
        • node10

       

      Each top level branch is created in a separate BMT transaction calling: UserTransaction.begin(), create the nodes, Session.save(), and finally UserTransaction.commit(). (Typical approach when  there is too much work to do in a single CMT transaction.)

       

      Problem: After running the test, and with AS7 still running, only the node1 branch (and all descendents) can be seen (e.g. by browsing using the REST client).

       

      However, to my surprise, after restarting AS7, the rest of the branches (node2, ..., node10) can then be seen.  Some kind of caching/flushing problem? I don't think I'm doing anything wrong. I've done this same kind of thing with JPA many times......

       

      I've attached the Eclipse project for the EJB, the ejb-jar, and the config files.

       

      I'm going to try the same thing w/o transactions, and then in a single CMT transaction, to see if that makes any difference.....

       

      If you'd like me to file a JIRA, please let me know.

       

      Thanks,

      Jon

        • 1. Re: 3.0 Alpha5, AS 7 kit, BDBJE, SLSB, BMT - nodes not seen until after restart
          Jonathan Fields Novice

          Changed the EJB to CMT and when all the nodes are created in a single CMT transaction, the results are as expected: all nodes are visible after the transaction commits.

           

          Also, tried changing the EJB to @TransactionAttribute(NEVER) and that works as well.

           

          So it seems to be related to BMT and having multiple transaction begin/commit. The first transaction's work is seen, but the remaining 9 transaction's work is not seen.... until the server is restarted.

           

          Not a big deal since kind of an edge case, but for batch loading and other batch operations, I would expect to be using this approach....

          • 2. Re: 3.0 Alpha5, AS 7 kit, BDBJE, SLSB, BMT - nodes not seen until after restart
            Jonathan Fields Novice

            Also, injecting the Repository using @Resource is not working for me. I tried this:

             

                @Resource(lookup="jcr/sample")

                private Repository repository;

             

            and the EJB does not deploy (see log message below). Is  something required in the META-INF/ejb-jar.xml?

             

            =======

             

            14:31:36,682 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-14) JNDI bindings for session bean named CreateNodesTest in deployment unit deployment "modeshape-ejb-test.jar" are as follows:

             

                java:global/modeshape-ejb-test/CreateNodesTest!org.modeshape.ejbtest.CreateNodesTest

                java:app/modeshape-ejb-test/CreateNodesTest!org.modeshape.ejbtest.CreateNodesTest

                java:module/CreateNodesTest!org.modeshape.ejbtest.CreateNodesTest

                java:global/modeshape-ejb-test/CreateNodesTest

                java:app/modeshape-ejb-test/CreateNodesTest

                java:module/CreateNodesTest

             

            ....

             

            4:31:36,931 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS015870: Deploy of deployment "modeshape-ejb-test.jar" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.comp.modeshape-ejb-test.modeshape-ejb-test.CreateNodesTest.env.\"org.modeshape.ejbtest.CreateNodesTest\".repositoryjboss.naming.context.java.comp.modeshape-ejb-test.modeshape-ejb-test.CreateNodesTest.env.jcr.sampleMissing[jboss.naming.context.java.comp.modeshape-ejb-test.modeshape-ejb-test.CreateNodesTest.env.\"org.modeshape.ejbtest.CreateNodesTest\".repositoryjboss.naming.context.java.comp.modeshape-ejb-test.modeshape-ejb-test.CreateNodesTest.env.jcr.sample]"]}

            14:31:36,950 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015877: Stopped deployment modeshape-ejb-test.jar in 18ms

            14:31:36,953 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 1) JBAS014774: Service status report

            JBAS014776:    Newly corrected services:

                  service jboss.naming.context.java.comp.modeshape-ejb-test.modeshape-ejb-test.CreateNodesTest.env.jcr.sample (new available)

             

            14:31:36,955 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.comp.modeshape-ejb-test.modeshape-ejb-test.CreateNodesTest.env.\"org.modeshape.ejbtest.CreateNodesTest\".repositoryjboss.naming.context.java.comp.modeshape-ejb-test.modeshape-ejb-test.CreateNodesTest.env.jcr.sampleMissing[jboss.naming.context.java.comp.modeshape-ejb-test.modeshape-ejb-test.CreateNodesTest.env.\"org.modeshape.ejbtest.CreateNodesTest\".repositoryjboss.naming.context.java.comp.modeshape-ejb-test.modeshape-ejb-test.CreateNodesTest.env.jcr.sample]"]}}}

            • 3. Re: 3.0 Alpha5, AS 7 kit, BDBJE, SLSB, BMT - nodes not seen until after restart
              Horia Chiorean Master

              Hi Jonathan,

               

              I managed to get a repository injected via JNDI using @Resource( mappedName = "/jcr/artifacts" ) in one of our Arquillian integration tests (not from an EJB though)

              • 4. Re: 3.0 Alpha5, AS 7 kit, BDBJE, SLSB, BMT - nodes not seen until after restart
                Randall Hauch Master

                Thanks for providing such good information and code, Jonathan.

                 

                I think I may know what's going on with the BMT and the nodes not appearing until the next restart. Basically, the first time Session.save() finds an existing transaction, it registers itself as a Synchronization with the transaction, and holds onto the transaction state. Unfortunately, we're never releasing that transaction state.

                 

                I logged this as MODE-1537 and hope to have the fix in the next release.

                • 5. Re: 3.0 Alpha5, AS 7 kit, BDBJE, SLSB, BMT - nodes not seen until after restart
                  Jonathan Fields Novice

                  Sounds good.

                   

                  I have a small 2.x/AS6/Infinispan/BDBJE prototype application that I hope to eventually be able to use to replace an existing application that uses a home grown JPA and Lucene layer for persistence and query. It is evaluating several of the use cases that my existing app typically encounters, like a large batch load of existing data.

                   

                  The lack of transaction support in 2.x prevented me from going to production, that because I need to be able to transactionally update multiple resources including JCR.

                   

                  As the 3.0 Alphas come out, I am gradually trying to migrate the 2.x app to 3.0/AS7/Infinispan/BDBJE. As I run into issues, I'll report them here (and of course successes too :-)

                   

                  Thanks,

                  Jon

                  • 6. Re: 3.0 Alpha5, AS 7 kit, BDBJE, SLSB, BMT - nodes not seen until after restart
                    Randall Hauch Master

                    That sounds really great, Jonathan. Please keep us posted on your progress.

                     

                    FYI, we're planning on issuing Alpha6 tomorrow. We've been fixing a lot of issues with Alpha5, and enough people are using it that we want to provide a way for everyone to keep going while we finish up the few remaining features for Beta1.

                    • 7. Re: 3.0 Alpha5, AS 7 kit, BDBJE, SLSB, BMT - nodes not seen until after restart
                      Jonathan Fields Novice

                      I am guessing this is an AS7 config issue. Probably @Resource is looking in the ENC and I have not mapped jcr/sample into the ENC, or something like that...... I may need to used another form of @Resource to reference jcr/sample....

                      • 8. Re: 3.0 Alpha5, AS 7 kit, BDBJE, SLSB, BMT - nodes not seen until after restart
                        Randall Hauch Master

                        I am guessing this is an AS7 config issue. Probably @Resource is looking in the ENC and I have not mapped jcr/sample into the ENC, or something like that...... I may need to used another form of @Resource to reference jcr/sample....

                         

                        We're registering the repository in the global JNDI namespace. Should we also be registering it in another namespace? Or is there something else we should be configuring in our kit?

                        • 9. Re: 3.0 Alpha5, AS 7 kit, BDBJE, SLSB, BMT - nodes not seen until after restart
                          Jonathan Fields Novice

                          You are doing the right thing IMO, and Horia's response was the correct one - I just read it too quickly the first time to see that "lookup" was changed to "mappedName". I'll verify that works, but expect it will as that's what I've used in the past (pre AS7) to inject resources from global JNDI into an EJB......

                           

                          The 3.0 docs in Confluence do reference @Resource(lookup="...") however, which is what first lead me to try that. I'm guessing that "lookup" searches the ENC, whereas "mappedName" searches global JNDI, or something like that. I think if you are referencing the ENC, then your EJB must configure that in your ejb-jar.xml.

                           

                          I think it is an AS7/EJB configuration issue, not a Modeshape issue, except perhaps to provide a clarification in the docs regarding the use of @Resource.....

                          • 10. Re: 3.0 Alpha5, AS 7 kit, BDBJE, SLSB, BMT - nodes not seen until after restart
                            Randall Hauch Master

                            The 3.0 docs in Confluence do reference @Resource(lookup="...") however, which is what first lead me to try that. I'm guessing that "lookup" searches the ENC, whereas "mappedName" searches global JNDI, or something like that. I think if you are referencing the ENC, then your EJB must configure that in your ejb-jar.xml.

                             

                            I think it is an AS7/EJB configuration issue, not a Modeshape issue, except perhaps to provide a clarification in the docs regarding the use of @Resource.....

                            The documentation has been fixed.