Geotools要素教程ClassFormatError



我试着学习地理工具的功能教程。一切都很好,直到我找到了应该将功能存储在形状文件中的代码:

if (featureSource instanceof SimpleFeatureStore) {
SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;

// List Features into Collection
SimpleFeatureCollection collection = new ListFeatureCollection(TYPE, features);
featureStore.setTransaction(transaction);
try {
featureStore.addFeatures(collection);
transaction.commit();
}catch (Exception problem) {
problem.printStackTrace();
transaction.rollback();
}finally {
transaction.close();
}
System.exit(0);
}else {
System.out.println(typeName + "does not support read/write access.");
System.exit(0);
}

运行时异常链接到行";featureStore.addFeatures(收藏(;这是错误消息:

Exception in thread "main" java.lang.ClassFormatError: Illegal constant pool index 0 for method name in class file org/geotools/geometry/jts/JTS
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:821)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:719)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:642)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:600)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at org.geotools.feature.simple.SimpleFeatureImpl.getBounds(SimpleFeatureImpl.java:258)
at org.geotools.data.Diff.addToSpatialIndex(Diff.java:201)
at org.geotools.data.Diff.add(Diff.java:195)
at org.geotools.data.store.DiffContentFeatureWriter.write(DiffContentFeatureWriter.java:168)
at org.geotools.data.InProcessLockingManager$1.write(InProcessLockingManager.java:296)
at org.geotools.data.store.ContentFeatureStore.addFeature(ContentFeatureStore.java:302)
at org.geotools.data.store.ContentFeatureStore.addFeatures(ContentFeatureStore.java:254)
at de.topotools.topograph.Csv2Shape.main(Csv2Shape.java:121)

我更新了maven项目,并检查了代码是否等于教程中的代码,但没有任何帮助。我也找不到任何关于地理工具搜索互联网的错误描述。

我使用的是Java 14.0.2。

谢谢你的帮助。

您的项目似乎缺少一两个jar。此外,除了1.8和11之外,GeoTools并不真正支持任何JVM,但总是很高兴听到它在另一个版本中工作。

相关内容

  • 没有找到相关文章

最新更新