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

From: David Gradwell <david(at)gradwell(dot)com>
To: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: com/ongres/scram/common/exception/ScramException prevents use of postgresql-42.7.2.jar with scram-sha-256
Date: 2024-12-13 12:56:51
Message-ID: AM0PR04MB5492E3C99F501124AE65226DC9382@AM0PR04MB5492.eurprd04.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Daniel Gustafsson 2024-12-13 13:03:10 Re: com/ongres/scram/common/exception/ScramException prevents use of postgresql-42.7.2.jar with scram-sha-256
Previous Message Tom Lane 2024-12-13 03:42:13 Re: Build failure with GCC 15 (defaults to -std=gnu23)