I am trying to GeoTool's CoordinateReferenceSystem with the following code:
try {
targetCRS = CRS.decode("EPSG:4326");
logger.info("\nTarget: " + targetCRS.toWKT());
} catch (NoSuchAuthorityCodeException e) {
logger.error(e.toString());
} catch (FactoryException e) {
logger.error(e.toString());
} catch (Exception e) {
logger.error(e.toString());
}
It works when I run the service in vscode, but when I deploy it to Kubernetes, I get:
2020-03-31 20:54:16,985 ERROR (TrackRecordProjector.java:76) - org.opengis.referencing.NoSuchAuthorityCodeException: No code "EPSG:4326" from authority "EPSG" found for object of type "EngineeringCRS".
I assume this is something to do with the HSQL database that contains the reference systems.
I checked my JAR that is produced using:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
The META-INF/services folder in the JAR contains two different entries for org.opengis.referencing.cs.CSAuthorityFactory. I checked based on a comment on this site for another question (Geotools cannot find HSQL EPSG DB, throws error: NoSuchAuthorityCodeException). However I don't know what this means and how to fix it.