Adding postgresql vg with blank password throws error

I went to add a virtual graph without entering a password and noticed that Stardog would throw an NumberFormatException.

ERROR 2019-09-27 18:19:22,896 [stardog-user-2] com.stardog.http.server.undertow.ErrorHandling:writeError(138): Unexpected error on the server
java.lang.NumberFormatException: null
        at java.lang.Integer.parseInt(Integer.java:542) ~[?:1.8.0_222]
        at java.lang.Integer.valueOf(Integer.java:766) ~[?:1.8.0_222]
        at com.complexible.stardog.virtual.vega.rdbms.RdbmsDataSource.determineCredentials(RdbmsDataSource.java:144) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.vega.rdbms.RdbmsDataSource.create(RdbmsDataSource.java:100) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.vega.rdbms.RdbmsVirtualGraphFactory.create(RdbmsVirtualGraphFactory.java:62) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.vega.rdbms.RdbmsVirtualGraphFactory.create(RdbmsVirtualGraphFactory.java:48) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry.createVirtualGraph(DefaultVirtualGraphRegistry.java:349) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry.createVirtualGraph(DefaultVirtualGraphRegistry.java:335) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry.add(DefaultVirtualGraphRegistry.java:196) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.SecuredVirtualGraphRegistry.add(SecuredVirtualGraphRegistry.java:146) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.protocols.http.server.virtual.admin.VirtualGraphHttpService.addVG(VirtualGraphHttpService.java:391) ~[stardog-virtual-protocols-http-server-7.0.1.jar:?]
        at com.complexible.stardog.protocols.http.server.virtual.admin.VirtualGraphHttpService.add(VirtualGraphHttpService.java:193) ~[stardog-virtual-protocols-http-server-7.0.1.jar:?]
        at com.stardog.http.server.undertow.jaxrs.ExtractRoutes.lambda$handleIt$5(ExtractRoutes.java:192) ~[stardog-protocols-http-server-7.0.1.jar:?]
        at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120) [shiro-core-1.3.0.jar:1.3.0]
        at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108) [shiro-core-1.3.0.jar:1.3.0]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]

Can you try adding the port in your jdbc.url?

Adding the port not longer returns the number format exception and fails on the password with is expected. The only odd thing is that if the port isn't there and the password is everything is fine.

I remember somebody mentioning this previously. :slight_smile: NPE on virtual graph wo username or password

We fixed it I'm not seeing any issue. Can you share the stack from the error log?

That report sounds familiar :wink:

I'll try to describe everything as well as possible.

Stardog 7.0.1
CentOS 7
Postgresql 9.2.24
Postgresql jdbc driver 42.2.5

Postgresql is setup for md5 auth from localhost and I have a .pgpass file setup, although I don't think that matters but I thought I'd mention it.

properties file geonames.properties

jdbc.url=jdbc:postgresql://localhost/geonames
jdbc.username=postgres
jdbc.password=
jdbc.driver=org.postgresql.Driver

It looks like you can use an empty mapping file and you'll still get the error.

$> stardog-admin virtual add geonames.properties geonames.ttl

result

$> null

Stack trace

java.lang.NumberFormatException: null
        at java.lang.Integer.parseInt(Integer.java:542) ~[?:1.8.0_222]
        at java.lang.Integer.valueOf(Integer.java:766) ~[?:1.8.0_222]
        at com.complexible.stardog.virtual.vega.rdbms.RdbmsDataSource.determineCredentials(RdbmsDataSource.java:144) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.vega.rdbms.RdbmsDataSource.create(RdbmsDataSource.java:100) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.vega.rdbms.RdbmsVirtualGraphFactory.create(RdbmsVirtualGraphFactory.java:62) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.vega.rdbms.RdbmsVirtualGraphFactory.create(RdbmsVirtualGraphFactory.java:48) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry.createVirtualGraph(DefaultVirtualGraphRegistry.java:349) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry.createVirtualGraph(DefaultVirtualGraphRegistry.java:335) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry.add(DefaultVirtualGraphRegistry.java:196) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.SecuredVirtualGraphRegistry.add(SecuredVirtualGraphRegistry.java:146) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.protocols.http.server.virtual.admin.VirtualGraphHttpService.addVG(VirtualGraphHttpService.java:391) ~[stardog-virtual-protocols-http-server-7.0.1.jar:?]
        at com.complexible.stardog.protocols.http.server.virtual.admin.VirtualGraphHttpService.add(VirtualGraphHttpService.java:193) ~[stardog-virtual-protocols-http-server-7.0.1.jar:?]
        at com.stardog.http.server.undertow.jaxrs.ExtractRoutes.lambda$handleIt$5(ExtractRoutes.java:192) ~[stardog-protocols-http-server-7.0.1.jar:?]
        at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120) [shiro-core-1.3.0.jar:1.3.0]
        at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108) [shiro-core-1.3.0.jar:1.3.0]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]
ERROR 2019-09-28 10:50:24,765 [stardog-user-8] com.stardog.http.server.undertow.ErrorHandling:writeError(138): Unexpected error on the server
java.lang.NumberFormatException: null
        at java.lang.Integer.parseInt(Integer.java:542) ~[?:1.8.0_222]
        at java.lang.Integer.valueOf(Integer.java:766) ~[?:1.8.0_222]
        at com.complexible.stardog.virtual.vega.rdbms.RdbmsDataSource.determineCredentials(RdbmsDataSource.java:144) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.vega.rdbms.RdbmsDataSource.create(RdbmsDataSource.java:100) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.vega.rdbms.RdbmsVirtualGraphFactory.create(RdbmsVirtualGraphFactory.java:62) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.vega.rdbms.RdbmsVirtualGraphFactory.create(RdbmsVirtualGraphFactory.java:48) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry.createVirtualGraph(DefaultVirtualGraphRegistry.java:349) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry.createVirtualGraph(DefaultVirtualGraphRegistry.java:335) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry.add(DefaultVirtualGraphRegistry.java:196) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.virtual.SecuredVirtualGraphRegistry.add(SecuredVirtualGraphRegistry.java:146) ~[stardog-virtual-core-7.0.1.jar:?]
        at com.complexible.stardog.protocols.http.server.virtual.admin.VirtualGraphHttpService.addVG(VirtualGraphHttpService.java:391) ~[stardog-virtual-protocols-http-server-7.0.1.jar:?]
        at com.complexible.stardog.protocols.http.server.virtual.admin.VirtualGraphHttpService.add(VirtualGraphHttpService.java:193) ~[stardog-virtual-protocols-http-server-7.0.1.jar:?]
        at com.stardog.http.server.undertow.jaxrs.ExtractRoutes.lambda$handleIt$5(ExtractRoutes.java:192) ~[stardog-protocols-http-server-7.0.1.jar:?]
        at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120) [shiro-core-1.3.0.jar:1.3.0]
        at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108) [shiro-core-1.3.0.jar:1.3.0]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]

I'm working on a Stardog demo with mapping geonames. It's interesting to take a close look at it. I've only ever used the supplied rdf dump. It's not in the greatest shape. It's missing mappings for a lot of data, many of the mappings could be done better to support cross dataset linking, etc. I 'm planning on posting it here when I'm done.

Can you share the error when you provide the port?

I'm not getting an error when I add the port.

So it's working without a password?

I should have added that. No, if there is no password and no port it returns

FATAL: password authentication failed for user "postgres"

as expected. If you remove the port you get the NumberFormatException

Can you remove the password line?

If you completely remove the jdbc.password line you get the same behavior. If you have the port you get a "password authentication failed..." error and if you don't have the port you the the number format exception.

I'm not able to reproduce this. Just to step back, let's assume you've specified the port. That issue is clear. I assume you can login to this Postgres account without a password? Whether or not you include the jdbc.password= entry in the properties file, you're encountering an "auth failed" error?

I have a user, postgres, that is setup to require a password when logging into localhost

psql -U postgres -h localhost

It prompts for a password and I can log in.

if you use the following properties file

jdbc.url=jdbc:postgresql://localhost/geonames
jdbc.username=postgres
jdbc.driver=org.postgresql.Driver
jdbc.password=

With or without the jdbc.password line it returns "null" at the command line and there is a NumberFormatException in the logs

if you use the following properties file with the port it works as expected returning "password authentication failed" if you leave jdbc.password empty or adds the mappings if you add the correct password.

jdbc.url=jdbc:postgresql://localhost:5432/geonames
jdbc.username=postgres
jdbc.driver=org.postgresql.Driver
jdbc.password=

so if we fix the port issue, is there still something wrong here?

No that's it. It's a corner case if you're using md5 auth with postgres because it's not going to work without a password anyway but it is an issue if you set the postgres auth to trust. In that case you're not expecting to have to use a password. I tested it with "trust" authentication with postgres and you still get the NumberFormatException when you don't supply the port.

Thanks. Makes sense now. We'll get it fixed.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.