gpt4 book ai didi

java - 为什么 GeoTools 找不到 MutablePicoContainer#registerComponentImplementation 方法?

转载 作者:行者123 更新时间:2023-11-30 06:17:51 29 4
gpt4 key购买 nike

我刚刚开始使用 GeoTools 并尝试生成 KML。我为我的应用程序遵循了 2 个主要示例,但我看到了一个奇怪的错误,其中 gt-xsd-core 无法从 MutablePicoContainer 类中找到此方法 registerComponentImplementation

java.lang.NoSuchMethodError: org.picocontainer.MutablePicoContainer.registerComponentImplementation(Ljava/lang/Object;Ljava/lang/Class;)Lorg/picocontainer/ComponentAdapter; at org.geotools.xs.XSConfiguration.registerBindings(XSConfiguration.java:130) ~[gt-xsd-core-16.1.jar:na] at org.geotools.xml.Configuration.setupBindings(Configuration.java:528) ~[gt-xsd-core-16.1.jar:na] at org.geotools.xml.Encoder.(Encoder.java:230) ~[gt-xsd-core-16.1.jar:na] at org.geotools.xml.Encoder.(Encoder.java:214) ~[gt-xsd-core-16.1.jar:na]

我的所有 Geo Tools 导入都运行相同的版本,并且我尝试过版本 18.2、18.1、17.4 和 16.1。

    <dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-shapefile</artifactId>
<version>${geo.tools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools.xsd</groupId>
<artifactId>gt-xsd-kml</artifactId>
<version>${geo.tools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-metadata</artifactId>
<version>${geo.tools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-epsg-hsql</artifactId>
<version>${geo.tools.version}</version>
</dependency>
<小时/>
 import org.geotools.data.DataUtilities;
import org.geotools.data.simple.SimpleFeatureCollection;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.geotools.kml.KMLConfiguration;
import org.geotools.xml.Encoder;

SimpleFeatureCollection featureCollection = DataUtilities.collection(features);
Encoder encoder = new Encoder(new KMLConfiguration()); // Error Line
encoder.setIndenting(true);

try {
encoder.encode(featureCollection, org.geotools.kml.KML.kml, System.err);
<小时/>

我没有编译或启动错误。我的其他 RESTful 服务运行良好。 Mvn clean install 成功通过。我尝试将 Pico Container (1.2) 依赖项添加到我的 pom.xml 中,但这也不起作用。

我正在查看 MutablePicoContainer 类的文档,但没有看到 GeoTools 正在使用的方法,尽管我可以看到他们的代码正在使用引用进行编译。

PicoContainer JavaDoc:http://picocontainer.com/javadoc/core/org/picocontainer/MutablePicoContainer.html

GeoTools XSConfiguration (18.x) 来源:https://github.com/geotools/geotools/blob/18.x/modules/extension/xsd/xsd-core/src/main/java/org/geotools/xs/XSConfiguration.java

GeoTools 示例:http://docs.geotools.org/latest/userguide/extension/xsd/kml.html

OSGEO 示例:http://svn.osgeo.org/geotools/tags/2.7.5/demo/example/src/main/java/org/geotools/demo/xml/KMLExample.java

<小时/>

请帮忙,这花费了我很多时间进行调试,而且我不知道它可能是什么。

最佳答案

我几乎可以构建 identical code并运行它,这些依赖项没有任何问题。如果我使用 shade 插件创建 uber jar,它包含以下依赖项。如您所见,picocontianer-1.2 就在那里。

我唯一能想到的是您的类路径中缺少它,或者您的下载已损坏。

[INFO] Including org.geotools:gt-shapefile:jar:18.1 in the shaded jar.
[INFO] Including org.geotools:gt-data:jar:18.1 in the shaded jar.
[INFO] Including org.jdom:jdom:jar:1.1.3 in the shaded jar.
[INFO] Including org.geotools.xsd:gt-xsd-kml:jar:18.1 in the shaded jar.
[INFO] Including org.geotools.xsd:gt-xsd-core:jar:18.1 in the shaded jar.
[INFO] Including picocontainer:picocontainer:jar:1.2 in the shaded jar.
[INFO] Including commons-jxpath:commons-jxpath:jar:1.3 in the shaded jar.
[INFO] Including commons-collections:commons-collections:jar:3.2.2 in the shaded jar.
[INFO] Including org.eclipse.emf:org.eclipse.emf.common:jar:2.12.0 in the shaded jar.
[INFO] Including org.eclipse.emf:org.eclipse.emf.ecore:jar:2.12.0 in the shaded jar.
[INFO] Including org.eclipse.xsd:org.eclipse.xsd:jar:2.12.0 in the shaded jar.
[INFO] Including org.eclipse.emf:org.eclipse.emf.ecore.xmi:jar:2.12.0 in the shaded jar.
[INFO] Including org.geotools:gt-metadata:jar:18.1 in the shaded jar.
[INFO] Including org.geotools:gt-opengis:jar:18.1 in the shaded jar.
[INFO] Including net.java.dev.jsr-275:jsr-275:jar:1.0-beta-2 in the shaded jar.
[INFO] Including commons-pool:commons-pool:jar:1.5.4 in the shaded jar.
[INFO] Including org.geotools:gt-epsg-hsql:jar:18.1 in the shaded jar.
[INFO] Including org.geotools:gt-referencing:jar:18.1 in the shaded jar.
[INFO] Including com.googlecode.efficient-java-matrix-library:core:jar:0.26 in the shaded jar.
[INFO] Including jgridshift:jgridshift:jar:1.0 in the shaded jar.
[INFO] Including net.sf.geographiclib:GeographicLib-Java:jar:1.44 in the shaded jar.
[INFO] Including org.hsqldb:hsqldb:jar:2.3.0 in the shaded jar.
[INFO] Including org.geotools:gt-main:jar:18.1 in the shaded jar.
[INFO] Including org.geotools:gt-api:jar:18.1 in the shaded jar.
[INFO] Including com.vividsolutions:jts-core:jar:1.14.0 in the shaded jar.
[INFO] Including org.geotools:gt-render:jar:18.1 in the shaded jar.
[INFO] Including org.geotools:gt-coverage:jar:18.1 in the shaded jar.
[INFO] Including javax.media:jai_imageio:jar:1.1 in the shaded jar.
[INFO] Including it.geosolutions.imageio-ext:imageio-ext-tiff:jar:1.1.18 in the shaded jar.
[INFO] Including it.geosolutions.imageio-ext:imageio-ext-utilities:jar:1.1.18 in the shaded jar.
[INFO] Including it.geosolutions.imageio-ext:imageio-ext-geocore:jar:1.1.18 in the shaded jar.
[INFO] Including it.geosolutions.imageio-ext:imageio-ext-streams:jar:1.1.18 in the shaded jar.
[INFO] Including javax.media:jai_codec:jar:1.1.3 in the shaded jar.
[INFO] Including com.vividsolutions:jts-example:jar:1.14.0 in the shaded jar.
[INFO] Including com.vividsolutions:jts-io:jar:1.14.0 in the shaded jar.
[INFO] Including com.googlecode.json-simple:json-simple:jar:1.1 in the shaded jar.
[INFO] Including org.jaitools:jt-zonalstats:jar:1.4.0 in the shaded jar.
[INFO] Including org.jaitools:jt-utils:jar:1.4.0 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.affine:jt-affine:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.algebra:jt-algebra:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.bandmerge:jt-bandmerge:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.bandselect:jt-bandselect:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.bandcombine:jt-bandcombine:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.border:jt-border:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.buffer:jt-buffer:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.crop:jt-crop:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.iterators:jt-iterators:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.lookup:jt-lookup:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.mosaic:jt-mosaic:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.nullop:jt-nullop:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.rescale:jt-rescale:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.scale:jt-scale:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.stats:jt-stats:jar:1.0.16 in the shaded jar.
[INFO] Including com.google.guava:guava:jar:17.0 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.translate:jt-translate:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.utilities:jt-utilities:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.warp:jt-warp:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.zonal:jt-zonal:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.binarize:jt-binarize:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.format:jt-format:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.colorconvert:jt-colorconvert:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.errordiffusion:jt-errordiffusion:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.orderdither:jt-orderdither:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.colorindexer:jt-colorindexer:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.imagefunction:jt-imagefunction:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.piecewise:jt-piecewise:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.classifier:jt-classifier:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.rlookup:jt-rlookup:jar:1.0.16 in the shaded jar.
[INFO] Including it.geosolutions.jaiext.vectorbin:jt-vectorbin:jar:1.0.16 in the shaded jar.
[INFO] Including org.geotools:gt-cql:jar:18.1 in the shaded jar.
[INFO] Including org.geotools:gt-swing:jar:18.1 in the shaded jar.
[INFO] Including com.miglayout:miglayout:jar:swing:3.7 in the shaded jar.
[INFO] Including commons-io:commons-io:jar:2.4 in the shaded jar.
[INFO] Including net.sourceforge.javacsv:javacsv:jar:2.0 in the shaded jar.
[INFO] Including com.sun.xml.bind:jaxb-impl:jar:2.1.13 in the shaded jar.
[INFO] Including javax.xml.bind:jaxb-api:jar:2.1 in the shaded jar.
[INFO] Including javax.xml.stream:stax-api:jar:1.0-2 in the shaded jar.
[INFO] Including javax.activation:activation:jar:1.1 in the shaded jar.
[INFO] Including javax.media:jai_core:jar:1.1.3 in the shaded jar.
[INFO] Including org.apache.xmlgraphics:batik-svggen:jar:1.7 in the shaded jar.
[INFO] Including org.apache.xmlgraphics:batik-util:jar:1.7 in the shaded jar.
[INFO] Including xml-apis:xml-apis:jar:1.3.04 in the shaded jar.
[INFO] Including org.apache.xmlgraphics:batik-awt-util:jar:1.7 in the shaded jar.
[INFO] Including org.geotools:gt-epsg-wkt:jar:18.1 in the shaded jar.
[INFO] Including commons-cli:commons-cli:jar:1.4 in the shaded jar.

这与 mvn dependency:tree 的输出非常吻合。

关于java - 为什么 GeoTools 找不到 MutablePicoContainer#registerComponentImplementation 方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48807837/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com