Uploaded image for project: 'Red Hat Process Automation Manager'
  1. Red Hat Process Automation Manager
  2. RHPAM-4740

Unable to connect to external PostgreSQL DB over SSL from kie-server on OCP

XMLWordPrintable

    • False
    • None
    • False
    • CR1
    • ?
    • Hide

      1. download version 42.2.14 driver from here.

      https://jdbc.postgresql.org/download/postgresql-42.2.14.jar

      2. create secret with this jar

      e.g.
      $ oc create secret generic rhpam-psql-sslfix --from-file=postgresql-jdbc.jar=postgresql-42.2.14.jar

      4. edit kieconfigs config map of your operator version (e.g. 7.13.2) by the following command or via OpenShift admin console UI and add volume and volumeMount for 'servers:' object like below.

      e.g.
      $ oc edit cm kieconfigs-7.13.2
      ...

        1. KIE Servers BEGIN
          servers:
          ...
          volumeMounts:
      • mountPath: /opt/eap/modules/system/layers/openshift/org/postgresql/main/postgresql-jdbc.jar
        name: rhpam-psql-sslfix
        readOnly: true
        subPath: postgresql-jdbc.jar
        ....
        volumes:
      • name: rhpam-psql-sslfix
        secret:
        defaultMode: 444
        secretName: rhpam-psql-sslfix

      5. delete KIE Server deploymentConfig to rollout kieserver pod

      Show
      1. download version 42.2.14 driver from here. https://jdbc.postgresql.org/download/postgresql-42.2.14.jar 2. create secret with this jar e.g. $ oc create secret generic rhpam-psql-sslfix --from-file=postgresql-jdbc.jar=postgresql-42.2.14.jar 4. edit kieconfigs config map of your operator version (e.g. 7.13.2) by the following command or via OpenShift admin console UI and add volume and volumeMount for 'servers:' object like below. e.g. $ oc edit cm kieconfigs-7.13.2 ... KIE Servers BEGIN servers: ... volumeMounts: mountPath: /opt/eap/modules/system/layers/openshift/org/postgresql/main/postgresql-jdbc.jar name: rhpam-psql-sslfix readOnly: true subPath: postgresql-jdbc.jar .... volumes: name: rhpam-psql-sslfix secret: defaultMode: 444 secretName: rhpam-psql-sslfix 5. delete KIE Server deploymentConfig to rollout kieserver pod
    • ---
    • ---
    • 2023 Week 27-29 (from Jul 3), 2023 Week 30-32 (from Jul 24)

      When deploying a version 7.13.3 kie-sever image using an external PostgresSQL DB over SSL connection, the DB connection fails with an exception

      _java.lang.ClassNotFoundException: _ com.ongres.scram.common.stringprep.StringPreparation

      like the following stack and the pod fails to start.

      05:07:34,757 ERROR [org.jboss.as.ejb3.timer] (MSC service thread 1-8) WFLYEJB0163: Cannot create table for timer persistence: java.sql.SQLException: javax.resource.ResourceException:
       IJ000453: Unable to get managed connection for java:/jboss/datasources/rhpam_EJBTimer
      	at org.jboss.ironjacamar.jdbcadapters@1.5.11.Final-redhat-00001//org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:158)
      	at org.jboss.as.connector@7.4.10.GA-redhat-00002//org.jboss.as.connector.subsystems.datasources.WildFlyDataSource.getConnection(WildFlyDataSource.java:64)
      	at org.jboss.as.ejb3@7.4.10.GA-redhat-00002//org.jboss.as.ejb3.timerservice.persistence.database.DatabaseTimerPersistence.checkDatabase(DatabaseTimerPersistence.java:375)
      	at org.jboss.as.ejb3@7.4.10.GA-redhat-00002//org.jboss.as.ejb3.timerservice.persistence.database.DatabaseTimerPersistence.start(DatabaseTimerPersistence.java:204)
      	at org.jboss.msc@1.4.12.Final-redhat-00001//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
      	at org.jboss.msc@1.4.12.Final-redhat-00001//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
      	at org.jboss.msc@1.4.12.Final-redhat-00001//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
      	at org.jboss.threads@2.4.0.Final-redhat-00001//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
      	at org.jboss.threads@2.4.0.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
      	at org.jboss.threads@2.4.0.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
      	at org.jboss.threads@2.4.0.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
      	at java.base/java.lang.Thread.run(Thread.java:829)
      Caused by: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/jboss/datasources/rhpam_EJBTimer
      	at org.jboss.ironjacamar.impl@1.5.11.Final-redhat-00001//org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:690)
      	at org.jboss.ironjacamar.impl@1.5.11.Final-redhat-00001//org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:440)
      	at org.jboss.ironjacamar.impl@1.5.11.Final-redhat-00001//org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:789)
      	at org.jboss.ironjacamar.jdbcadapters@1.5.11.Final-redhat-00001//org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:150)
      	... 11 more
      Caused by: javax.resource.ResourceException: IJ031084: Unable to create connection
      	at org.jboss.ironjacamar.jdbcadapters@1.5.11.Final-redhat-00001//org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXAManagedConnection(XAManagedConnectionFactory.java:532
      )
      	at org.jboss.ironjacamar.jdbcadapters@1.5.11.Final-redhat-00001//org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:43
      9)
      	at org.jboss.ironjacamar.impl@1.5.11.Final-redhat-00001//org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.createConnectionEventListe
      ner(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:1328)
      	at org.jboss.ironjacamar.impl@1.5.11.Final-redhat-00001//org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.getConnection(SemaphoreCon
      currentLinkedDequeManagedConnectionPool.java:505)
      	at org.jboss.ironjacamar.impl@1.5.11.Final-redhat-00001//org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:640)
      	at org.jboss.ironjacamar.impl@1.5.11.Final-redhat-00001//org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:605)
      	at org.jboss.ironjacamar.impl@1.5.11.Final-redhat-00001//org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:624)
      	... 14 more
      Caused by: java.lang.NoClassDefFoundError: com/ongres/scram/common/stringprep/StringPreparation
      	at org.postgresql@42.2.14//org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:671)
      	at org.postgresql@42.2.14//org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:146)
      	at org.postgresql@42.2.14//org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:197)
      	at org.postgresql@42.2.14//org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
      	at org.postgresql@42.2.14//org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:217)
      	at org.postgresql@42.2.14//org.postgresql.Driver.makeConnection(Driver.java:458)
      	at org.postgresql@42.2.14//org.postgresql.Driver.connect(Driver.java:260)
      	at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
      	at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)
      	at org.postgresql@42.2.14//org.postgresql.ds.common.BaseDataSource.getConnection(BaseDataSource.java:98)
      	at org.postgresql@42.2.14//org.postgresql.xa.PGXADataSource.getXAConnection(PGXADataSource.java:46)
      	at org.jboss.ironjacamar.jdbcadapters@1.5.11.Final-redhat-00001//org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXAManagedConnection(XAManagedConnectionFactory.java:516
      )
      	... 20 more
      Caused by: java.lang.ClassNotFoundException: com.ongres.scram.common.stringprep.StringPreparation from [Module "org.postgresql" version 42.2.14 from local module loader @1339e7aa (finder: l
      ocal module finder @1fb669c3 (roots: /opt/eap/modules,/opt/eap/modules/system/layers/openshift,/opt/eap/modules/system/layers/base/.overlays/layer-base-jboss-eap-7.4.10.CP,/opt/eap/modules/
      system/layers/base,/opt/eap/modules/system/add-ons/keycloak))]
      	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
      	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
      	... 32 more
      

      Within 7.13.x kie-sever image, version 42.2.14 postgresql JDBC driver (/usr/share/java/postgresql-jdbc/postgresql.jar ) is used as we can see in above stack and it does not contain problematic class .

            rhn-support-fspolti Filippe Spolti
            rhn-support-hmiura Hiroko Miura
            Jakub Schwan Jakub Schwan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: