0

当我尝试org.apache.jena.geosparql.implementation.SRSInfo在 JUnit 测试函数中初始化 Object 时,我得到一个java.lang.ExceptionInInitializerError,堆栈跟踪是:

Caused by: java.lang.ArrayStoreException: org.geotools.referencing.factory.epsg.FactoryUsingWKT
    at org.apache.sis.internal.referencing.LazySet.cache(LazySet.java:219)
    at org.apache.sis.internal.referencing.LazySet.get(LazySet.java:256)
    at org.apache.sis.internal.referencing.LazySet$1.next(LazySet.java:282)
    at org.apache.sis.referencing.factory.MultiAuthoritiesFactory.getAuthorityFactory(MultiAuthoritiesFactory.java:687)
    at org.apache.sis.referencing.factory.MultiAuthoritiesFactory.create(MultiAuthoritiesFactory.java:861)
    at org.apache.sis.referencing.factory.MultiAuthoritiesFactory.createCoordinateReferenceSystem(MultiAuthoritiesFactory.java:922)
    at org.apache.sis.referencing.CRS.forCode(CRS.java:234)
    at org.apache.jena.geosparql.implementation.SRSInfo.getDefaultWktCRS84(SRSInfo.java:242)
    at org.apache.jena.geosparql.implementation.SRSInfo.<clinit>(SRSInfo.java:51)
    ... 26 more

CRS.forCode直接测试了这个功能,但得到了同样的错误。

文件显示derby.log有异常

java.sql.SQLException: Database 'classpath:SIS_DATA/Databases/SpatialMetadata' not found.

Caused by: ERROR XJ004: Database 'classpath:SIS_DATA/Databases/SpatialMetadata' not found.
    at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
    at org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown Source)
    ... 18 more

我添加了 Maven 依赖项sis-embedded-data

 <dependency>
      <groupId>org.apache.sis.non-free</groupId>
      <artifactId>sis-embedded-data</artifactId>
      <version>1.0</version>
      <scope>runtime</scope>
 </dependency>

我也尝试添加sis-epsg依赖项并设置SIS_DATA环境变量,但遇到了类似的错误。

<dependency>
    <groupId>org.apache.sis.non-free</groupId>
    <artifactId>sis-epsg</artifactId>
    <version>1.0</version>
    <scope>runtime</scope>
</dependency>

任何想法来解决这个问题?

4

1 回答 1

0

此问题可能是由 Apache SIS 和 Geotools 库之间的冲突引起的。我创建了一个干净的环境来测试这个问题,并且它毫无例外地工作。所以,我排除了 geotools 库并得到了正确的答案!

于 2020-12-17T03:38:10.033 回答