Unable to create a VirtualGraph with a PostgreSQL Server

(lav) #1

Hi,

I am trying to create a VirtualGraph for a relational database hosted in a PostgreSQL Server using the following command:

stardog-admin virtual add database.properties databaseMappings.ttl --format r2rml

The error that I am receiving is:

The server requested password-based authentication, but no password was provided.

and this is the error log:

`ERROR 2019-05-08 15:10:41,133 [stardog-user-38] com.stardog.http.server.undertow.ErrorHandling:writeError(138): Unexpected error on the server

java.lang.RuntimeException: org.postgresql.util.PSQLException: The server requested password-based authentication, but no password was provided.
at com.complexible.stardog.virtual.RdbmsDataSource.lambda$connect$0(RdbmsDataSource.java:46) ~[stardog-virtual-core-6.1.3.jar:?]
at com.complexible.stardog.virtual.vega.RuntimeDriverLoader.executeUnderClassLoader(RuntimeDriverLoader.java:124) ~[stardog-virtual-core-6.1.3.jar:?]
at com.complexible.stardog.virtual.RdbmsDataSource.connect(RdbmsDataSource.java:41) ~[stardog-virtual-core-6.1.3.jar:?]
at com.complexible.stardog.virtual.vega.rdbms.RdbmsVirtualGraphFactory.create(RdbmsVirtualGraphFactory.java:60) ~[stardog-virtual-core-6.1.3.jar:?]
at com.complexible.stardog.virtual.vega.rdbms.RdbmsVirtualGraphFactory.create(RdbmsVirtualGraphFactory.java:44) ~[stardog-virtual-core-6.1.3.jar:?]
at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry.createVirtualGraph(DefaultVirtualGraphRegistry.java:309) ~[stardog-virtual-core-6.1.3.jar:?]
at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry.createVirtualGraph(DefaultVirtualGraphRegistry.java:295) ~[stardog-virtual-core-6.1.3.jar:?]
at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry.add(DefaultVirtualGraphRegistry.java:169) ~[stardog-virtual-core-6.1.3.jar:?]
at com.complexible.stardog.virtual.SecuredVirtualGraphRegistry.add(SecuredVirtualGraphRegistry.java:133) ~[stardog-virtual-core-6.1.3.jar:?]
at com.complexible.stardog.protocols.http.server.virtual.admin.VirtualGraphHttpService.addVG(VirtualGraphHttpService.java:344) ~[stardog-virtual-protocols-http-server-6.1.3.jar:?]
at com.complexible.stardog.protocols.http.server.virtual.admin.VirtualGraphHttpService.add(VirtualGraphHttpService.java:144) ~[stardog-virtual-protocols-http-server-6.1.3.jar:?]
at com.stardog.http.server.undertow.jaxrs.ExtractRoutes.lambda$handleIt$5(ExtractRoutes.java:192) ~[stardog-protocols-http-server-6.1.3.jar:?]
at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120) [shiro-core-1.2.3.jar:1.2.3]
at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108) [shiro-core-1.2.3.jar:1.2.3]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_191]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_191]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191]
Caused by: org.postgresql.util.PSQLException: The server requested password-based authentication, but no password was provided.
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:533) ~[postgresql-42.2.5.jre7.jar:42.2.5.jre7]
at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:141) ~[postgresql-42.2.5.jre7.jar:42.2.5.jre7]
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:192) ~[postgresql-42.2.5.jre7.jar:42.2.5.jre7]
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49) ~[postgresql-42.2.5.jre7.jar:42.2.5.jre7]
at org.postgresql.jdbc.PgConnection.(PgConnection.java:195) ~[postgresql-42.2.5.jre7.jar:42.2.5.jre7]
at org.postgresql.Driver.makeConnection(Driver.java:454) ~[postgresql-42.2.5.jre7.jar:42.2.5.jre7]
at org.postgresql.Driver.connect(Driver.java:256) ~[postgresql-42.2.5.jre7.jar:42.2.5.jre7]
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:310) ~[tomcat-jdbc-9.0.2.jar:?]
at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:203) ~[tomcat-jdbc-9.0.2.jar:?]
at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:738) ~[tomcat-jdbc-9.0.2.jar:?]
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:670) ~[tomcat-jdbc-9.0.2.jar:?]
at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:482) ~[tomcat-jdbc-9.0.2.jar:?]
at org.apache.tomcat.jdbc.pool.ConnectionPool.(ConnectionPool.java:154) ~[tomcat-jdbc-9.0.2.jar:?]
at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118) ~[tomcat-jdbc-9.0.2.jar:?]
at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107) ~[tomcat-jdbc-9.0.2.jar:?]
at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:131) ~[tomcat-jdbc-9.0.2.jar:?]
at com.complexible.stardog.virtual.RdbmsDataSource.lambda$connect$0(RdbmsDataSource.java:43) ~[stardog-virtual-core-6.1.3.jar:?]
... 16 more
`

Below are connections details that I am using (concrete details replaced):

jdbc.url=jdbc:postgresql://servername/database
jdbc.driver=org.postgresql.Driver
jdbc.user=user1
jdbc.password=password

I configured the PostgreSQL Server to allow remote connections, and I am able to connect using Ontop tool as well as PgAdmin, both from my local machine.

I tried the following JDBC drivers and placed in the folder as described in Stardog documentation:

[PostgreSQL JDBC 4.2 Driver, 42.2.5] (https://jdbc.postgresql.org/download/postgresql-42.2.5.jar)

[PostgreSQL JDBC 4.1 Driver, 42.2.5.jre7] (https://jdbc.postgresql.org/download/postgresql-42.2.5.jre7.jar)

Thank you in advance.

(stephen) #2

Hi,

In your properties file, it looks like you have jdbc.user instead of jdbc.username. Try changing that out and you should be able to connect.

1 Like
(lav) #3

Hi,

I used also with jdbc.username, but the error message was the same.

Since our Stardog server is running behind a Proxy, we solved the problem based on the following link:
https://community.stardog.com/t/stardog-connection-via-http-proxy/483/2 , via putting the following command into STARDOG_JAVA_ARGS:

STARDOG_JAVA_ARGS="-Xmx2g -Xms2g -XX:MaxDirectMemorySize=1g -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=53128"

Please note, in the original link there is a tiny misspell error, instead of "-Dhttp.protyPort=53128", it should be "-Dhttp.proxyPort=53128".

Running behind a proxy caused the problem of not correctly handing federated queries, as described in the following link: https://community.stardog.com/t/unable-to-run-federated-queries/1651 . Basically, both problems are solved using the above command. I interlinked these two problems in case some else encounters them in the future.

Thank you for your support.

Unable to run federated queries