# Error when creating a DB with geospatial data

**URL:** <https://community.stardog.com/t/error-when-creating-a-db-with-geospatial-data/369>\
**Category:** Support\
**Created:** [May 31, 2017, 2:53pm UTC](https://community.stardog.com/t/error-when-creating-a-db-with-geospatial-data/369 "2017-05-31T14:53:14Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kris](https://avatars.discourse-cdn.com/v4/letter/k/82dd89/32.png) [@Kris](https://community.stardog.com/u/Kris)\
**Post date:** [May 31, 2017, 2:53pm UTC](https://community.stardog.com/t/error-when-creating-a-db-with-geospatial-data/369/1 "2017-05-31T14:53:14Z")

</div>

Hi There,

I recently set up STARDOG (on windows 🙂 and I am attempting to upload two RDF graphs with geospatial data. I follow the instructions (and also those provided by Stephen Nowell on stackoverflow) as follows.

I downloaded the developer edition. I created a stardog.properties file and set spatial.use.jts=true. I saved JTS JAR in several folders (home, server, and servers three subfolders) as it is still not clear to me which folder is the classpath and hence where I need to have the JAR.

I then started a stardog server, and ran the following command: stardog-admin db create -n myDb x.ttl y.ttl -o spatial.enabled=true –

I then get the following line in the command line: com/vividsolutions/jts/geom/Geometry

And the following error in the log:

java.lang.NoClassDefFoundError: com/vividsolutions/jts/geom/Geometry  
at com.complexible.stardog.spatial.impl.LuceneGeospatialIndex.(LuceneGeospatialIndex.java:65) ~[stardog-spatial-core-5.0-beta.jar:?]  
at com.complexible.stardog.spatial.impl.LuceneGeospatialIndexFactory.open(LuceneGeospatialIndexFactory.java:59) ~[stardog-spatial-core-5.0-beta.jar:?]  
at com.complexible.stardog.spatial.db.GeospatialConnectableFactory.create(GeospatialConnectableFactory.java:77) ~[stardog-spatial-core-5.0-beta.jar:?]  
at com.complexible.stardog.db.DatabaseImpl.createConnectables(DatabaseImpl.java:308) ~[stardog-5.0-beta.jar:?]  
at com.complexible.stardog.db.DatabaseImpl.initializeConnectables(DatabaseImpl.java:468) ~[stardog-5.0-beta.jar:?]  
at com.complexible.stardog.db.DatabaseImpl.initializeConnectables(DatabaseImpl.java:464) ~[stardog-5.0-beta.jar:?]  
at com.complexible.stardog.db.DatabaseImpl.initialize(DatabaseImpl.java:745) ~[stardog-5.0-beta.jar:?]  
at com.complexible.stardog.StardogKernel.createDatabase(StardogKernel.java:2389) ~[stardog-5.0-beta.jar:?]  
at com.complexible.stardog.StardogKernel.createDatabase(StardogKernel.java:1267) ~[stardog-5.0-beta.jar:?]  
at com.complexible.stardog.protocols.http.server.AdminDatabaseService.createNewDatabase(AdminDatabaseService.java:432) ~[stardog-protocols-http-server-5.0-beta.jar:?]  
at com.stardog.http.server.undertow.jaxrs.ExtractRoutes.lambda$handleIt$81(ExtractRoutes.java:183) ~[stardog-protocols-http-server-5.0-beta.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$43(ErrorHandling.java:70) ~[stardog-protocols-http-server-5.0-beta.jar:?]  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0\_111]  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0\_111]  
at java.lang.Thread.run(Thread.java:745) [?:1.8.0\_111]  
Caused by: java.lang.ClassNotFoundException: com.vividsolutions.jts.geom.Geometry  
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[?:1.8.0\_111]  
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0\_111]  
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[?:1.8.0\_111]  
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0\_111]  
… 17 more

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [May 31, 2017, 3:13pm UTC](https://community.stardog.com/t/error-when-creating-a-db-with-geospatial-data/369/2 "2017-05-31T15:13:29Z")

</div>

Hi,

It looks like the ordering on your CLI command is a little bit off. The input files need to be the last things passed in. Try `stardog-admin db create -n myDb -o spatial.enabled=true -- x.ttl y.ttl` and see if that gives you anything different.

---

<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:** [May 31, 2017, 3:24pm UTC](https://community.stardog.com/t/error-when-creating-a-db-with-geospatial-data/369/3 "2017-05-31T15:24:51Z")

</div>

> [@Kris](#):
>
> I recently set up STARDOG (on windows ...

No worries. You've got the right dog, just the wrong doghouse 🙂

Where did you put your stardog.properties file? It should be located in the Stardog home directory (%STARDOG\_HOME% in your case)

It seems like the most likely explanation is you haven't successfully gotten the jts jar in classpath. You can technically put it in any directory that is in the class path with would include any directory under %STARDOG\_HOME%/server/ with the most logical on being %STARDOG\_HOME%/server/dbms . If you want to keep third party jars separate from your installation you can also create the directory ext (%STARDOG\_HOME%/server/ext) and put it in there.

The command you're using to create the database is a little mixed up. It should be

`stardog-admin db create -n myDb -o spatial.enabled=true -- x.tty y.tty`

What exact version of jts did you grab? I believe you should be using jts-core-1.14.0.jar but I've never had that officially confirmed. You can grab the jar out of maven central [http://search.maven.org/remotecontent?filepath=com/vividsolutions/jts-core/1.14.0/jts-core-1.14.0.jar](http://search.maven.org/remotecontent?filepath=com/vividsolutions/jts-core/1.14.0/jts-core-1.14.0.jar)

---

<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:** [May 31, 2017, 3:39pm UTC](https://community.stardog.com/t/error-when-creating-a-db-with-geospatial-data/369/4 "2017-05-31T15:39:37Z")

</div>

I mentioned the JTS version because the vividsolutions website was not being updated and listed an old version but it looks like JTS has found a new sponsor and is being hosted at github [GitHub - locationtech/jts: The JTS Topology Suite is a Java library for creating and manipulating vector geometry.](https://github.com/locationtech/jts) under a new license.

> JTS is open source software. It is dual-licensed under:

> ```
> Eclipse Public License 1.0
> Eclipse Distribution License 1.0 (a BSD Style License)
> 
> ```

I'm not familiar with wth Eclipse Distribution License but hopefully being a BSD Style license might mean it can be included with Stardog

---

<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:** [June 1, 2017, 1:40pm UTC](https://community.stardog.com/t/error-when-creating-a-db-with-geospatial-data/369/5 "2017-06-01T13:40:26Z")

</div>

I think I see why you were putting the jar in the server directory. The [documentation](http://www.stardog.com/docs/#_enhanced_polygons) has a line

> To enable support for these more complex shapes, download JTS and include the JAR in Stardog’s server classpath.

I don't think that the server directory is actually included in the class path but all the directories contained in the server directory are included. That might require an update to the documentation.

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [June 1, 2017, 1:46pm UTC](https://community.stardog.com/t/error-when-creating-a-db-with-geospatial-data/369/6 "2017-06-01T13:46:37Z")

</div>

> [@zachary.whitley](#):
>
> I don't think that the server directory is actually included in the class path but all the directories contained in the server directory are included. That might require an update to the documentation.

This is correct. It should probably say `server/ext`, though any of the subfolders will be included on the classpath by default. Thanks for pointing this out.

---

<div class="post-metadata">

**Author:** ![evren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/evren/32/1515_2.png) [@evren](https://community.stardog.com/u/evren)\
**Post date:** [June 1, 2017, 1:50pm UTC](https://community.stardog.com/t/error-when-creating-a-db-with-geospatial-data/369/7 "2017-06-01T13:50:33Z")

</div>

Another thing missing in the documentation is that you can set the STARDOG\_EXT environment variable to point to a directory that contains the external jar files. Using a fixed location outside Stardog installation directory makes it easier to upgrade to a new version without copying those jar files.

Best,  
Evren

---

<div class="post-metadata">

**Author:** ![Kris](https://avatars.discourse-cdn.com/v4/letter/k/82dd89/32.png) [@Kris](https://community.stardog.com/u/Kris)\
**Post date:** [June 1, 2017, 3:36pm UTC](https://community.stardog.com/t/error-when-creating-a-db-with-geospatial-data/369/8 "2017-06-01T15:36:47Z")

</div>

Hi Stephen,

This actually fixed the problem. Sorry about the late reply, but I started indexing a large file yesterday and wanted to make sure it worked, and it is working! 🙂

Thanks a lot,

Kris.

---

<div class="post-metadata">

**Author:** ![Kris](https://avatars.discourse-cdn.com/v4/letter/k/82dd89/32.png) [@Kris](https://community.stardog.com/u/Kris)\
**Post date:** [June 1, 2017, 3:38pm UTC](https://community.stardog.com/t/error-when-creating-a-db-with-geospatial-data/369/9 "2017-06-01T15:38:49Z")

</div>

Thanks for all these suggestions. While Stephens helped me fix the problem, I think for others who might hit the same issues, these comments should be helpful!

Kind regards,

Kris.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [June 15, 2017, 3:39pm UTC](https://community.stardog.com/t/error-when-creating-a-db-with-geospatial-data/369/10 "2017-06-15T15:39:34Z")

</div>

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