# Adding postgresql vg with blank password throws error

**URL:** https://community.stardog.com/t/adding-postgresql-vg-with-blank-password-throws-error/1947
**Category:** Support
**Created:** [September 27, 2019, 10:23pm UTC](https://community.stardog.com/t/adding-postgresql-vg-with-blank-password-throws-error/1947 "2019-09-27T22:23:11Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)
#### Post date: [September 27, 2019, 10:23pm UTC](https://community.stardog.com/t/adding-postgresql-vg-with-blank-password-throws-error/1947/1 "2019-09-27T22:23:11Z")

</div>

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]
```

---

<div class="post-metadata">

### Author: ![jess](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/jess/32/10_2.png) [@jess](https://community.stardog.com/u/jess)
#### Post date: [September 27, 2019, 10:27pm UTC](https://community.stardog.com/t/adding-postgresql-vg-with-blank-password-throws-error/1947/2 "2019-09-27T22:27:30Z")

</div>

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

---

<div class="post-metadata">

### Author: ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)
#### Post date: [September 27, 2019, 10:52pm UTC](https://community.stardog.com/t/adding-postgresql-vg-with-blank-password-throws-error/1947/3 "2019-09-27T22:52:44Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![jess](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/jess/32/10_2.png) [@jess](https://community.stardog.com/u/jess)
#### Post date: [September 27, 2019, 11:14pm UTC](https://community.stardog.com/t/adding-postgresql-vg-with-blank-password-throws-error/1947/4 "2019-09-27T23:14:45Z")

</div>

I remember somebody mentioning this previously. 🙂 [NPE on virtual graph wo username or password](https://community.stardog.com/t/npe-on-virtual-graph-wo-username-or-password/737)

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

---

<div class="post-metadata">

### Author: ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)
#### Post date: [September 28, 2019, 2:57pm UTC](https://community.stardog.com/t/adding-postgresql-vg-with-blank-password-throws-error/1947/5 "2019-09-28T14:57:46Z")

</div>

That report sounds familiar 😉

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.

---

<div class="post-metadata">

### Author: ![jess](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/jess/32/10_2.png) [@jess](https://community.stardog.com/u/jess)
#### Post date: [September 28, 2019, 3:04pm UTC](https://community.stardog.com/t/adding-postgresql-vg-with-blank-password-throws-error/1947/6 "2019-09-28T15:04:44Z")

</div>

Can you share the error when you provide the port?

---

<div class="post-metadata">

### Author: ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)
#### Post date: [September 28, 2019, 3:08pm UTC](https://community.stardog.com/t/adding-postgresql-vg-with-blank-password-throws-error/1947/7 "2019-09-28T15:08:21Z")

</div>

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

---

<div class="post-metadata">

### Author: ![jess](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/jess/32/10_2.png) [@jess](https://community.stardog.com/u/jess)
#### Post date: [September 28, 2019, 3:18pm UTC](https://community.stardog.com/t/adding-postgresql-vg-with-blank-password-throws-error/1947/8 "2019-09-28T15:18:29Z")

</div>

So it's working without a password?

---

<div class="post-metadata">

### Author: ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)
#### Post date: [September 28, 2019, 6:38pm UTC](https://community.stardog.com/t/adding-postgresql-vg-with-blank-password-throws-error/1947/9 "2019-09-28T18:38:31Z")

</div>

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

---

<div class="post-metadata">

### Author: ![jess](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/jess/32/10_2.png) [@jess](https://community.stardog.com/u/jess)
#### Post date: [September 28, 2019, 7:17pm UTC](https://community.stardog.com/t/adding-postgresql-vg-with-blank-password-throws-error/1947/10 "2019-09-28T19:17:31Z")

</div>

Can you remove the password line?

---

<div class="post-metadata">

### Author: ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)
#### Post date: [September 28, 2019, 8:28pm UTC](https://community.stardog.com/t/adding-postgresql-vg-with-blank-password-throws-error/1947/11 "2019-09-28T20:28:54Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![jess](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/jess/32/10_2.png) [@jess](https://community.stardog.com/u/jess)
#### Post date: [October 1, 2019, 11:00pm UTC](https://community.stardog.com/t/adding-postgresql-vg-with-blank-password-throws-error/1947/12 "2019-10-01T23:00:28Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)
#### Post date: [October 1, 2019, 11:44pm UTC](https://community.stardog.com/t/adding-postgresql-vg-with-blank-password-throws-error/1947/13 "2019-10-01T23:44:42Z")

</div>

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=

---

<div class="post-metadata">

### Author: ![jess](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/jess/32/10_2.png) [@jess](https://community.stardog.com/u/jess)
#### Post date: [October 2, 2019, 12:02am UTC](https://community.stardog.com/t/adding-postgresql-vg-with-blank-password-throws-error/1947/14 "2019-10-02T00:02:25Z")

</div>

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

---

<div class="post-metadata">

### Author: ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)
#### Post date: [October 2, 2019, 12:49pm UTC](https://community.stardog.com/t/adding-postgresql-vg-with-blank-password-throws-error/1947/15 "2019-10-02T12:49:27Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![jess](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/jess/32/10_2.png) [@jess](https://community.stardog.com/u/jess)
#### Post date: [October 4, 2019, 12:52am UTC](https://community.stardog.com/t/adding-postgresql-vg-with-blank-password-throws-error/1947/16 "2019-10-04T00:52:07Z")

</div>

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

---

<div class="post-metadata">

### Author: ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)
#### Post date: [October 18, 2019, 12:52am UTC](https://community.stardog.com/t/adding-postgresql-vg-with-blank-password-throws-error/1947/17 "2019-10-18T00:52:11Z")

</div>

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