Thread: com/ongres/scram/common/exception/ScramException prevents use of postgresql-42.7.2.jar with scram-sha-256

Note that all our servers have pg_hba.conf files containing rows like:

 

# IPv4 local connections:

host    all             all             127.0.0.1/32            scram-sha-256

host    all             all             192.168.1.15/32            scram-sha-256

 

We moved to scram-sha-256 some years ago with no problems.

 

 

We have twenty or more applications.  As part of regular maintenance, we replaced the jdbc driver postgresql-42.5.4.jar that we had been using for a year or more very successfully by the latest postgresql-42.7.2.jar.

 

 

All our logon code in all applications now invariably throws:

 

com/ongres/scram/common/exception/ScramException

 

The exception is

 

java.lang.NoClassDefFoundError: com/ongres/scram/common/exception/ScramException

                at org.postgresql.core.v3.ConnectionFactoryImpl.lambda$doAuthentication$5(ConnectionFactoryImpl.java:864)

                at org.postgresql.core.v3.AuthenticationPluginManager.withPassword(AuthenticationPluginManager.java:82)

                at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:851)

                at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:213)

                at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:268)

                at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:54)

                at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:273)

                at org.postgresql.Driver.makeConnection(Driver.java:446)

                at org.postgresql.Driver.connect(Driver.java:298)

                at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681)

                at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:190)

                at com.gradwell.dbAppCore.ConnectInfo.doConnect(ConnectInfo.java:136)

etc.

 

This is 100% reproducible in many Java applications.  Reverting the application build to using postgresql-42.5.4.jar and the problem goes away.

 

It does look as though other people have hit this issue or related exceptions.   As part of our research we added ongres/scram-client-3.1.jar and ongres/common-2.1.jar to the build but that does not help.  I found that https://stackoverflow.com/questions/62807717/how-can-i-solve-postgresql-scram-authentication-problem gave me enough clues to decide to go back to the older jdbc driver.

 

I would be happy to alpha & beta test a new version of the jdbc driver that fixes this problem.

 

The following version details may be helpful.

 

Product Version: Apache NetBeans IDE 23

Java: 17.0.13; OpenJDK 64-Bit Server VM 17.0.13+11-LTS

Runtime: OpenJDK Runtime Environment 17.0.13+11-LTS

System: Mac OS X version 15.1.1 running on aarch64;

 

The machine is an M4 MacMini.

 

 

David JL Gradwell, M.A. (Cantab), F.B.C.S.

Chartered Information Systems Practitioner

 

Managing Director

Gradwell Business Solutions Limited

 

 

 

> On 13 Dec 2024, at 13:56, David Gradwell <david@gradwell.com> wrote:

>  This is 100% reproducible in many Java applications.  Reverting the application build to using postgresql-42.5.4.jar
andthe problem goes away. 

While there are JDBC maintainers on the postgres lists, it's better to report
JDBC issues directly to the JDBC project:

    https://github.com/pgjdbc/pgjdbc/issues

--
Daniel Gustafsson







On Fri, 13 Dec 2024 at 08:03, Daniel Gustafsson <daniel@yesql.se> wrote:
> On 13 Dec 2024, at 13:56, David Gradwell <david@gradwell.com> wrote:

>  This is 100% reproducible in many Java applications.  Reverting the application build to using postgresql-42.5.4.jar and the problem goes away.

While there are JDBC maintainers on the postgres lists, it's better to report
JDBC issues directly to the JDBC project:

        https://github.com/pgjdbc/pgjdbc/issues


Infinitely faster response on github

Dave