postgresql-jdbc throws NoClassDefFoundError StringPreparation during SCRAM-SHA-256 authentication
Issue
-
Connecting to a FIPS-enabled PostgreSQL server using the Red Hat-provided postgresql-jdbc package fails when scram-sha-256 authentication is configured. The connection attempt terminates abruptly with a java.lang.NoClassDefFoundError.
-
When running a Java application attempting to establish a connection via the default JDBC driver, the following exception stack trace occurs:
Exception in thread "main" java.lang.NoClassDefFoundError: com/ongres/scram/common/stringprep/StringPreparation at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:759) at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:161) ... Caused by: java.lang.ClassNotFoundException: com.ongres.scram.common.stringprep.StringPreparation at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ...
Environment
- Red Hat Enterprise Linux 10.x
- Red Hat Enterprise Linux 9.x
- postgresql-jdbc-42.2.28(prior to release version 42.2.28-2.el9 on RHEL 9)
- Early streams/builds of postgresql-jdbc on RHEL 10 lacking bundled scram dependencies.
- FIPS mode enabled on the client/system
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.