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

旧版RepastSimphony 1.2.0模型在新版运行时找不到SGeographyImpl模块报错

问题分析与解决方案

问题根源

Repast Simphony在版本迭代中对GIS地理投影模块进行了重构,旧版本1.2.0中的repast.score.impl.SGeographyImpl类已被移除并替换为新的包结构实现,新版Repast不再包含该旧类,导致场景文件加载时无法解析类引用,触发XStream转换异常。

具体修复步骤

1. 修改场景文件中的类引用

找到模型的场景配置文件(通常为.rs或.xml格式),定位到报错相关的XML片段,将所有repast.score.impl.SGeographyImpl的引用替换为新版对应类repast.simphony.space.gis.GeographyImpl:

  • 原标签:
    <repast.score.impl.SGeographyImpl>
      <name>PeopleGeography</name>
    </repast.score.impl.SGeographyImpl>
    
    替换为:
    <repast.simphony.space.gis.GeographyImpl>
      <name>PeopleGeography</name>
    </repast.simphony.space.gis.GeographyImpl>
    
  • 原投影描述:
    <proj class="repast.score.impl.SGeographyImpl" reference="../../../../projections/repast.score.impl.SGeographyImpl"/>
    
    替换为:
    <proj class="repast.simphony.space.gis.GeographyImpl" reference="../../../../projections/repast.simphony.space.gis.GeographyImpl"/>
    

2. 更新模型代码中的类引用

检查模型Java代码中是否直接引用了旧类:

  • 将导入语句import repast.score.impl.SGeographyImpl;替换为import repast.simphony.space.gis.GeographyImpl;
  • 将代码中创建或使用该类实例的部分,同步替换为新类名

3. 验证并重建项目

  • 清理项目编译生成的class文件和缓存
  • 重新编译模型代码,确保没有编译错误
  • 启动模型验证场景加载是否正常

4. 可选:重新创建场景

如果手动修改配置文件容易出错,可直接在新版Repast中重新构建场景:

  • 导入模型代码后,打开Repast场景编辑器
  • 添加地理投影(Geography Projection),命名为PeopleGeography
  • 配置显示参数后保存新场景文件,替代旧场景

补充说明

模型库中的zombies模型可正常运行,是因为该模型已针对新版Repast的API和类结构做了适配,不存在旧类引用的兼容性问题。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.03 19:40:32