1 2 Previous Next 25 Replies Latest reply on Aug 28, 2012 7:06 PM by Brian Wallis

    JDBC configuration in AS7.1.1

    Brian Wallis Master

      I have the following configuration in standalone.xml for the cache and repository, I couldn't find any good examples or documentation so I made this up from various bits of info from the web and by reading the xsd schema files for infinispan and modeshape.

       

      It is probably missing something as it doesn't quite work for me. The intent is to have the modeshape cache with a write through jdbc based cache loader so all data is stored into the database when written to the repository.

       

      {code}

              <subsystem xmlns="urn:jboss:domain:infinispan:1.2" default-cache-container="hibernate">

                  <cache-container name="modeshape" default-cache="sample">

                      <local-cache name="testRepository">

                          <transaction mode="NON_XA"/>

                          <expiration max-idle="100000" lifespan="-1" interval="5000"/>

                          <string-keyed-jdbc-store datasource="java:jboss/datasources/JcrDataDS" preload="false" passivation="false" purge="false">

                              <property name="databaseType">

                                  postgres

                              </property>

                              <property name="createTableOnStart">

                                  true

                              </property>

                              <string-keyed-table prefix="stringbased">

                                  <id-column name="id" type="VARCHAR2(200)"/>

                                  <data-column name="datum" type="BLOB"/>

                                  <timestamp-column name="version" type="NUMBER"/>

                              </string-keyed-table>

                          </string-keyed-jdbc-store>

                      </local-cache>

                  </cache-container>

              </subsystem>

              <subsystem xmlns="urn:jboss:domain:modeshape:1.0">

                  <repository name="testRepository" cache-name="testRepository" cache-container="modeshape"/>

              </subsystem>

      {code}

       

      On calling login on the session I get the following error.

       

      {code}

      17:07:51,996 ERROR [au.com.infomedix.jcrloadtest.jcrserver.repo.JcrService] (http-localhost-127.0.0.1-8080-1) Failed to start JCR change observer bean: javax.jcr.RepositoryException: Error while starting 'testRepository' repository: null

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

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

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

                at au.com.infomedix.jcrloadtest.jcrserver.repo.JcrService.login(JcrService.java:111) [classes:]

                at au.com.infomedix.jcrloadtest.jcrserver.repo.JcrService.registerSchema(JcrService.java:122) [classes:]

                at au.com.infomedix.jcrloadtest.jcrserver.repo.JcrService.getInstance(JcrService.java:43) [classes:]

                at au.com.infomedix.jcrloadtest.jcrserver.restapi.NodeCrudMethods.queryNodes(NodeCrudMethods.java:158) [classes:]

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [classes.jar:1.6.0_33]

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [classes.jar:1.6.0_33]

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [classes.jar:1.6.0_33]

                at java.lang.reflect.Method.invoke(Method.java:597) [classes.jar:1.6.0_33]

                at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:155) [resteasy-jaxrs-2.3.2.Final.jar:]

                at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257) [resteasy-jaxrs-2.3.2.Final.jar:]

                at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222) [resteasy-jaxrs-2.3.2.Final.jar:]

                at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211) [resteasy-jaxrs-2.3.2.Final.jar:]

                at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525) [resteasy-jaxrs-2.3.2.Final.jar:]

                at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502) [resteasy-jaxrs-2.3.2.Final.jar:]

                at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [resteasy-jaxrs-2.3.2.Final.jar:]

                at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.2.Final.jar:]

                at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.2.Final.jar:]

                at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.2.Final.jar:]

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]

                at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]

                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]

                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]

                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]

                at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_33]

      Caused by: java.lang.NullPointerException

                at org.modeshape.jcr.txn.SynchronizedTransactions.begin(SynchronizedTransactions.java:60)

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

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

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

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

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

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

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

                ... 34 more

      {code}

      any ideas on what I might have missed in the configuration?

       

      thanks

        • 1. Re: JDBC configuration in AS7.1.1
          Randall Hauch Master

          ModeShape expects to use transactions with the cache, and that NPE is due to the fact that we can't find Infinispan's transaction manager, which we get from the Cache instance via '

          getAdvancedCache().getTransactionManager()'. (We should be checking for that upon repository startup.) But everything in your ISPN configuration seems correct.

           

          Unfortunately, I found a similar problem outside of AS7 where Infinispan couldn't find the transaction manager in 5.1.2 but can in 5.1.4. If that is the case, then we could try to add code in JcrRepository to find the transaction manager, but I'm not sure that using transactions with Infinispan would work (as they wouldn't have it).

           

          Is there any way you can debug this to verify that the transaction manager is null?

          • 2. Re: JDBC configuration in AS7.1.1
            Brian Wallis Master

            Yep, set a breakpoint in the SynchronizedTransactions constructor and the transaction manager parameter is null, here is the stack trace at that point.

             

             

            {code}

            Daemon Thread [http-localhost-127.0.0.1-8080-1] (Suspended (breakpoint at line 53 in SynchronizedTransactions))

                    SynchronizedTransactions.<init>(SessionEnvironment$MonitorFactory, TransactionManager) line: 53

                    JcrRepository$RunningState.createTransactions(RepositoryConfiguration$TransactionMode, SessionEnvironment$MonitorFactory, TransactionManager) line: 1177

                    JcrRepository$RunningState.<init>(JcrRepository, JcrRepository$RunningState, JcrRepository$ConfigurationChange) line: 1006     

                    JcrRepository$RunningState.<init>(JcrRepository) line: 921     

                    JcrRepository.doStart() line: 346      

                    JcrRepository.login(Credentials, String) line: 577     

                    JcrRepository.login() line: 536

                    JcrRepository.login() line: 145

                    JcrService.login() line: 111   

                    JcrService.registerSchema() line: 122  

                    JcrService.getInstance() line: 43      

                    NodeCrudMethods.queryNodes(QueryNodesRequest) line: 158

                    NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] 

                    NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39     

                    DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 

                    Method.invoke(Object, Object...) line: 597     

                    MethodInjectorImpl.invoke(HttpRequest, HttpResponse, Object) line: 155 

                    ResourceMethod.invokeOnTarget(HttpRequest, HttpResponse, Object) line: 257     

                    ResourceMethod.invoke(HttpRequest, HttpResponse, Object) line: 222     

                    ResourceMethod.invoke(HttpRequest, HttpResponse) line: 211     

                    SynchronousDispatcher.getResponse(HttpRequest, HttpResponse, ResourceInvoker) line: 525

                    SynchronousDispatcher.invoke(HttpRequest, HttpResponse, ResourceInvoker) line: 502

                    SynchronousDispatcher.invoke(HttpRequest, HttpResponse) line: 119      

                    ServletContainerDispatcher.service(String, HttpServletRequest, HttpServletResponse, boolean) line: 208 

                    HttpServlet30Dispatcher(HttpServletDispatcher).service(String, HttpServletRequest, HttpServletResponse) line: 55

                    HttpServlet30Dispatcher(HttpServletDispatcher).service(HttpServletRequest, HttpServletResponse) line: 50       

                    HttpServlet30Dispatcher(HttpServlet).service(ServletRequest, ServletResponse) line: 847

                    ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 329     

                    ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 248     

                    StandardWrapperValve.invoke(Request, Response) line: 275       

                    StandardContextValve.invoke(Request, Response) line: 161

                    SecurityContextAssociationValve.invoke(Request, Response) line: 153    

                    StandardHostValve.invoke(Request, Response) line: 155  

                    ErrorReportValve.invoke(Request, Response) line: 102   

                    StandardEngineValve.invoke(Request, Response) line: 109

                    CoyoteAdapter.service(Request, Response) line: 368     

                    Http11Processor.process(Socket) line: 877      

                    Http11Protocol$Http11ConnectionHandler.process(Socket) line: 671       

                    JIoEndpoint$Worker.run() line: 930     

                    Thread.run() line: 680

            {code}

            • 3. Re: JDBC configuration in AS7.1.1
              Randall Hauch Master

              Have you tried changing Infinispan's transaction mode to "XA"? I suspect that won't help, though. (I'm trying to find the issue that might have been fixed in 5.1.4 to see if there was workaround.)

              • 4. Re: JDBC configuration in AS7.1.1
                Brian Wallis Master

                The txnMgr parameter comes from this line in JcrRepository (1004)

                 

                 

                {code}

                                this.txnMgr = this.database.getCache().getAdvancedCache().getTransactionManager();

                {code}

                 

                and this does return null. What else can I look for. getAdvancedCache() returns an instance of DefaultEmbeddedCacheManager$DelegatingCache<K,V>.

                • 5. Re: JDBC configuration in AS7.1.1
                  Brian Wallis Master

                  Same error with FULL_XA or NONE. Still null for getTransactionManager()

                  • 6. Re: JDBC configuration in AS7.1.1
                    Randall Hauch Master

                    Does it change if you remove (or change) your cache store configuration in the Infinispan subsystem?

                    • 7. Re: JDBC configuration in AS7.1.1
                      Brian Wallis Master

                      I tried with

                       

                      {code}

                                  <cache-container name="modeshape" default-cache="sample">

                                      <local-cache name="testRepository"/>

                                  </cache-container>

                      {code}

                       

                      but get the same error. This cache would be all the defaults and memory resident (I think).

                      • 8. Re: JDBC configuration in AS7.1.1
                        Randall Hauch Master

                        What about with something like we have in our "standalone-modeshape.xml" ?

                        • 9. Re: JDBC configuration in AS7.1.1
                          Brian Wallis Master

                          It works if I use the following cache configuration

                           

                          {code}

                                          <local-cache name="testRepository">

                                              <transaction mode="NON_XA"/>

                                              <file-store relative-to="jboss.server.data.dir" path="modeshape/store/testRepository" passivation="false" purge="false"/>

                                          </local-cache>

                          {code}

                           

                          ie: if I use a file store. Filestores don't work for my app as I end up with over 32000 files in the store directory. This breaks on linux ext3 which has a limit of 32767 files in  a directory and runs very slowly on other systems. Wouldn't even think of trying this on windows.

                          • 10. Re: JDBC configuration in AS7.1.1
                            Randall Hauch Master

                            Brian Wallis wrote:

                             

                            It works if I use the following cache configuration

                             

                            
                                            <local-cache name="testRepository">
                                                <transaction mode="NON_XA"/>
                                                <file-store relative-to="jboss.server.data.dir" path="modeshape/store/testRepository" passivation="false" purge="false"/>
                                            </local-cache>

                             

                             

                            ie: if I use a file store. Filestores don't work for my app as I end up with over 32000 files in the store directory. This breaks on linux ext3 which has a limit of 32767 files in  a directory and runs very slowly on other systems. Wouldn't even think of trying this on windows.

                            I completely understand. I was just wondering whether Infinispan could find the transaction manager with our sample configuration. Obviously there's something going wrong AS7.1.1.

                            • 11. Re: JDBC configuration in AS7.1.1
                              Brian Wallis Master

                              Is JBoss 7.1.2 or 7.2 released? I could try that tomorrow and see if the problem goes away? ('tis nearly midnight here and time to get some sleep). I have had other issues with 7.1.1 before and used the nightly build to resolve those issues.

                               

                              I think I had better get the latest nightly build and see if the problem is resolved by that before continuing to look for the problem.

                               

                              thanks

                              • 12. Re: JDBC configuration in AS7.1.1
                                Randall Hauch Master

                                Unfortunately, no neither is released (though 7.1.2 and 7.1.3 are tagged and IIUC would require building locally). We've been waiting for 7.2.0.Alpha1 for a long time. :-(

                                • 13. Re: JDBC configuration in AS7.1.1
                                  Brian Wallis Master

                                  Downloaded the nightly build of 7.2.0 but it seems there is an incompatibility with the current modeshape build (Beta2). I will try pulling and building 7.1.2 (or 7.1.3)

                                   

                                   

                                  {code}

                                  09:37:18,766 INFO  [org.jboss.modules] JBoss Modules version 1.1.3.GA

                                  09:37:19,026 INFO  [org.jboss.msc] JBoss MSC version 1.0.2.GA

                                  09:37:19,100 INFO  [org.jboss.as] JBAS015899: JBoss AS 7.2.0.Alpha1-SNAPSHOT "Steropes" starting

                                  09:37:20,221 ERROR [org.jboss.as.controller.management-operation] JBAS014612: Operation ("parallel-extension-add") failed - address: ([]): java.lang.RuntimeException: JBAS014670: Failed initializing module org.modeshape

                                            at org.jboss.as.controller.extension.ParallelExtensionAddHandler$1.execute(ParallelExtensionAddHandler.java:99) [jboss-as-controller-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]

                                            at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:397) [jboss-as-controller-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]

                                            at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:284) [jboss-as-controller-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]

                                            at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:211) [jboss-as-controller-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]

                                            at org.jboss.as.controller.ModelControllerImpl.boot(ModelControllerImpl.java:156) [jboss-as-controller-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]

                                            at org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:191) [jboss-as-controller-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]

                                            at org.jboss.as.server.ServerService.boot(ServerService.java:314) [jboss-as-server-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]

                                            at org.jboss.as.server.ServerService.boot(ServerService.java:289) [jboss-as-server-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]

                                            at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:156) [jboss-as-controller-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]

                                            at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_33]

                                  Caused by: java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: org.jboss.as.controller.SimpleListAttributeDefinition$Builder.<init>(Ljava/lang/String;Lorg/jboss/as/controller/SimpleAttributeDefinition;)V

                                            at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222) [classes.jar:1.6.0_33]

                                            at java.util.concurrent.FutureTask.get(FutureTask.java:83) [classes.jar:1.6.0_33]

                                            at org.jboss.as.controller.extension.ParallelExtensionAddHandler$1.execute(ParallelExtensionAddHandler.java:91) [jboss-as-controller-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]

                                            ... 9 more

                                  Caused by: java.lang.NoSuchMethodError: org.jboss.as.controller.SimpleListAttributeDefinition$Builder.<init>(Ljava/lang/String;Lorg/jboss/as/controller/SimpleAttributeDefinition;)V

                                            at org.modeshape.jboss.subsystem.MappedListAttributeDefinition$Builder.<init>(MappedListAttributeDefinition.java:388)

                                            at org.modeshape.jboss.subsystem.MappedListAttributeDefinition$Builder.of(MappedListAttributeDefinition.java:393)

                                            at org.modeshape.jboss.subsystem.ModelAttributes.<clinit>(ModelAttributes.java:149)

                                            at org.modeshape.jboss.subsystem.RepositoryWriteAttributeHandler.<init>(RepositoryWriteAttributeHandler.java:40)

                                            at org.modeshape.jboss.subsystem.RepositoryWriteAttributeHandler.<clinit>(RepositoryWriteAttributeHandler.java:37)

                                            at org.modeshape.jboss.subsystem.ModeShapeExtension.initialize(ModeShapeExtension.java:85)

                                            at org.jboss.as.controller.extension.ExtensionAddHandler.initializeExtension(ExtensionAddHandler.java:97) [jboss-as-controller-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]

                                            at org.jboss.as.controller.extension.ParallelExtensionAddHandler$ExtensionInitializeTask.call(ParallelExtensionAddHandler.java:127) [jboss-as-controller-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]

                                            at org.jboss.as.controller.extension.ParallelExtensionAddHandler$ExtensionInitializeTask.call(ParallelExtensionAddHandler.java:113) [jboss-as-controller-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]

                                            at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [classes.jar:1.6.0_33]

                                            at java.util.concurrent.FutureTask.run(FutureTask.java:138) [classes.jar:1.6.0_33]

                                            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_33]

                                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [classes.jar:1.6.0_33]

                                            at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_33]

                                            at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.0.0.GA.jar:2.0.0.GA]

                                   

                                  09:37:20,232 FATAL [org.jboss.as.server] JBAS015957: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.

                                  09:37:20,245 INFO  [org.jboss.as] JBAS015950: JBoss AS 7.2.0.Alpha1-SNAPSHOT "Steropes" stopped in 6ms

                                  {code}

                                  • 14. Re: JDBC configuration in AS7.1.1
                                    Brian Wallis Master

                                    Tried a slightly older 7.1.2 snapshot that I had (2-3 weeks old) and got exactly the same error as above.

                                     

                                    I have tried many variations on the configuration but the transaction manager is always null.

                                     

                                    The 7.1.2 snapshot using infinispan 5.1.4 so it looks like the problem won't be resolved with an infinispan 5.1.4 update (but I suppose that the modeshape I'm using is built against 5.1.2..)

                                     

                                    Bit stumped now. Not sure what to try next.

                                    1 2 Previous Next