'JP2 Error : Could not list layer for this store

When creating a JP2ECW data source an error is thrown by Geoserver

Getting list of coverages for saved store file:data/jp2_files/myfilename.jp2 java.lang.RuntimeException: Could not list layers for this store, an error occurred retrieving them: The Provided input is not supported by this reader.

I can succesfully open the file with QGis and Gdalinfo. I checked the presence of the EPSG (31370) in the SRS list.

My Geoserver runs on Windows, I'v upgraded to the latest stable version 2.20.2. The GS-GDAL version is 1.3.10

The JP2 file is publicly available on https://downloadagiv.blob.core.windows.net/omwrgb21vl/Per%20provincie%20per%20gemeente/Antwerpen/OMWRGB21VL_11035.zip

Gdalinfo

    Driver: JP2ECW/ERDAS JPEG2000 (SDK 5.3)
    Files: \\RANST-G-RD-DC01\c$\Program Files\GeoServer\data_dir\data\jp2_files\2021\OMWRGB21VL_11035.jp2
    Size is 35787, 43111
    Coordinate System is:
    PROJCS["Belge 1972 / Belgian Lambert 72",
        GEOGCS["Belge 1972",
            DATUM["Reseau_National_Belge_1972",
                SPHEROID["International 1924",6378388,297,
                    AUTHORITY["EPSG","7022"]],
                TOWGS84[-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747],
                AUTHORITY["EPSG","6313"]],
            PRIMEM["Greenwich",0,
                AUTHORITY["EPSG","8901"]],
            UNIT["degree",0.0174532925199433,
                AUTHORITY["EPSG","9122"]],
            AUTHORITY["EPSG","4313"]],
        PROJECTION["Lambert_Conformal_Conic_2SP"],
        PARAMETER["standard_parallel_1",51.16666723333333],
        PARAMETER["standard_parallel_2",49.8333339],
        PARAMETER["latitude_of_origin",90],
        PARAMETER["central_meridian",4.367486666666666],
        PARAMETER["false_easting",150000.013],
        PARAMETER["false_northing",5400088.438],
        UNIT["metre",1,
            AUTHORITY["EPSG","9001"]],
        AXIS["X",EAST],
        AXIS["Y",NORTH],
        AUTHORITY["EPSG","31370"]]
    Origin = (160781.250000000000000,214548.000000000000000)
    Pixel Size = (0.250000000000000,-0.250000000000000)
    Metadata:
      COLORSPACE=RGB
      COMPRESSION_RATE_TARGET=19
    Corner Coordinates:
    Upper Left  (  160781.250,  214548.000) (  4d31'18.71"E, 51d14'28.62"N)
    Lower Left  (  160781.250,  203770.250) (  4d31'17.55"E, 51d 8'39.88"N)
    Upper Right (  169728.000,  214548.000) (  4d38'59.89"E, 51d14'27.77"N)
    Lower Right (  169728.000,  203770.250) (  4d38'57.78"E, 51d 8'39.03"N)
    Center      (  165254.625,  209159.125) (  4d35' 8.48"E, 51d11'33.89"N)
    Band 1 Block=256x256 Type=Byte, ColorInterp=Red
      Description = Red
      Overviews: 17893x21555, 8946x10777, 4473x5388, 2236x2694, 1118x1347, 559x673, 279x336, 139x168
    Band 2 Block=256x256 Type=Byte, ColorInterp=Green
      Description = Green
      Overviews: 17893x21555, 8946x10777, 4473x5388, 2236x2694, 1118x1347, 559x673, 279x336, 139x168
    Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
      Description = Blue
      Overviews: 17893x21555, 8946x10777, 4473x5388, 2236x2694, 1118x1347, 559x673, 279x336, 139x168


Solution 1:[1]

Issue resolved

When inspecting GDALINFO on the file name there was an ERROR

ERROR 1: PROJ: proj_create_from_database: Cannot find proj.db

After checking the python installation setting the PROJ_LIB (and PYTHONPATH) as windows variables and rebooting the issue was resolved

PROJ_LIB "C:\Program Files\GDAL\projlib"

PYTHONPATH "C:\Program Files\GDAL"

Extra credits for the installation manual on https://sandbox.idre.ucla.edu/sandbox/tutorials/installing-gdal-for-windows

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 goback136