<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-shapefile</artifactId>
<version>18.2</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-epsg-hsql</artifactId>
<version>18.2</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-coverage</artifactId>
<version>18.2</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-geotiff</artifactId>
<version>18.2</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-image</artifactId>
<version>18.2</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-wms</artifactId>
<version>18.2</version>
</dependency>
When I look into WEB-INF/lib, all jars are here including dependencies (gt-referencing, gt-metadata.....)
Tomcat : 8.0
Java 8
GeoTools : 18.2
It works fine when I'm not in a servlet container.
Also, other utilities from geotools are working fine. For example, the cropping or the GridCoverage2D conversion work in this servlet container.
Could you please help me understand what's going on?
Thanks in advance
–
–
–
Your issue is most likely that Tomcat (or the user running it) doesn't have write permission to java.io.tmpdir
which is where GeoTools unpacks the H2 EPSG database to when it first looks up an EPSG code.
You can either change the permissions on the temp directory to allow tomcat to write there or you can change the location it uses by changing the CATALINA_TMPDIR
variable in catalina.sh
or catalina.bat
, or simply add Djava.io.tmpdir=c:\{yourDir}
to your startup script.
This question also has some answers that may help.
I found a workaround even if it doesn't solve the initial issue (related to dependencies of geotools and the deployement into Tomcat)
don't use gt-epsg-hsql which leads your app searching for the EPSG code to decode into the HSQL database.
Rather than using CRS.decode(targetCrs);
CRS.parseWKT("PROJCS[\"WGS 84 / Plate Carree (deprecated)\",\r\n" +
" GEOGCS[\"WGS 84\",\r\n" +
" DATUM[\"WGS_1984\",\r\n" +
" SPHEROID[\"WGS 84\",6378137,298.257223563,\r\n" +
" AUTHORITY[\"EPSG\",\"7030\"]],\r\n" +
" AUTHORITY[\"EPSG\",\"6326\"]],\r\n" +
" PRIMEM[\"Greenwich\",0,\r\n" +
" AUTHORITY[\"EPSG\",\"8901\"]],\r\n" +
" UNIT[\"degree\",0.0174532925199433,\r\n" +
" AUTHORITY[\"EPSG\",\"9122\"]],\r\n" +
" AUTHORITY[\"EPSG\",\"4326\"]],\r\n" +
" PROJECTION[\"Equirectangular\"],\r\n" +
" UNIT[\"metre\",1,\r\n" +
" AUTHORITY[\"EPSG\",\"9001\"]],\r\n" +
" AXIS[\"X\",EAST],\r\n" +
" AXIS[\"Y\",NORTH],\r\n" +
" AUTHORITY[\"EPSG\",\"32662\"]]");
You can find all WKT related to every EPSG code here
If someone has an answer or an explanation to the original issue, i'd love to read it :)
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.