RE: sspi connection throws NoSuchMethodError: com.such.jna.platform.win32.Sspi$SecBufferDesc with Waffle 2.3.0 - Mailing list pgsql-jdbc

From LE MENTEC, SANDRINE
Subject RE: sspi connection throws NoSuchMethodError: com.such.jna.platform.win32.Sspi$SecBufferDesc with Waffle 2.3.0
Date
Msg-id DB3PR0202MB338688257851B266C1B9B76ED04C9@DB3PR0202MB3386.eurprd02.prod.outlook.com
Whole thread Raw
In response to Re: sspi connection throws NoSuchMethodError: com.such.jna.platform.win32.Sspi$SecBufferDesc with Waffle 2.3.0  (Jorge Solórzano <jorsol@gmail.com>)
List pgsql-jdbc

Hi Jorge,

 

I have just added  to my class path the waffle-jna.1.9.0.jar and its dependancies jna-4.5.2.jar and jna-plateform-4.5.2.jar and it  worked.

 

Thanks you very much,

Regards,

____________________________________________________________________

Sandrine Le Mentec

Software Engineer | CSD

 

Capgemini France | 147 Issy les Moulineaux

www.capgemini.com



____________________________________________________________________

Connect with Capgemini:

     

 

Please consider the environment and do not print this email unless absolutely necessary.

Capgemini encourages environmental awareness.

 

De : Jorge Solórzano <jorsol@gmail.com>
Envoyé : vendredi 16 avril 2021 13:07
À : LE MENTEC, SANDRINE
Cc : pgsql-jdbc@lists.postgresql.org; KOUMIRA, Adnane
Objet : Re: sspi connection throws NoSuchMethodError: com.such.jna.platform.win32.Sspi$SecBufferDesc with Waffle 2.3.0

 

Hi Sandrine,

 

The version of waffle that should work with pgjdbc is 1.9.1:

 

Regards,

 

On Fri, Apr 16, 2021 at 12:05 PM LE MENTEC, SANDRINE <sandrine.le-mentec@capgemini.com> wrote:

Dear community,

 

I am currently trying to set up a project with sspi authentication on a windows server. I use the jdbc postgresql-42.2.18.jar with a postgres 12.5.

I have downloaded the waffles libraries as recommanded here : https://jdbc.postgresql.org/documentation/94/connect.html and added them to the classpath project.

 

I have tried this part of code in a Test :

 

String url = ʺjdbc:postgresql://<serveradress>:<portnumber>/<databasename>?gsslib=sspiʺ;

Connection conn = DriverManager.getConnection(url);

 

The code throws the following exception :

NoSuchMethodError: com.such.jna.platform.win32.Sspi$SecBufferDesc at org.postgresql.sspi.SSPIClient.continueSSPI(SSPIClient.java :204).

 

When I looked the pgjdbc github of the SSPIClient class (https://github.com/pgjdbc/pgjdbc/blob/master/pgjdbc/src/main/java/org/postgresql/sspi/SSPIClient.java), I have noticed that the following constructor is used : SecBufferDesc(Sspi.SECBUFFER_TOKEN, receivedToken).

 

The SecBufferDesc class comes from the jna.platform librairy 5.0.0 (com.sun.jna.platform.win32.Sspi.SecBufferDesc) provided by the waffle librairies 2.3.0.

 

Looking at the SecBufferDesc class inside the jna.platform 5.0.0, there is only one constructor (SecBufferDesc()). There is no constructor SecBufferDesc(int type, int tokenSize)anymore.

 

Doing a little research, the problem seems to be known by the waffle community (https://github.com/Waffle/waffle/issues/838).

 

It seems that it is not possible to use the last Waffle version (2.3.0) to do sspi authentication with the pgjdbc because of that.

 

Do you know witch version of the Waffle libraries I should use to enable SSPI authentication with the pgjdbc ? Do you think I should report this issue as a bug on the pgjdbc github ?

 

Thanks for your help,

Regards,

____________________________________________________________________

Sandrine Le Mentec

Software Engineer | CSD

 

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

Attachment

pgsql-jdbc by date:

Previous
From: Jorge Solórzano
Date:
Subject: Re: sspi connection throws NoSuchMethodError: com.such.jna.platform.win32.Sspi$SecBufferDesc with Waffle 2.3.0
Next
From: Tom Aizenberg
Date:
Subject: [pgjdbc/pgjdbc] aa20de: Add SERIALIZATION_FAILURE to org.postgresql.util.P...