NPE on virtual graph wo username or password

I was doing some experimenting with Stardog seeing if I could get it to work with sqlite and found that Stardog throws a NPE when you don’t supply the user name in the virtual graph properties file. Granted it’s expecting a user name but I figured you didn’t want it throwing a NPE exception.

The same thing happens if you set the username but don’t set the password. Adding anything for user and password gets past this and is just ignored by Sqlite.

The good news is I was successful in getting Stardog to work against Sqlite. The only extra thing required is adding sql.schemas=main to the properties file and referencing the database as main.myDb. I was exploring Sqlite because it’s super easy to import a csv file and I wanted to do some manipulation in the mappings that just aren’t available using the csv mapping. I’m always a little conflicted with where to do my data manipulation. I always find myself wrestling with doing in the mapping or post import with sparql update queries. Another advantage to using sqlite over csv files is it makes it easier to iterate on your mappings since you don’t need to materialize the data.

java.lang.NullPointerException: null
at java.util.Hashtable.put(Hashtable.java:459) ~[?:1.8.0_131]
at java.util.Properties.setProperty(Properties.java:166) ~[?:1.8.0_131]
at org.apache.tomcat.jdbc.pool.DataSourceProxy.setUsername(DataSourceProxy.java:449) ~[tomcat-jdbc-9.0.0.M13.jar:?]
at com.complexible.stardog.virtual.vega.VegaVirtualGraph.(VegaVirtualGraph.java:99) ~[stardog-virtual-core-5.0.5.1.jar:?]
at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry._add(DefaultVirtualGraphRegistry.java:196) ~[stardog-virtual-core-5.0.5.1.jar:?]
at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry.add(DefaultVirtualGraphRegistry.java:117) ~[stardog-virtual-core-5.0.5.1.jar:?]
at com.complexible.stardog.protocols.http.server.virtual.admin.VirtualGraphHttpService.addVG(VirtualGraphHttpService.java:257) ~[stardog-virtual-protocols-http-server-5.0.5.1.jar:?]
at com.complexible.stardog.protocols.http.server.virtual.admin.VirtualGraphHttpService.add(VirtualGraphHttpService.java:105) ~[stardog-virtual-protocols-http-server-5.0.5.1.jar:?]
at com.stardog.http.server.undertow.jaxrs.ExtractRoutes.lambda$handleIt$5(ExtractRoutes.java:192) ~[stardog-protocols-http-server-5.0.5.1.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 com.stardog.http.server.undertow.ErrorHandling.lambda$safeDispatch$1(ErrorHandling.java:71) ~[stardog-protocols-http-server-5.0.5.1.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_131]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_131]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]
ERROR 2017-12-17 12:09:16,111 [XNIO-1 task-19] com.stardog.http.server.undertow.ErrorHandling:writeError(180): Unexpected error on the server
java.lang.NullPointerException: null
at java.util.Hashtable.put(Hashtable.java:459) ~[?:1.8.0_131]
at java.util.Properties.setProperty(Properties.java:166) ~[?:1.8.0_131]
at org.apache.tomcat.jdbc.pool.DataSourceProxy.setUsername(DataSourceProxy.java:449) ~[tomcat-jdbc-9.0.0.M13.jar:?]
at com.complexible.stardog.virtual.vega.VegaVirtualGraph.(VegaVirtualGraph.java:99) ~[stardog-virtual-core-5.0.5.1.jar:?]
at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry._add(DefaultVirtualGraphRegistry.java:196) ~[stardog-virtual-core-5.0.5.1.jar:?]
at com.complexible.stardog.virtual.DefaultVirtualGraphRegistry.add(DefaultVirtualGraphRegistry.java:117) ~[stardog-virtual-core-5.0.5.1.jar:?]
at com.complexible.stardog.protocols.http.server.virtual.admin.VirtualGraphHttpService.addVG(VirtualGraphHttpService.java:257) ~[stardog-virtual-protocols-http-server-5.0.5.1.jar:?]
at com.complexible.stardog.protocols.http.server.virtual.admin.VirtualGraphHttpService.add(VirtualGraphHttpService.java:105) ~[stardog-virtual-protocols-http-server-5.0.5.1.jar:?]
at com.stardog.http.server.undertow.jaxrs.ExtractRoutes.lambda$handleIt$5(ExtractRoutes.java:192) ~[stardog-protocols-http-server-5.0.5.1.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 com.stardog.http.server.undertow.ErrorHandling.lambda$safeDispatch$1(ErrorHandling.java:71) ~[stardog-protocols-http-server-5.0.5.1.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_131]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_131]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]

Thanks for the bug report Zach. I’ve created issue #4575. We’ll get this fixed soon.

Are you using this JDBC driver for SQLite: https://bitbucket.org/xerial/sqlite-jdbc

What did you do in your mappings that isn’t available in CSV mappings?

Best,
Jess

That’s the driver I was using. Nothing special, just your basic data munging. Map codes to labels, maybe split a field that has data encoded in it. Sometimes I’ll come across csv that was dumped from several database tables and will want to do a join and there’s also the benefit of not having to import the data so it makes it easier to try out mappings or catch and fix a mistake faster. I also was just wondering if it could be done.

I’ve been looking into osquery lately and thought it would be very cool if you could do a mapping there. I’m still not quite clear on what parts of sqlite osquery is using so I’m not sure if I can connect to it. I think there is a configuration option to write the database to disk and was hoping I could connect to it with the sqlite jdbc driver but they’re also using rocksdb so I’m not sure if it’s a sqlite db or they’re just using the query parser from sqlite and backing it with rocksdb, or maybe just using rocksdb for osqueryd

Alternatively I was looking at Postgresql foreign data wrappers for doing something equivalent. It would be cool if I could do it as a custom Stardog virtual graph implementation but I’m not quite sure how to approach that, unless someone would like to write up a quick tutorial in stardog-examples :wink:

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