I was upgrading from GeoServer 2.22.4 to 2.22.5 using the Web Archive (WAR) 
package and deploying in JDK8 and encountered a NoSuchMethodError related to 
compiling the GeoTools JARs with JDK11.  I was able to reproduce the error 
using the unmodified WAR directly from the download site and the default data 
directory (stack trace is at the end).

I looked at the MANIFEST.MF files in the GeoTools 28.5 JARs in the WAR and they 
say "Build-Jdk-Spec: 11" but the GeoTools 28.5 JARs in the OSGeo Nexus repo say 
"Build-Jdk-Spec: 1.8" and I was able to confirm that replacing the affected 
GeoTools JARs with the Nexus version ran fine with JDK8.

MANIFEST.MF from the gt-shapefile-28.5.jar in 
https://sourceforge.net/projects/geoserver/files/GeoServer/2.22.5/geoserver-2.22.5-war.zip
Build-Jdk-Spec: 11
Build-Timestamp: 30-Aug-2023 08:29
Git-Revision: e932a443b6e51756ebf1261baab4c0c390706ece

MANIFEST.MF from 
https://repo.osgeo.org/repository/release/org/geotools/gt-shapefile/28.5/gt-shapefile-28.5.jar
Build-Jdk-Spec: 1.8
Build-Timestamp: 31-Aug-2023 12:31
Git-Revision: 53833690070eb6af1b283ab278e6da4267be3cac

These are the GeoTools modules that directly use java.nio.ByteBuffer with main, 
metadata, referencing and shapefile being included in the core package:
library/main
library/metadata
library/referencing
plugin/grassraster
plugin/jdbc/jdbc-hana
plugin/shapefile
unsupported/flatgeobuff
unsupported/geobuff
unsupported/s3-geotiff

I don't know if this is serious enough to consider doing another "final" 2.22.x 
release when a developer becomes available.  If not, a note should be added 
somewhere that JDK8 users will need to either stay on GeoServer 2.22.4 or use 
the workaround of manually replace certain GeoTools JARs if they are using 
GeoServer in a way that triggers these errors.

Stack Trace:
2023-09-05 15:38:39,662 ERROR [org.geoserver] Failed to run initializer 
org.geoserver.gwc.config.GWCInitializer@609e3e1: java.lang.NoSuchMethodError: 
java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer;
        at 
org.geotools.data.shapefile.dbf.DbaseFileHeader.readHeader(DbaseFileHeader.java:577)
        at 
org.geotools.data.shapefile.dbf.DbaseFileReader.doInit(DbaseFileReader.java:226)
        at 
org.geotools.data.shapefile.dbf.DbaseFileReader.init(DbaseFileReader.java:186)
        at 
org.geotools.data.shapefile.dbf.DbaseFileReader.<init>(DbaseFileReader.java:148)
        at 
org.geotools.data.shapefile.ShapefileSetManager.openDbfReader(ShapefileSetManager.java:132)
        at 
org.geotools.data.shapefile.ShapefileFeatureSource.readAttributes(ShapefileFeatureSource.java:497)
        at 
org.geotools.data.shapefile.ShapefileFeatureSource.buildFeatureType(ShapefileFeatureSource.java:454)
        at 
org.geotools.data.shapefile.ShapefileFeatureStore.buildFeatureType(ShapefileFeatureStore.java:142)
        at 
org.geotools.data.store.ContentFeatureSource.getAbsoluteSchema(ContentFeatureSource.java:339)
        at 
org.geotools.data.store.ContentFeatureSource.getSchema(ContentFeatureSource.java:308)
        at 
org.geotools.data.store.ContentDataStore.getSchema(ContentDataStore.java:295)
        at 
org.geotools.data.directory.DirectoryDataStore.getSchema(DirectoryDataStore.java:106)
        at 
org.geotools.data.directory.DirectoryDataStore.getSchema(DirectoryDataStore.java:178)
        at 
org.geotools.data.directory.DirectoryDataStore.getSchema(DirectoryDataStore.java:50)
        at 
org.geoserver.catalog.ResourcePool.acquireFeatureType(ResourcePool.java:1012)
        at 
org.geoserver.catalog.ResourcePool.getCacheableFeatureType(ResourcePool.java:994)
        at 
org.geoserver.catalog.ResourcePool.tryGetFeatureType(ResourcePool.java:977)
        at 
org.geoserver.catalog.ResourcePool.getFeatureType(ResourcePool.java:960)
        at 
org.geoserver.catalog.ResourcePool.getFeatureType(ResourcePool.java:954)
        at 
org.geoserver.catalog.ResourcePool.loadAttributes(ResourcePool.java:841)
        at 
org.geoserver.catalog.ResourcePool.attributeTypeInfos(ResourcePool.java:825)
        at 
org.geoserver.catalog.ResourcePool.getAttributes(ResourcePool.java:815)
        at 
org.geoserver.catalog.impl.FeatureTypeInfoImpl.attributes(FeatureTypeInfoImpl.java:129)

Steve Ikeoka
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to