Example WorldWind application encounters AbstractMethodError when started

流过昼夜 提交于 2019-12-05 03:58:40

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.

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.

You need go to class WWXML and replace:

docBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",
                false);

with:

docBuilderFactory.setNamespaceAware(true);

the complete method on java is:

    public static DocumentBuilder createDocumentBuilder(boolean isNamespaceAware)
{
    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();

    docBuilderFactory.setNamespaceAware(isNamespaceAware);

    if (Configuration.getJavaVersion() >= 1.6)
    {
        docBuilderFactory.setNamespaceAware(true);
    }

    try
    {
        return docBuilderFactory.newDocumentBuilder();
    }
    catch (ParserConfigurationException e)
    {
        String message = Logging.getMessage("XML.ParserConfigurationException");
        Logging.logger().finest(message);
        throw new WWRuntimeException(e);
    }
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!