Unidata / thredds-docker

Dockerized THREDDS

Home Page:https://hub.docker.com/r/unidata/thredds-docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

netcdf4 support may be borked

tyoksas opened this issue · comments

For example:

HTTPError: Error accessing http://thredds-jetstream.unidata.ucar.edu/thredds/ncss/grib/NCEP/HRRR/CONUS_2p5km/HRRR_CONUS_2p5km_20170630_1800.grib2?var=Temperature_height_above_ground&temporal=all&west=-117.5&east=-92.5&south=30.0&north=50.0&accept=netcdf4: 400 Format netcdf4 is not supported for Grid data request

/usr/local/tomcat/content/thredds/logs/serverStartup.log gives some important clues. E.g.,

java.lang.UnsatisfiedLinkError: Failed to create temporary file for /com/sun/jna/linux-x86-64/libjnidispatch.so library: Permission denied
        at ucar.nc2.jni.netcdf.Nc4Iosp.load(Nc4Iosp.java:172) [netcdf4-4.6.10.jar:4.6.10]
        at ucar.nc2.jni.netcdf.Nc4Iosp.isClibraryPresent(Nc4Iosp.java:198) [netcdf4-4.6.10.jar:4.6.10]

May or may not also need to add

  <Netcdf4Clibrary>
     <libraryPath>/usr/local/lib/</libraryPath>
     <libraryName>libnetcdf</libraryName>
  </Netcdf4Clibrary>

in threddsConfig.xml.

Update:

The root problem here is the TDS employs JNA (Java Native Access) for writing netcdf4 files via the netcdf-c API accessed via JNA. JNA writes to a temporary directory (for whatever reason). The parent tomcat container, is fairly locked down in terms of file system access for security reasons. Wherever JNA wants to write, is an area of the container that does not have write access for the tomcat user. The solution is simple. Make use of the -Djna.tmpdir JVM option (e.g., -Djna.tmpdir="/tmp/" ).