[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[geomesa-users] Using the Java API - NoClassDefFoundError
|
Hello, I am trying to get some basic functionality for writing and reading with GeoMesa from Java. I'm working from documentation.pdf in the geomesa-dist/target area.
I've extracted geomesa/geomesa-dist/target/geomesa-dist-1.0.0-SNAPSHOT-distribution.tar.gz after doing a Maven install, and then I have placed all of the subdirectories from there in my Java classpath (according to Section 2.3 in the documentation).
Then I wrote a small Java program that just creates a DataStore like in Section 3, which builds with no errors - however when running it there are many errors. I am just trying a mock Accumulo instance for now, but I do have Accumulo, Hadoop, and Zookeeper installed.
It looks like the root cause of the failure is "java.lang.ClassNotFoundException: org.apache.hadoop.io.Writable". Do I need to add libraries from my Hadoop installation in addition to the HDFS jar in geomesa-dist?
Attached are my simple Java file I'm trying to run, the terminal output, and brief build/run scripts to demonstrate what my classpath looks like.
Thanks for any pointers in the right direction,
Connor
#!/bin/bash
cp=~/code/geomesa/geomesa-dist/target/*
cp+=:~/code/geomesa/geomesa-dist/target/geomesa-dist-1.0.0-SNAPSHOT-distribution/*
cp+=:~/code/geomesa/geomesa-dist/target/geomesa-dist-1.0.0-SNAPSHOT-distribution/hdfs/*
cp+=:~/code/geomesa/geomesa-dist/target/geomesa-dist-1.0.0-SNAPSHOT-distribution/dev/lib/*
cp+=:~/code/geomesa/geomesa-dist/target/geomesa-dist-1.0.0-SNAPSHOT-distribution/geoserver/WEB-INF/lib/*
cp+=:~/code/geomesa/geomesa-dist/target/geomesa-dist-1.0.0-SNAPSHOT-distribution/accumulo/lib/ext/*
cp+=:.
javac -classpath $cp geo.java
Attachment:
geo.java
Description: Binary data
~/code/test/geomesa $ ./build
~/code/test/geomesa $ ./run
May 17, 2014 2:08:17 PM org.geotools.factory.FactoryRegistry scanForPlugins
WARNING: Can't load a service for category "DataStoreFactorySpi". Cause is "ServiceConfigurationError: org.geotools.data.DataStoreFactorySpi: Provider geomesa.core.data.AccumuloDataStoreFactory could not be instantiated".
java.util.ServiceConfigurationError: org.geotools.data.DataStoreFactorySpi: Provider geomesa.core.data.AccumuloDataStoreFactory could not be instantiated
at java.util.ServiceLoader.fail(ServiceLoader.java:224)
at java.util.ServiceLoader.access$100(ServiceLoader.java:181)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:377)
at java.util.ServiceLoader$1.next(ServiceLoader.java:445)
at org.geotools.factory.FactoryRegistry.register(FactoryRegistry.java:826)
at org.geotools.factory.FactoryRegistry.scanForPlugins(FactoryRegistry.java:772)
at org.geotools.factory.FactoryRegistry.scanForPluginsIfNeeded(FactoryRegistry.java:805)
at org.geotools.factory.FactoryRegistry.getServiceProviders(FactoryRegistry.java:196)
at org.geotools.data.DataAccessFinder.getAvailableDataStores(DataAccessFinder.java:207)
at org.geotools.data.DataStoreFinder.getAvailableDataStores(DataStoreFinder.java:116)
at org.geotools.data.DataStoreFinder.getDataStore(DataStoreFinder.java:87)
at geo.createDataStore(geo.java:36)
at geo.main(geo.java:13)
Caused by: java.lang.NoClassDefFoundError: org/apache/hadoop/io/Writable
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
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)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493)
at java.lang.Class.getConstructor0(Class.java:2803)
at java.lang.Class.newInstance(Class.java:345)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:373)
... 10 more
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.io.Writable
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)
... 27 more
May 17, 2014 2:08:17 PM org.geotools.factory.FactoryRegistry scanForPlugins
WARNING: Can't load a service for category "DataStoreFactorySpi". Cause is "ServiceConfigurationError: org.geotools.data.DataStoreFactorySpi: Provider geomesa.core.data.AccumuloDataStoreFactory could not be instantiated".
java.util.ServiceConfigurationError: org.geotools.data.DataStoreFactorySpi: Provider geomesa.core.data.AccumuloDataStoreFactory could not be instantiated
at java.util.ServiceLoader.fail(ServiceLoader.java:224)
at java.util.ServiceLoader.access$100(ServiceLoader.java:181)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:377)
at java.util.ServiceLoader$1.next(ServiceLoader.java:445)
at org.geotools.factory.FactoryRegistry.register(FactoryRegistry.java:826)
at org.geotools.factory.FactoryRegistry.scanForPlugins(FactoryRegistry.java:772)
at org.geotools.factory.FactoryRegistry.scanForPluginsIfNeeded(FactoryRegistry.java:805)
at org.geotools.factory.FactoryRegistry.getServiceProviders(FactoryRegistry.java:196)
at org.geotools.data.DataAccessFinder.getAvailableDataStores(DataAccessFinder.java:207)
at org.geotools.data.DataStoreFinder.getAvailableDataStores(DataStoreFinder.java:116)
at org.geotools.data.DataStoreFinder.getDataStore(DataStoreFinder.java:87)
at geo.createDataStore(geo.java:36)
at geo.main(geo.java:13)
Caused by: java.lang.NoClassDefFoundError: org/apache/hadoop/io/Writable
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
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)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493)
at java.lang.Class.getConstructor0(Class.java:2803)
at java.lang.Class.newInstance(Class.java:345)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:373)
... 10 more
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.io.Writable
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)
... 27 more
May 17, 2014 2:08:17 PM org.geotools.factory.FactoryRegistry scanForPlugins
WARNING: Can't load a service for category "DataStoreFactorySpi". Cause is "ServiceConfigurationError: org.geotools.data.DataStoreFactorySpi: Provider geomesa.core.data.AccumuloDataStoreFactory could not be instantiated".
java.util.ServiceConfigurationError: org.geotools.data.DataStoreFactorySpi: Provider geomesa.core.data.AccumuloDataStoreFactory could not be instantiated
at java.util.ServiceLoader.fail(ServiceLoader.java:224)
at java.util.ServiceLoader.access$100(ServiceLoader.java:181)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:377)
at java.util.ServiceLoader$1.next(ServiceLoader.java:445)
at org.geotools.factory.FactoryRegistry.register(FactoryRegistry.java:826)
at org.geotools.factory.FactoryRegistry.scanForPlugins(FactoryRegistry.java:772)
at org.geotools.factory.FactoryRegistry.scanForPluginsIfNeeded(FactoryRegistry.java:805)
at org.geotools.factory.FactoryRegistry.getServiceProviders(FactoryRegistry.java:196)
at org.geotools.data.DataAccessFinder.getAvailableDataStores(DataAccessFinder.java:207)
at org.geotools.data.DataStoreFinder.getAvailableDataStores(DataStoreFinder.java:116)
at org.geotools.data.DataStoreFinder.getDataStore(DataStoreFinder.java:87)
at geo.createDataStore(geo.java:36)
at geo.main(geo.java:13)
Caused by: java.lang.NoClassDefFoundError: org/apache/hadoop/io/Writable
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
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)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493)
at java.lang.Class.getConstructor0(Class.java:2803)
at java.lang.Class.newInstance(Class.java:345)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:373)
... 10 more
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.io.Writable
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)
... 27 more
May 17, 2014 2:08:17 PM org.geotools.factory.FactoryRegistry scanForPlugins
WARNING: Can't load a service for category "DataStoreFactorySpi". Cause is "ServiceConfigurationError: org.geotools.data.DataStoreFactorySpi: Provider geomesa.core.data.AccumuloDataStoreFactory could not be instantiated".
java.util.ServiceConfigurationError: org.geotools.data.DataStoreFactorySpi: Provider geomesa.core.data.AccumuloDataStoreFactory could not be instantiated
at java.util.ServiceLoader.fail(ServiceLoader.java:224)
at java.util.ServiceLoader.access$100(ServiceLoader.java:181)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:377)
at java.util.ServiceLoader$1.next(ServiceLoader.java:445)
at org.geotools.factory.FactoryRegistry.register(FactoryRegistry.java:826)
at org.geotools.factory.FactoryRegistry.scanForPlugins(FactoryRegistry.java:772)
at org.geotools.factory.FactoryRegistry.scanForPluginsIfNeeded(FactoryRegistry.java:805)
at org.geotools.factory.FactoryRegistry.getServiceProviders(FactoryRegistry.java:196)
at org.geotools.data.DataAccessFinder.getAvailableDataStores(DataAccessFinder.java:207)
at org.geotools.data.DataStoreFinder.getAvailableDataStores(DataStoreFinder.java:116)
at org.geotools.data.DataStoreFinder.getDataStore(DataStoreFinder.java:87)
at geo.createDataStore(geo.java:36)
at geo.main(geo.java:13)
Caused by: java.lang.NoClassDefFoundError: org/apache/hadoop/io/Writable
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
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)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493)
at java.lang.Class.getConstructor0(Class.java:2803)
at java.lang.Class.newInstance(Class.java:345)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:373)
... 10 more
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.io.Writable
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)
... 27 more
#!/bin/bash
cp=~/code/geomesa/geomesa-dist/target/*
cp+=:~/code/geomesa/geomesa-dist/target/geomesa-dist-1.0.0-SNAPSHOT-distribution/*
cp+=:~/code/geomesa/geomesa-dist/target/geomesa-dist-1.0.0-SNAPSHOT-distribution/hdfs/*
cp+=:~/code/geomesa/geomesa-dist/target/geomesa-dist-1.0.0-SNAPSHOT-distribution/dev/lib/*
cp+=:~/code/geomesa/geomesa-dist/target/geomesa-dist-1.0.0-SNAPSHOT-distribution/geoserver/WEB-INF/lib/*
cp+=:~/code/geomesa/geomesa-dist/target/geomesa-dist-1.0.0-SNAPSHOT-distribution/accumulo/lib/ext/*
cp+=:.
java -classpath $cp geo