- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我刚刚开始使用 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
<小时/>请帮忙,这花费了我很多时间进行调试,而且我不知道它可能是什么。
最佳答案
我几乎可以构建 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/
我想了解 Ruby 方法 methods() 是如何工作的。 我尝试使用“ruby 方法”在 Google 上搜索,但这不是我需要的。 我也看过 ruby-doc.org,但我没有找到这种方法。
Test 方法 对指定的字符串执行一个正则表达式搜索,并返回一个 Boolean 值指示是否找到匹配的模式。 object.Test(string) 参数 object 必选项。总是一个
Replace 方法 替换在正则表达式查找中找到的文本。 object.Replace(string1, string2) 参数 object 必选项。总是一个 RegExp 对象的名称。
Raise 方法 生成运行时错误 object.Raise(number, source, description, helpfile, helpcontext) 参数 object 应为
Execute 方法 对指定的字符串执行正则表达式搜索。 object.Execute(string) 参数 object 必选项。总是一个 RegExp 对象的名称。 string
Clear 方法 清除 Err 对象的所有属性设置。 object.Clear object 应为 Err 对象的名称。 说明 在错误处理后,使用 Clear 显式地清除 Err 对象。此
CopyFile 方法 将一个或多个文件从某位置复制到另一位置。 object.CopyFile source, destination[, overwrite] 参数 object 必选
Copy 方法 将指定的文件或文件夹从某位置复制到另一位置。 object.Copy destination[, overwrite] 参数 object 必选项。应为 File 或 F
Close 方法 关闭打开的 TextStream 文件。 object.Close object 应为 TextStream 对象的名称。 说明 下面例子举例说明如何使用 Close 方
BuildPath 方法 向现有路径后添加名称。 object.BuildPath(path, name) 参数 object 必选项。应为 FileSystemObject 对象的名称
GetFolder 方法 返回与指定的路径中某文件夹相应的 Folder 对象。 object.GetFolder(folderspec) 参数 object 必选项。应为 FileSy
GetFileName 方法 返回指定路径(不是指定驱动器路径部分)的最后一个文件或文件夹。 object.GetFileName(pathspec) 参数 object 必选项。应为
GetFile 方法 返回与指定路径中某文件相应的 File 对象。 object.GetFile(filespec) 参数 object 必选项。应为 FileSystemObject
GetExtensionName 方法 返回字符串,该字符串包含路径最后一个组成部分的扩展名。 object.GetExtensionName(path) 参数 object 必选项。应
GetDriveName 方法 返回包含指定路径中驱动器名的字符串。 object.GetDriveName(path) 参数 object 必选项。应为 FileSystemObjec
GetDrive 方法 返回与指定的路径中驱动器相对应的 Drive 对象。 object.GetDrive drivespec 参数 object 必选项。应为 FileSystemO
GetBaseName 方法 返回字符串,其中包含文件的基本名 (不带扩展名), 或者提供的路径说明中的文件夹。 object.GetBaseName(path) 参数 object 必
GetAbsolutePathName 方法 从提供的指定路径中返回完整且含义明确的路径。 object.GetAbsolutePathName(pathspec) 参数 object
FolderExists 方法 如果指定的文件夹存在,则返回 True;否则返回 False。 object.FolderExists(folderspec) 参数 object 必选项
FileExists 方法 如果指定的文件存在返回 True;否则返回 False。 object.FileExists(filespec) 参数 object 必选项。应为 FileS
我是一名优秀的程序员,十分优秀!