PostgreSQL and SSPI on Windows platform

Good day,

I’d like to get SSPI working with XWiki on the Windows OS platform.

I have a PostgreSQL server (v9.6) and SSPI is configured and working (I can authenticate without username and password to the database using pgAdmin tool and psql.exe). So I have confirmed that SSPI works just fine as documented (Configuring for single sign-on using SSPI on Windows - PostgreSQL wiki).

My problem is now configuring hibernate.cfg.xml to use SSPI. The relevant part of my hibernate.cfg.xml looks like this:

<!-- PostgreSQL configuration.
     Uncomment if you want to use PostgreSQL and comment out other database configurations.
       - "jdbc.use_streams_for_binary" needs to be set to "false",
       - "xwiki.virtual_mode" can be set to either "schema" or "database". Note that currently the database mode
         doesn't support database creation (see
       - if you want the main wiki database to be different than "xwiki" (or "public" in schema mode)
         you will also have to set the property xwiki.db in xwiki.cfg file
<property name="connection.url">jdbc:postgresql://servername:5432/xwiki?gsslib=sspi</property>
<!-- <property name="connection.username">xwiki</property> -->
<!-- <property name="connection.password">xwiki</property> -->
<property name="connection.driver_class">org.postgresql.Driver</property>
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="jdbc.use_streams_for_binary">false</property>
<property name="xwiki.virtual_mode">schema</property>

<property name="hibernate.connection.charSet">UTF-8</property>
<property name="hibernate.connection.useUnicode">true</property>
<property name="hibernate.connection.characterEncoding">utf8</property>

<mapping resource="xwiki.postgresql.hbm.xml"/>
<mapping resource="feeds.hbm.xml"/>
<mapping resource="activitystream.hbm.xml"/>
<mapping resource="instance.hbm.xml"/>
<mapping resource="mailsender.hbm.xml"/>

The problem is that I see this error in the logs:

2018-09-24 16:30:17,362 [XWiki initialization] ERROR c.x.x.s.DBCPConnectionProvider - Could not create a DBCP pool. There is an error in the Hibernate configuration file, please review it. 
java.sql.SQLException: Cannot create PoolableConnectionFactory (The server requested password-based authentication, but no password was provided.)

(I have also tried gsslib=auto but I see the same error messages.)

According to the PostgreSQL JDBC documentation (, I think my syntax is correct.

Can anyone offer any insight/assistance as to what might be going wrong?

Do you have a full stack trace also?

Do you have a full stack trace also?

Yes (see attached).

stacktrace.txt (82.3 KB)

This is resolved.

The problem was that I was missing a host entry in the PostgreSQL pg_hba.conf file to permit remote connections.

Once I configured that correctly, gsslib=auto in the JDBC connection URL worked fine.