Apache SIS Database 'classpath:SIS_DATA/Databases/SpatialMetadata' not found

307 views Asked by At

When I try to initialize a org.apache.jena.geosparql.implementation.SRSInfo Object in a JUnit test function, I got an java.lang.ExceptionInInitializerError, the stack trace is:

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

I tested the CRS.forCode function directly, but got the same error.

The derby.log file shown that there is an exception

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

I have added the maven dependency sis-embedded-data

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

I have also tried to add the sis-epsg dependency and set the SIS_DATA environment variable, but got similar error.

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

Any idea to fix this problem?

1

There are 1 answers

0
zhiwei On

This problem may be caused by the conflicts between Apache SIS and Geotools libraries. I have created a clean environment to test this porblem, and it worked without exceptions. So, I excluded geotools libraries and got the right answer!