示例WorldWind应用程序在启动时遇到AbstractMethodError [英] Example WorldWind application encounters AbstractMethodError when started
问题描述
我的任务是使用WorldWind API创建应用程序,为了熟悉API,我尝试运行HelloWorldWind示例应用程序。当我这样做时,我得到以下错误堆栈:
I've been tasked with creating an application using the WorldWind API, and to familiarize myself with the API, I tried running the "HelloWorldWind" example app. When I do, I get the following error stack:
Exception in thread "main" java.lang.AbstractMethodError: javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
at gov.nasa.worldwind.util.WWXML.createDocumentBuilder(WWXML.java:61)
at gov.nasa.worldwind.util.WWXML.openDocumentStream(WWXML.java:236)
at gov.nasa.worldwind.util.WWXML.openDocumentStream(WWXML.java:223)
at gov.nasa.worldwind.util.WWXML.openDocumentFile(WWXML.java:175)
at gov.nasa.worldwind.util.WWXML.openDocument(WWXML.java:148)
at gov.nasa.worldwind.Configuration.loadConfigDoc(Configuration.java:131)
at gov.nasa.worldwind.Configuration.<init>(Configuration.java:108)
at gov.nasa.worldwind.Configuration.<clinit>(Configuration.java:76)
at gov.nasa.worldwindx.examples.HelloWorldWind.main(HelloWorldWind.java:
WWXML.createDocumentBuilder
如下:
public static DocumentBuilder createDocumentBuilder(boolean isNamespaceAware)
{
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
docBuilderFactory.setNamespaceAware(isNamespaceAware);
if (Configuration.getJavaVersion() >= 1.6)
{
try
{
docBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",
false); // Not getting past here
}
catch (ParserConfigurationException e)
{ // Note it and continue on. Some Java5 parsers don't support the feature.
String message = Logging.getMessage("XML.NonvalidatingNotSupported");
Logging.logger().finest(message);
}
}
...
在线阅读一些内容,人们责怪 jogl
,因为我在64位系统上运行,但是,我的构建路径中已经有了必要的jar。 此外,在浏览器中尝试上面显示的URL会返回404页面,这让我觉得可能是原因 URL只是一种格式化某些首选项的方法。由于我没有 DocumentBuilderFactory.setFeature
的来源,我无法看到那里有什么混乱。
Reading some stuff online, people are blaming jogl
, since I'm running on a 64-bit system, however, I already have the necessary jars in my build path. Additionally, trying the URL shown above in a browser returns a 404 page, which makes me think that might be the causeThe URL is just a way to format some preferences. Since I don't have the source for DocumentBuilderFactory.setFeature
, I can't see what's messing up in there.
我的问题实际上是 jogl
还是其他什么?
Is my problem actually with jogl
, or something else?
推荐答案
This is a classpath issue of some sort. AbstractMethodError
is thrown when the JVM tries to invoke an abstract method (which is not allowed). DocumentBuilderFactory.setFeature(String, boolean)
is an abstract method that was added to DocumentBuilderFactory in JavaSE 5, so implementations compiled against the J2SE 1.4.2 version would not have that method and this error would occur when setFeature(String, boolean)
was called on them.
您的类路径上可能有一个旧的XML库,它返回的实例DocumetnBuilderFactory.newInstance()
。问题可能不在于JOGL本身,它可能只是JOGL将旧的XML库作为依赖项引入。
It is possible you have a old XML library on your classpath that returned an instance for DocumetnBuilderFactory.newInstance()
. The problem may not be with JOGL, per se, it may just be that JOGL brought in an old XML library as a dependency.
这篇关于示例WorldWind应用程序在启动时遇到AbstractMethodError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!