-1

Using Postgres version 15.2 and PostgreSQL JDBC Driver 42.2.14.

Authentication to the Postgres database works for two other nearly identical environments using our same application but in one environment only we are getting a missing class error that mentions an ongres library: Caused by: java.lang.NoClassDefFoundError: com/ongres/scram/common/stringprep/StringPreparation

All environments are using the same JDBC URL and options. The only mention of "ongres" with "postgres" that I've found is that the Postgres JDBC starting with driver 42.2.0 added support for encryption that uses Ongres: "Support SCRAM-SHA-256 for PostgreSQL 10 in the JDBC 4.2 version (Java 8+) using the Ongres SCRAM library. PR 842"

It is highly annoying that I should have to add a completely new untested ongres jar into my environment for unknown reasons to get rid of this weird error. We're not using encryption SHA-256 internally nor with any encryption of passwords. We're not hitting a plain old missing jar file as the other two environments do not require an additional library to authenticate to the same database.

Does anyone know what causes a JDBC authentication call to Postgres to fall into this ongres stringprep call? What else is ongres used for that might be getting triggered?

I've tried using the exact version of Postgres and JDBC driver in a simple test environment and everything works fine there. Trying to determine what complications/options might be triggering this ongres class access.

aapega
  • 1
  • 2
  • Does this answer your question? [How to install JDBC driver in Eclipse web project without facing java.lang.ClassNotFoundexception](https://stackoverflow.com/questions/2353141/how-to-install-jdbc-driver-in-eclipse-web-project-without-facing-java-lang-class) – jQueeny Aug 24 '23 at 20:49
  • The simple explanation is the server requires SCRAM authentication. So the necessary environment to reproduce this would be: A JDBC driver which knows what SCRAM is, but doesn't come with the library which supports it built in, and a connection attempt to a server asking for it to be used. Your simple test environment probably fails on of these requirements – jjanes Aug 24 '23 at 21:20
  • The main database on the same server authenticates to the same Postgres with the same JDBC driver without invoking the SCRAM class. I think the second (somehow different) JDBC URL being used for this second data source invokes some option that triggers it... the question is what option? – aapega Aug 24 '23 at 21:45

0 Answers0