Postgresql dependency on com.ongres.scram - how to add to classpath?

Hi,

I’m setting up keycloak (13) to use postgresql on CentOS 8. I’ve installed the postgresql-jdbc package which pulls in ongres-scram-client client.

I’ve created the modules/system/layers/keycloak/org/postgresql/main directory, in which I’ve created a symlink to /usr/share/java/postgresql-jdbc/postgresql.jar and a module.xml to define the module as described in the documentation. I’ve also updated the xml file to use a postgresql database.

Starting the server with this setup fails with the following error:

Caused by: java.lang.NoClassDefFoundError: com/ongres/scram/common/stringprep/StringPreparation
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:608)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:203)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
at org.postgresql.jdbc.PgConnection.(PgConnection.java:201)
at org.postgresql.Driver.makeConnection(Driver.java:454)
at org.postgresql.Driver.connect(Driver.java:256)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:321)
… 67 more

So it seems the jar files for ongres need to be added as well.
So I’ve created:

/srv/keycloak-13.0.1/modules/system/layers/keycloak/com/ongres/scram/common/main in which I’ve added a symlink to /usr/share/java/ongres-scram/common.jar and a module.xml:

<?xml version="1.0" ?>
<module xmlns="urn:jboss:module:1.3" name="com.ongres.scram.common">
    <resources>
        <resource-root path="common.jar"/>
    </resources>
</module>

Also a modules/system/layers/keycloak/com/ongres/scram/client/main directory with a symlink to /usr/share/java/ongres-scram/client.jar and a module.xml:

<?xml version="1.0" ?>
<module xmlns="urn:jboss:module:1.3" name="com.ongres.scram.client">
    <resources>
        <resource-root path="client.jar"/>
    </resources>
    <dependencies>
        <module name="com.ongres.scram.common"/>
    </dependencies>
</module>

But the error remains. How can I add these dependencies to the classpath so I can connect to a postgresql database?

Regards,
Rik