4 Replies Latest reply on Sep 24, 2019 5:55 AM by pinak-mazumdar

    Application Fails to Load after enabling  jdbc based session persistence.

    pinak-mazumdar

      Hi Experts,

       

           I  am doing a POC  with JBoss EAP 7.1 release wherein I have enabled db based session persistence, I have tested with the default cache manager persistence and it works well but somehow it doesn't stores any session data in the database schema, however the table gets created at the start of the server which I could see, for this I am starting with the sample counter.war which is present in the Redhat knowledge base. I am using Oracle 12cR1 database.

       

      One more thing is , I am also not able to see the application  from the console, same  thing when I run the  CLI command to read the resource. When I try to see the deployment under Deployments, it simly complains

      Unable to load deployments

       

      Unexpected HTTP response: 500  Request { "operation" => "read-children-resources", "address" => undefined, "child-type" => "deployment", "include-runtime" => true, "recursive" => true }  Response  Internal Server Error { "outcome" => "failed", "rolled-back" => true }

      My server configuration in the standalone-ha.xml for the jdbc store is as below:

      <subsystem xmlns="urn:jboss:domain:infinispan:4.0">

                  <cache-container name="server" aliases="singleton cluster" default-cache="default" module="org.wildfly.clustering.server">

                      <transport lock-timeout="60000"/>

                      <replicated-cache name="default">

                          <transaction mode="BATCH"/>

                      </replicated-cache>

                  </cache-container>

                  <cache-container name="web" default-cache="jdbc" module="org.wildfly.clustering.web.infinispan">

                      <transport channel="ee" lock-timeout="60000"/>

                      <local-cache name="concurrent">

                              <file-store passivation="true" purge="false"/>

                      </local-cache>

                      <invalidation-cache name="jdbc">

                          <binary-keyed-jdbc-store data-source="Session" dialect="ORACLE" fetch-state="false" passivation="false" preload="false" purge="false" shared="true" singleton="false">

                     <!-- <transaction mode="BATCH"/>-->

                      <property name="database-Type">

                                  oracle

                              </property>

                              <binary-keyed-table prefix="sess">

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

                                 <data-column name="DATUM" type="BINARY"/>

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

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

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

                              </binary-keyed-table>

                          </binary-keyed-jdbc-store>

                      </invalidation-cache>

                  </cache-container>

                  <cache-container name="ejb" aliases="sfsb" default-cache="dist" module="org.wildfly.clustering.ejb.infinispan">

                      <transport lock-timeout="60000"/>

                      <distributed-cache name="dist">

                          <locking isolation="REPEATABLE_READ"/>

                          <transaction mode="BATCH"/>

                          <file-store/>

                      </distributed-cache>

      The table that gets created is also as below:

       

      TNAME

      --------------------------------------------------------------------------------

      TABTYPE  CLUSTERID

      ------- ----------

      BIN$cLKr2H7+eQ3gU1J2QgonwQ==$0

      TABLE

      SESS_counter_war

      TABLE

      sess_counter_war

      TABLE

       

      FYI, just for my satisfaction I tried by changing the prefix in the standalone-ha.xml so that's why two tables you could see.

       

      Please guide me if I am doing something wrong.

        • 1. Re: Application Fails to Load after enabling  jdbc based session persistence.
          pferraro

          <binary-keyed-jdbc-store/> is deprecated in EAP 7.1.  In EAP 7.1, you should configure session persistence using <string-keyed-jdbc-store/>.

           

          Additionally, your configuraiton should only define 1 <table-column/>.

          • 2. Re: Application Fails to Load after enabling  jdbc based session persistence.
            pinak-mazumdar

            Hi Paul,

             

                 Thanks for replying, I have changed the jdbc store configuration to

            <string-keyed-jdbc-store data-source="Session" dialect="ORACLE" fetch-state="false" passivation="false" preload="false" purge="false" shared="true" singleton="false">

                           <!-- <transaction mode="BATCH"/>-->

                                    <property name="database-Type">

                                        oracle

                                    </property>

                                    <string-keyed-table prefix="Sess"/>

                                </string-keyed-jdbc-store>

             

            I did not understood what do you mean by "Additionally, your configuraiton should only define 1 <table-column/>".

            Does the  table gets created  without explicitly giving the column  names, I  tried by removing the column names and could see that   during start of the server it complains :

             

            ISPN008011: Error while creating table; used DDL statement: 'CREATE TABLE "Sess_counter_war" (id VARCHAR NOT NULL, datum BINARY NOT NULL, version BIGINT NOT NULL, PRIMARY KEY (id))': java.sql.SQLSyntaxErrorException: ORA-00906: missing left parenthesis

             

            This means the DDL statement is taken from within the product, I even had a look at the TableManipulationConfiguration.class and  but could not identify form where does it takes the datatype as BINARY.

            • 3. Re: Application Fails to Load after enabling  jdbc based session persistence.
              pinak-mazumdar

              Hi Paul,

               

              I am able to bring up the  jboss service using the string based  jdbc cache store , however while deploying  an application it fails with the below error.

              Can you please guide.

               

              19:32:11,570 ERROR [org.infinispan.persistence.jdbc.table.management.OracleTableManager] (ServerService Thread Pool -- 72) ISPN008011: Error while creating table; used DDL statement: 'CREATE TABLE "sess_counter_war" (id VARCHAR NOT NULL, datum BINARY NOT NULL, version BIGINT NOT NULL, PRIMARY KEY (id))': java.sql.SQLSyntaxErrorException: ORA-00906: missing left parenthesis

               

               

                      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)

                      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)

                      at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:951)

                      at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:513)

                      at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:227)

                      at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)

                      at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:195)

                      at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1036)

                      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1336)

                      at oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:1845)

                      at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1810)

                      at oracle.jdbc.driver.OracleStatementWrapper.executeUpdate(OracleStatementWrapper.java:294)

                      at org.jboss.jca.adapters.jdbc.WrappedStatement.executeUpdate(WrappedStatement.java:430)

                      at org.infinispan.persistence.jdbc.table.management.AbstractTableManager.executeUpdateSql(AbstractTableManager.java:124)

                      at org.infinispan.persistence.jdbc.table.management.AbstractTableManager.createTable(AbstractTableManager.java:117)

                      at org.infinispan.persistence.jdbc.table.management.AbstractTableManager.start(AbstractTableManager.java:56)

                      at org.infinispan.persistence.jdbc.stringbased.JdbcStringBasedStore.initializeConnectionFactory(JdbcStringBasedStore.java:426)

                      at org.infinispan.persistence.jdbc.stringbased.JdbcStringBasedStore.start(JdbcStringBasedStore.java:103)

                      at org.infinispan.persistence.manager.PersistenceManagerImpl.start(PersistenceManagerImpl.java:154)

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                      at java.lang.reflect.Method.invoke(Method.java:483)

                      at org.infinispan.commons.util.SecurityActions.lambda$invokeAccessibly$0(SecurityActions.java:91)

                      at org.infinispan.commons.util.SecurityActions$$Lambda$1077/1747287038.run(Unknown Source)

                      at org.infinispan.commons.util.SecurityActions.doPrivileged(SecurityActions.java:83)

                      at org.infinispan.commons.util.SecurityActions.invokeAccessibly(SecurityActions.java:88)

                      at org.infinispan.commons.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:165)

                      at org.infinispan.factories.AbstractComponentRegistry$PrioritizedMethod.invoke(AbstractComponentRegistry.java:859)

                      at org.infinispan.factories.AbstractComponentRegistry.invokeStartMethods(AbstractComponentRegistry.java:628)

                      at org.infinispan.factories.AbstractComponentRegistry.internalStart(AbstractComponentRegistry.java:617)

                      at org.infinispan.factories.AbstractComponentRegistry.start(AbstractComponentRegistry.java:542)

                      at org.infinispan.factories.ComponentRegistry.start(ComponentRegistry.java:238)

                      at org.infinispan.cache.impl.CacheImpl.start(CacheImpl.java:862)

                      at org.infinispan.manager.DefaultCacheManager.wireAndStartCache(DefaultCacheManager.java:635)

                      at org.infinispan.manager.DefaultCacheManager.createCache(DefaultCacheManager.java:585)

                      at org.infinispan.manager.DefaultCacheManager.getCache(DefaultCacheManager.java:451)

                      at org.jboss.as.clustering.infinispan.DefaultCacheContainer.getCache(DefaultCacheContainer.java:108)

                      at org.jboss.as.clustering.infinispan.DefaultCacheContainer.getCache(DefaultCacheContainer.java:103)

                      at org.wildfly.clustering.infinispan.spi.service.CacheBuilder.lambda$build$0(CacheBuilder.java:83)

                      at org.wildfly.clustering.infinispan.spi.service.CacheBuilder$$Lambda$781/958302461.get(Unknown Source)

                      at org.wildfly.clustering.service.SuppliedValueService.lambda$new$0(SuppliedValueService.java:42)

                      at org.wildfly.clustering.service.SuppliedValueService$$Lambda$681/1389243341.apply(Unknown Source)

                      at org.wildfly.clustering.service.FunctionalValueService.start(FunctionalValueService.java:68)

                      at org.wildfly.clustering.service.AsynchronousServiceBuilder.lambda$start$0(AsynchronousServiceBuilder.java:99)

                      at org.wildfly.clustering.service.AsynchronousServiceBuilder$$Lambda$670/1288412187.run(Unknown Source)

                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

                      at java.lang.Thread.run(Thread.java:744)

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

              • 4. Re: Application Fails to Load after enabling  jdbc based session persistence.
                pinak-mazumdar

                This is quite a late reply almost a year after but as it is being said "Better Late than Never"

                 

                 

                I managed to bring up the application successfully after some days of facing the error initially. I realized that there was some major issue in my configuration. Basically, I  had the below problems:

                 

                 

                1. Using distributed cache instead of invalidated cache.

                2. Using binary store  instead of string based  store.

                3. Invalid column  and  datatypes.

                 

                 

                The  configuration for using jdbc cache store should  essentially  be like :-

                 

                 

                <cache-container name="web" default-cache="jdbc" module="org.wildfly.clustering.web.infinispan">

                                <transport channel="ee" lock-timeout="60000"/>

                                <invalidation-cache name="jdbc">

                                    <string-keyed-jdbc-store data-source="sessionds" dialect="ORACLE" fetch-state="false" passivation="false" preload="false" purge="false" shared="true" singleton="false">

                                        <property name="database-Type">

                                            oracle

                                        </property>

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

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

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

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

                                        </string-keyed-table>

                                    </string-keyed-jdbc-store>

                                </invalidation-cache>