I have been trying to insert into a Cassandra table using the GeoMesa api inside of a simple test class. Ultimately, I will need to insert point data into a Cassandra table that has a composite key from a Spark streaming job, but for simply proving it out, I am just trying to use the online GeoMesa api code that uses CassandraDataStore inside a simple app class. The problem is, I continue to have a compilation error due to a LazyLogging class from the typesafe logging library that several of the GeoMesa classes are using. Excluding the dependency in Gradle does not have any effect. Is there some way around this? The code and exception follows.
Code:
import java.util
object Application extends Serializable {
def main(args: Array[String]): Unit = {
val parameters = new util.HashMap[String, String]
parameters.put("geomesa.cassandra.contact.point", "localhost:9042")
parameters.put("geomesa.cassandra.keyspace", "tgeomesa")
parameters.put("geomesa.cassandra.catalog.table", "tstwrite")
val dataStore:org.geotools.data.DataStore =
org.geotools.data.DataStoreFinder.getDataStore(parameters)
println("Completed")
}
}
// GeoMesa
compile group: 'org.locationtech.geomesa', name: 'geomesa-cassandra-datastore_2.11', version: '1.3.4'
compile group: 'org.geotools', name: 'gt-main', version: '15.1'
Exception in thread "main" java.lang.InstantiationError: com.typesafe.scalalogging.Logger
at com.typesafe.scalalogging.Logger$.apply(Logger.scala:31)
at com.typesafe.scalalogging.LazyLogging$class.logger(Logging.scala:28)
at org.locationtech.geomesa.utils.conf.ConfigLoader$.logger$lzycompute(ConfigLoader.scala:19)
at org.locationtech.geomesa.utils.conf.ConfigLoader$.logger(ConfigLoader.scala:19)
at org.locationtech.geomesa.utils.conf.ConfigLoader$.loadConfig(ConfigLoader.scala:38)
at org.locationtech.geomesa.utils.conf.ConfigLoader$.Config$lzycompute(ConfigLoader.scala:28)
at org.locationtech.geomesa.utils.conf.ConfigLoader$.Config(ConfigLoader.scala:25)
at org.locationtech.geomesa.utils.conf.GeoMesaSystemProperties$SystemProperty$$anonfun$get$1.apply(GeoMesaSystemProperties.scala:23)
at org.locationtech.geomesa.utils.conf.GeoMesaSystemProperties$SystemProperty$$anonfun$get$1.apply(GeoMesaSystemProperties.scala:23)
at scala.Option.getOrElse(Option.scala:121)
at org.locationtech.geomesa.utils.conf.GeoMesaSystemProperties$SystemProperty.get(GeoMesaSystemProperties.scala:22)
at org.locationtech.geomesa.utils.conf.GeoMesaSystemProperties$.getProperty(GeoMesaSystemProperties.scala:42)
at org.locationtech.geomesa.utils.conf.GeoMesaSystemProperties.getProperty(GeoMesaSystemProperties.scala)
at org.locationtech.geomesa.utils.audit.AuditProvider$Loader.load(AuditProvider.java:58)
at org.locationtech.geomesa.cassandra.data.CassandraDataStoreFactory.createDataStore(CassandraDataStoreFactory.scala:39)
at org.locationtech.geomesa.cassandra.data.CassandraDataStoreFactory.createDataStore(CassandraDataStoreFactory.scala:25)
at org.geotools.data.DataAccessFinder.getDataStore(DataAccessFinder.java:130)
at org.geotools.data.DataStoreFinder.getDataStore(DataStoreFinder.java:89)
at asrc.ml.clustering.Application$.main(Application.scala:15)
at asrc.ml.clustering.Application.main(Application.scala)
Scala: 2.11.8 GeoMesa: 1.3.4 Cassandra: 3.0.15
Thank you.