Skip to content

Commit 65a5006

Browse files
author
Jan Lieskovsky
committed
[CIAM-1495] Explicitly add "com.ongres.scram.client" module as a dependency to
the PostgreSQL's "org.postgresql" module to prevent "java.lang.ClassNotFoundException" errors if using PostgreSQL JDBC client with SCRAM-SHA-256 password authentication method. See: * pgjdbc/pgjdbc@befea18 * pgjdbc/pgjdbc@1a89290 for more details about the extra Ongres SCRAM library dependency, required by the PostgreSQL JDBC driver, but not packaged into the PostgreSQL driver by default. This should fix errors like: Caused by: java.lang.ClassNotFoundException: com.ongres.scram.common.stringprep.StringPreparation from [Module "org.postgresql" version 42.2.3 from local module loader @59a62269 (finder: local module finder @5644c1b1 (roots: /opt/eap/modules,/opt/eap/modules/system/layers/openshift,/opt/eap/modules/system/layers/keycloak,/opt/eap/modules/system/layers/base))] 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) ... 53 more seen, when using "scram-sha-256" password authentication method with postgresql-jdbc RPM Signed-off-by: Jan Lieskovsky <[email protected]>
1 parent 760939b commit 65a5006

File tree

4 files changed

+45
-6
lines changed

4 files changed

+45
-6
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module xmlns="urn:jboss:module:1.0" name="com.ongres.scram.client">
3+
<resources>
4+
<resource-root path="ongres-scram-client.jar"/>
5+
</resources>
6+
<dependencies>
7+
<module name="javax.api"/>
8+
<module name="javax.transaction.api"/>
9+
<module name="com.ongres.scram.common" export="true"/>
10+
</dependencies>
11+
</module>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module xmlns="urn:jboss:module:1.0" name="com.ongres.scram.common">
3+
<resources>
4+
<resource-root path="ongres-scram-common.jar"/>
5+
</resources>
6+
<dependencies>
7+
<module name="javax.api"/>
8+
<module name="javax.transaction.api"/>
9+
</dependencies>
10+
</module>

modules/sso/db/drivers/added/modules/system/layers/openshift/org/postgresql/main/module.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,19 @@
66
<dependencies>
77
<module name="javax.api"/>
88
<module name="javax.transaction.api"/>
9+
<!--
10+
~ CIAM-1495: Explicitly add "com.ongres.scram.client" module as
11+
~ a dependency to the PostgreSQL's "org.postgresql" module to prevent
12+
~ "java.lang.ClassNotFoundException" errors if using PostgreSQL JDBC
13+
~ client with SCRAM-SHA-256 password authentication method. See:
14+
~
15+
~ * https://github.com/pgjdbc/pgjdbc/commit/befea18d153dda7814daef4e036d3f5daf8de1e5
16+
~ * https://github.com/pgjdbc/pgjdbc/commit/1a89290e110d5863b35e0a2ccf79e4292c1056f8
17+
~
18+
~ for more details about the extra Ongres SCRAM library dependency,
19+
~ required by the PostgreSQL JDBC driver, but not packaged into the
20+
~ PostgreSQL driver by default.
21+
-->
22+
<module name="com.ongres.scram.client" export="true"/>
923
</dependencies>
1024
</module>
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
# Link DB drivers, provided by RPM packages, into the "openshift" layer
33
set -e
44

55
# Import RH-SSO global variables & functions to image build-time
66
# shellcheck disable=SC1091
77
source "${JBOSS_HOME}/bin/launch/sso-rcfile-definitions.sh"
88

9-
SCRIPT_DIR=$(dirname $0)
9+
SCRIPT_DIR=$(dirname "$0")
1010
ADDED_DIR=${SCRIPT_DIR}/added
1111

1212
function link {
13-
mkdir -p $(dirname $2)
14-
ln -s $1 $2
13+
mkdir -p "$(dirname "$2")"
14+
ln -s "$1" "$2"
1515
}
1616

17-
link /usr/share/java/postgresql-jdbc.jar $JBOSS_HOME/modules/system/layers/openshift/org/postgresql/main/postgresql-jdbc.jar
17+
# Link the main PostgreSQL JDBC JAR
18+
link /usr/share/java/postgresql-jdbc.jar "${JBOSS_HOME}"/modules/system/layers/openshift/org/postgresql/main/postgresql-jdbc.jar
19+
# CIAM-1495: But also the JARs for the Ongres SCRAM library, so it's possible to use SCRAM-SHA-256 password-based auth method
20+
link /usr/share/java/ongres-scram/common.jar "${JBOSS_HOME}"/modules/system/layers/openshift/com/ongres/scram/common/main/ongres-scram-common.jar
21+
link /usr/share/java/ongres-scram/client.jar "${JBOSS_HOME}"/modules/system/layers/openshift/com/ongres/scram/client/main/ongres-scram-client.jar
1822

1923
# Remove any existing destination files first (which might be symlinks)
20-
cp -rp --remove-destination "$ADDED_DIR/modules" "$JBOSS_HOME/"
24+
cp -rp --remove-destination "${ADDED_DIR}/modules" "${JBOSS_HOME}"

0 commit comments

Comments
 (0)