You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Geomesa导入超600列Shapefile触发数组越界异常的咨询

Geomesa导入多列Shapefile异常的解决方案

异常原因

从栈信息可明确,问题出在Kryo序列化组件:默认输出缓冲区初始大小为1024字节,处理包含600+列的要素时,序列化WKB几何与大量属性数据的过程中缓冲区被写满,触发ArrayIndexOutOfBoundsException。

更换序列化方式的可行性

完全可行。Geomesa原生支持多种序列化实现,比如JSON序列化、Avro序列化,这些方式不受Kryo初始缓冲区大小限制,更适配多属性列的要素场景。

无需编译代码的调整方案

方案1:切换序列化方式

通过配置参数直接指定非Kryo序列化器,无需修改或重新编译代码:

  • 配置文件设置:在geomesa-site.xml中添加如下配置:
    <property>
      <name>geomesa.feature.serializer</name>
      <!-- 使用JSON序列化 -->
      <value>org.locationtech.geomesa.features.json.JsonFeatureSerializer</value>
      <!-- 或使用Avro序列化 -->
      <!-- <value>org.locationtech.geomesa.features.avro.AvroFeatureSerializer</value> -->
    </property>
    
  • Ingest命令参数指定:执行导入命令时通过系统参数临时生效:
    geomesa accumulo ingest --catalog <catalog> --feature-name <feature> <shapefile-path> \
      -Dgeomesa.feature.serializer=org.locationtech.geomesa.features.json.JsonFeatureSerializer
    

方案2:调整Kryo缓冲区大小

若不想更换序列化方式,可直接调大Kryo初始缓冲区大小,同样无需编译:

geomesa accumulo ingest --catalog <catalog> --feature-name <feature> <shapefile-path> \
  -Dgeomesa.kryo.buffer.size=16384

(数值可根据实际数据大小调整,比如32768、65536等)

内容的提问来源于stack exchange,提问作者Luigi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.14 18:29:59