Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [geomesa-users] Using the Java API - NoClassDefFoundError

I've got the project demonstrating all the functionality from the tutorial in geomesa-dist to compile completely.  I did also have to add:

    <dependency>
    <groupId>org.apache.accumulo</groupId>
    <artifactId>accumulo-core</artifactId>
    <version>1.5.1</version>
    </dependency>

However, now I'm hitting an exception at run-time trying to create a FeatureType:

log4j:WARN No appenders could be found for logger (org.apache.hadoop.conf.Configuration.deprecation).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
2014-05-22 19:21:58.181 java[2387:1903] Unable to load realm info from SCDynamicStore
Exception in thread "main" java.lang.ExceptionInInitializerError
at geomesa.core.data.AccumuloDataStore.writeMetadata(AccumuloDataStore.scala:112)
at geomesa.core.data.AccumuloDataStore.createSchema(AccumuloDataStore.scala:101)
at geomesa.core.data.AccumuloDataStore.createSchema(AccumuloDataStore.scala:54)
at con.geo.App.createFeatureType(App.java:88)
at con.geo.App.main(App.java:33)
Caused by: org.geotools.feature.SchemaException: Error decoding srs: 4326
at org.geotools.data.DataUtilities.createAttribute(DataUtilities.java:2649)
at org.geotools.data.DataUtilities.createType(DataUtilities.java:1928)
at org.geotools.data.DataUtilities.createType(DataUtilities.java:1901)
at geomesa.core.index.package$.<init>(index.scala:43)
at geomesa.core.index.package$.<clinit>(index.scala)
... 5 more
Caused by: org.opengis.referencing.NoSuchAuthorityCodeException: No code "EPSG:4326" from authority "EPSG" found for object of type "EngineeringCRS".
at org.geotools.referencing.factory.epsg.CartesianAuthorityFactory.noSuchAuthorityException(CartesianAuthorityFactory.java:136)
at org.geotools.referencing.factory.epsg.CartesianAuthorityFactory.createEngineeringCRS(CartesianAuthorityFactory.java:130)
at org.geotools.referencing.factory.epsg.CartesianAuthorityFactory.createCoordinateReferenceSystem(CartesianAuthorityFactory.java:121)
at org.geotools.referencing.factory.AuthorityFactoryAdapter.createCoordinateReferenceSystem(AuthorityFactoryAdapter.java:801)
at org.geotools.referencing.factory.ThreadedAuthorityFactory.createCoordinateReferenceSystem(ThreadedAuthorityFactory.java:731)
at org.geotools.referencing.DefaultAuthorityFactory.createCoordinateReferenceSystem(DefaultAuthorityFactory.java:179)
at org.geotools.referencing.CRS.decode(CRS.java:514)
at org.geotools.referencing.CRS.decode(CRS.java:442)
at org.geotools.data.DataUtilities.createAttribute(DataUtilities.java:2646)
... 9 more

I've attached the Java file here.  It is basically identical to the documentation, createFeatureType() succeeds, but createFeature() throws the above exception.  One thing I noticed is that the documentation refers to "IndexEntryType.getTypeSpec()", which is appended to the Feature Schema, but that does not appear to be provided by GeoMesa currently.  The only reference to it in the current codebase is in a unit test.  I'm not sure if my errors are caused because my feature schema is missing some essential types.

I have tried this both with a mock Accumulo instance and with references to a real one, and this exception output is from the mock instance.  When using a real instance of Accumulo (running on localhost) the program hangs, presumably on dataStore.createSchema() and produces no output.

Thank you once again for any ideas you may have,
Connor


On Thu, May 22, 2014 at 8:29 AM, Hunter Provyn <fhp@xxxxxxxx> wrote:
Connor,

You are welcome, I'm glad that did it.

You need the geomesa-core artifact.
We have recently changed the way we support accumulo version and the name of the artifact for accumulo1.5 is:

<dependency>
    <groupId>geomesa</groupId>
    <artifactId>geomesa-core-accumulo1.5</artifactId>
    <version>1.0.0-SNAPSHOT</version>
</dependency>

Hunter


On 05/21/2014 07:47 PM, Connor Manning wrote:
Hi Hunter, thanks for that - explicitly including Hadoop solved that issue.

I have a further question now - previously my project was manually
managed without Maven and I've since converted it (due to run-time
ClassDefNotFound errors that were likely caused by improperly managed
jars).

So what is the proper was to introduce a Maven dependency on a locally
installed GeoMesa so I can make use of the full API?  Is there perhaps
a sample pom somewhere that illustrates this?  My initial inclination
was:

       <dependency>
          <groupId>geomesa</groupId>
          <artifactId>geomesa</artifactId>
          <version>1.0.0-SNAPSHOT</version>
          <scope>system</scope>
          <systemPath>/Users/connor/code/geomesa/geomesa-dist/target/geomesa-dist-1.0.0-SNAPSHOT.jar</systemPath>
          <type>jar</type>
       </dependency>

But this is not correct, and it does not pull in all of GeoMesa's
dependencies.  I would assume there's a better way than adding a
similar block for each Jar nested in
geomesa-dist-1.0.0-SNAPSHOT-distribution.tar.gz.

Thanks for your help and patience,
Connor

On Mon, May 19, 2014 at 7:45 AM, Hunter Provyn <fhp@xxxxxxxx> wrote:
Hi Connor,

The short answer is yes, you need to add the hadoop client not to the
accumulo iterators lib/ext but as a compiled dependency in your project
itself.
GeoMesa depends on the hadoop-client but does not include it in the jar.
If you add the following to the pom of your project, that should resolve the
issue:

<dependency>
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-client</artifactId>
             <version>2.2.0</version>
</dependency>

Hunter


On 05/17/2014 05:21 PM, Connor Manning wrote:

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


_______________________________________________
geomesa-users mailing list
geomesa-users@xxxxxxxxxxxxxxxx
http://www.locationtech.org/mailman/listinfo/geomesa-users



_______________________________________________
geomesa-users mailing list
geomesa-users@xxxxxxxxxxxxxxxx
http://www.locationtech.org/mailman/listinfo/geomesa-users



Attachment: App.java
Description: Binary data


Back to the top