Neo4j Spatial dependencies NoClassDefFoundError

48 views
Skip to first unread message

Sumit Shah

unread,
Aug 18, 2014, 11:48:54 PM8/18/14
to ne...@googlegroups.com
Hi,

I am new to Neo4j Spatial and trying to play with it. I have built neo4j spatial by cloning the git repo and running 'mvn clean install'. In my Java project I am pointing to this built jar and I am trying to import Washington DC's OSM file using the code below:

OSMImporter importer = new OSMImporter ("WashingtonDC");
Map<String, String> config = new HashMap<String, String>();
config.put("neostore.nodestore.db.mapped_memory", "256M" );
config.put("dump_configuration", "true");
config.put("use_memory_mapped_buffers", "true");
String dir = "/dev/neo4j-spatial/db";
BatchInserter batchInserter = BatchInserters.inserter(dir,config);

importer.importFile(batchInserter, "/downloads/dc-baltimore.osm",false);
batchInserter.shutdown();

GraphDatabaseService db = new GraphDatabaseFactory().newEmbeddedDatabase(dir);

importer.reIndex(db,10000);
db.shutdown();

However, upon running this example I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/geotools/referencing/datum/DefaultEllipsoid
at org.neo4j.gis.spatial.osm.OSMImporter.<clinit>(OSMImporter.java:68)
at com.paramiq.neo4j.spatial.SpatialOSMImport.main(SpatialOSMImport.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.lang.ClassNotFoundException: org.geotools.referencing.datum.DefaultEllipsoid
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 7 more

I am guessing a dependency issue. I would appreciate any help.

Thanks
Sumit

Peter Neubauer

unread,
Aug 19, 2014, 1:28:14 AM8/19/14
to Neo4j User

Sumit,
Are you using maven? In that case what does

mvn dependency:tree

Look like?

/peter

(snt)-[:frm]->(phn)

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Craig Taverner

unread,
Aug 19, 2014, 7:28:52 AM8/19/14
to ne...@googlegroups.com
Looks like some geotools libraries are missing. If you use maven, the dependencies should be sorted out for you. But if not, you can also look at the every end of the README at https://github.com/neo4j-contrib/spatial for some hints at how to get to the dependencies manually.
Reply all
Reply to author
Forward
0 new messages