我一直在尝试使用简单测试类中的GeoMesa api插入到Cassandra表中。最后,我需要将点数据插入到Cassandra表中,该表具有来自Spark流工作的复合键,但是为了简单地证明它,我只是尝试使用在简单应用类中使用CassandraDataStore的在线GeoMesa api代码。 。问题是,由于几个GeoMesa类正在使用的typesafe日志库中的LazyLogging类,我继续遇到编译错误。排除Gradle中的依赖性没有任何影响。这有什么办法吗?代码和例外如下。
代码:
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)
斯卡拉:2.11.8 GeoMesa:1.3.4 卡珊德拉:3.0.15
谢谢。