Hi Paul, my guess is that you are using an older version of GeoTools with a too recent version of Java. Indeed the stack trace states "Java 17", which is only experimentally supported in GeoTools 27 (see GEOT-6964 <https://osgeo-org.atlassian.net/browse/GEOT-6964>) and even that one requires some exports to work at all:
--add-exports=java.desktop/sun.awt.image=ALL-UNNAMED That is from the main GeoTools pom, but you might need to add more depending on the GeoTools modules you're using (each pom.xml has the eventual exports/opens needed) Cheers Andrea On Mon, Nov 7, 2022 at 12:51 PM <paul.m...@lfv.se> wrote: > Hi, > > I'm trying to do read (import) a Shape file, in the end it is imported to > my PostreSQL database but I get this exception when trying to use: > > > > FeatureCollection<SimpleFeatureType, SimpleFeature> featSrcCollection > = featSource.getFeatures(); > > > > and I also tried (with the same result): > > > > SimpleFeatureCollection featSrcCollection = > (SimpleFeatureCollection)featSource.getFeatures(); > > > > The exception I get is: > > SEVERE: Error attempting to close a mapped byte buffer : > java.nio.DirectByteBuffer > > JVM : 17.0.4.1 Eclipse Adoptium > > java.lang.reflect.InaccessibleObjectException: Unable to make public > jdk.internal.ref.Cleaner java.nio.DirectByteBuffer.cleaner() accessible: > module java.base does not "opens java.nio" to unnamed module @3e3f6a88 > > at > java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) > > at > java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) > > at > java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199) > > at > java.base/java.lang.reflect.Method.setAccessible(Method.java:193) > > at > org.geotools.resources.NIOUtilities.getCleanerMethod(NIOUtilities.java:238) > > at > org.geotools.resources.NIOUtilities$1.run(NIOUtilities.java:210) > > at > org.geotools.resources.NIOUtilities$1.run(NIOUtilities.java:206) > > at > java.base/java.security.AccessController.doPrivileged(AccessController.java:318) > > at > org.geotools.resources.NIOUtilities.clean(NIOUtilities.java:205) > > at > org.geotools.resources.NIOUtilities.clean(NIOUtilities.java:184) > > at > org.geotools.data.shapefile.dbf.DbaseFileHeader.readHeader(DbaseFileHeader.java:639) > > at > org.geotools.data.shapefile.dbf.DbaseFileReader.init(DbaseFileReader.java:205) > > at > org.geotools.data.shapefile.dbf.DbaseFileReader.<init>(DbaseFileReader.java:144) > > at > org.geotools.data.shapefile.ShapefileSetManager.openDbfReader(ShapefileSetManager.java:75) > > at > org.geotools.data.shapefile.ShapefileFeatureSource.readAttributes(ShapefileFeatureSource.java:521) > > at > org.geotools.data.shapefile.ShapefileFeatureSource.buildFeatureType(ShapefileFeatureSource.java:479) > > at > org.geotools.data.shapefile.ShapefileFeatureStore.buildFeatureType(ShapefileFeatureStore.java:137) > > at > org.geotools.data.store.ContentFeatureSource.getAbsoluteSchema(ContentFeatureSource.java:328) > > at > org.geotools.data.store.ContentFeatureSource.getSchema(ContentFeatureSource.java:297) > > at > org.geotools.data.store.ContentFeatureCollection.<init>(ContentFeatureCollection.java:70) > > at > org.geotools.data.store.ContentFeatureSource.getFeatures(ContentFeatureSource.java:546) > > at > org.geotools.data.store.ContentFeatureSource.getFeatures(ContentFeatureSource.java:106) > > at > org.geotools.jdbcconnection.data.importShape.importShapeFile(importShape.java:381) > > > > Has anyone solved this problem? > > Kind regards, > > Paul Malm > _______________________________________________ > GeoTools-GT2-Users mailing list > GeoTools-GT2-Users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > -- Regards, Andrea Aime == GeoServer Professional Services from the experts! Visit http://bit.ly/gs-services-us for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions Group phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 https://www.geosolutionsgroup.com/ http://twitter.com/geosolutions_it ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail
_______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users