Hi Milan
What version of Accumulo are you using? I've seen this error when using 1.8.0. We recently merged a fix into master (1.3.0-m3-SNAPSHOT) that addresses the issue. Basically, versions of the libthrift library are out of sync.
Thanks Anthony
Hello everyone and merry christmas
I want to use write data to geomesa programatically, but I get
following error:
Exception in thread "main" java.lang.NoSuchMethodError:
org.apache.accumulo.core.tabletserver.thrift.TabletClientService$Client.sendBaseOneway(Ljava/lang/String;Lorg/apache/thrift/TBase;)V
at
org.apache.accumulo.core.tabletserver.thrift.TabletClientService$Client.send_closeScan(TabletClientService.java:303)
at
org.apache.accumulo.core.tabletserver.thrift.TabletClientService$Client.closeScan(TabletClientService.java:295)
at
org.apache.accumulo.core.client.impl.ThriftScanner.getBatchFromServer(ThriftScanner.java:117)
at
org.apache.accumulo.core.metadata.MetadataLocationObtainer.lookupTablet(MetadataLocationObtainer.java:101)
at
org.apache.accumulo.core.client.impl.TabletLocatorImpl.lookupTabletLocation(TabletLocatorImpl.java:483)
at
org.apache.accumulo.core.client.impl.TabletLocatorImpl.lookupTabletLocationAndCheckLock(TabletLocatorImpl.java:654)
at
org.apache.accumulo.core.client.impl.TabletLocatorImpl._locateTablet(TabletLocatorImpl.java:640)
at
org.apache.accumulo.core.client.impl.TabletLocatorImpl.locateTablet(TabletLocatorImpl.java:456)
at
org.apache.accumulo.core.client.impl.TabletLocatorImpl.lookupTabletLocation(TabletLocatorImpl.java:480)
at
org.apache.accumulo.core.client.impl.TabletLocatorImpl.lookupTabletLocationAndCheckLock(TabletLocatorImpl.java:654)
at
org.apache.accumulo.core.client.impl.TabletLocatorImpl._locateTablet(TabletLocatorImpl.java:640)
at
org.apache.accumulo.core.client.impl.TabletLocatorImpl.locateTablet(TabletLocatorImpl.java:456)
at
org.apache.accumulo.core.client.impl.ThriftScanner.scan(ThriftScanner.java:247)
at
org.apache.accumulo.core.client.impl.ScannerIterator$Reader.run(ScannerIterator.java:79)
at
org.apache.accumulo.core.client.impl.ScannerIterator.hasNext(ScannerIterator.java:150)
at
scala.collection.convert.Wrappers$JIteratorWrapper.hasNext(Wrappers.scala:42)
at
scala.collection.Iterator$class.foreach(Iterator.scala:893)
at
scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
at
scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
at
scala.collection.AbstractIterable.foreach(Iterable.scala:54)
at
scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
at
scala.collection.AbstractTraversable.map(Traversable.scala:104)
at
org.locationtech.geomesa.accumulo.data.MultiRowAccumuloMetadata.getFeatureTypes(GeoMesaMetadata.scala:339)
at
org.locationtech.geomesa.accumulo.data.AccumuloDataStore.getTypeNames(AccumuloDataStore.scala:104)
at
org.locationtech.geomesa.accumulo.data.AccumuloDataStore.getFeatureSource(AccumuloDataStore.scala:346)
at
org.locationtech.geomesa.accumulo.data.AccumuloDataStore.getFeatureSource(AccumuloDataStore.scala:362)
at
com.aimaps.geomesa.DataWriter$.main(DataWriter.scala:100)
at com.aimaps.geomesa.DataWriter.main(DataWriter.scala)
I am new to scala, this is my code:
package com.aimaps.geomesa
import
org.locationtech.geomesa.accumulo.data.AccumuloDataStore
import org.locationtech.geomesa.accumulo.index.Constants
import
org.locationtech.geomesa.utils.interop.SimpleFeatureTypes
import org.locationtech.geomesa.utils.interop.WKTUtils
import org.opengis.feature.Feature
import org.opengis.feature.simple.SimpleFeature
import org.opengis.feature.simple.SimpleFeatureType
import org.geotools.data.DataStore
import org.geotools.data.DataStoreFinder
import org.geotools.data.FeatureSource
import org.geotools.data.FeatureStore
import org.geotools.data.Query
import org.geotools.data.simple.SimpleFeatureStore
import org.geotools.factory.CommonFactoryFinder
import org.geotools.factory.Hints
import org.geotools.feature.DefaultFeatureCollection
import org.geotools.feature.FeatureCollection
import org.geotools.feature.FeatureIterator
import org.geotools.feature.SchemaException
import org.geotools.feature.simple.SimpleFeatureBuilder
import org.geotools.data.DataStore
import org.geotools.data.DataStoreFinder
import org.apache.hadoop.conf.Configuration
import org.apache.spark.{SparkConf, SparkContext}
import scala.collection.JavaConversions._
import java.util.UUID.randomUUID
object DataWriter {
def main(args: Array[String]) {
println("Starting up!")
println("Generating Simple Feature")
// Vygenerovanie sample tuple zaznamu
val data = "" "Sample Sensor", 78,
System.currentTimeMillis(), 48.5, 18.0)
// println(f"Generated data: $data")
// Creating simple feature type
val simpleFeatureType =
SimpleFeatureTypes.createType("sampleSensor","objectId:String:index=full,note:String,value:Int:index=full,time:Date,geom:Point:srid=4326:index=full")
//definicia ktory atribut ma byt pouzity ako time index
simpleFeatureType.getUserData().put(Constants.SF_PROPERTY_START_TIME,
"time");
// vytvorenie simple feature buildera
val featureBuilder = new
SimpleFeatureBuilder(simpleFeatureType)
// vytvorenie noveho simple feature
val simpleFeature =
featureBuilder.buildFeature(randomUUID.toString());
//naplnenie simple feature datami
simpleFeature.setAttribute("objectId", data._1)
simpleFeature.setAttribute("note", data._2)
simpleFeature.setAttribute("value", data._3)
simpleFeature.setAttribute("time", data._4)
// vytvorenie geometrie a priradenie geometrie
val geometry = WKTUtils.read("POINT(" + data._6 + " " +
data._5 + ")")
simpleFeature.setAttribute("geom", geometry)
println("Generujem Feature Collection")
val featureCollection = new DefaultFeatureCollection()
featureCollection.add(simpleFeature)
/**
* ZAPIS SIMPLE FEATURE DO TABULKY
*/
println("Initializing geomesa connection")
// configuracia pripojenia na geomesa
val dataStoreConfig = Map(
"instanceId" -> "accumulo",
"zookeepers" -> "localhost:2181",
"user" -> "root",
"password" -> "pass1234",
"tableName" -> "test_insert",
"auth" -> "")
println("Creating data store")
// vytvorenie datastore
val dataStore =
DataStoreFinder.getDataStore(dataStoreConfig).asInstanceOf[AccumuloDataStore]
// vytvorenie schemy
// dataStore.createSchema(simpleFeatureType)
println("Creating feature store")
val featureStore =
dataStore.getFeatureSource("sampleSensor")
println("Inserting features")
featureStore.addFeatures(featureCollection)
println("DONE.")
}
}
Thank you for any sudgestions,
Milan
|