English 中文(简体)
地理名称例外 -- -- 由下列原因造成:java.lang.Class nonFoundFoundExpendation: org.jdom.input.SA Xuduild
原标题:geonames exception - Caused by: java.lang.ClassNotFoundException: org.jdom.input.SAXBuilder

我试图运行一个软件, 如果一个实体是地理上的或不是地理上的, 我可以用这个软件去破坏:

public boolean isgeo(String e) throws Exception{

    ToponymSearchCriteria searchCriteria = new ToponymSearchCriteria();
    searchCriteria.setNameEquals(e);
    ToponymSearchResult searchResult = WebService.search(searchCriteria);
    entity = (ArrayList) searchResult.getToponyms();
    for (Toponym toponym : searchResult.getToponyms()) {
         System.out.println(toponym.getName()+" "+ toponym.getCountryName());
      }

    if(entity.size()>0)
        return true;
    else
        return false;

}

但当我调用这个函数时,我有这些例外:

Exception in thread "main" java.lang.NoClassDefFoundError: org/jdom/input/SAXBuilder
at org.geonames.WebService.connectAndParse(Unknown Source)
at org.geonames.WebService.search(Unknown Source)
at geonames.utility.isgeo(utility.java:35)
at geonames.main.main(main.java:31)
Caused by: java.lang.ClassNotFoundException: org.jdom.input.SAXBuilder
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)

有人能帮我吗?

问题回答

您需要 jdom- 1.0 jar. 不要下载任何其他版本, 因为它不会工作。 添加此 jar 文件到您的工程中 。





相关问题
handling exceptions IN Action Filters

Is there a better way to handle exceptions that occur inside an Action Filter itself in ASP .NET MVC? There re 2 ways I can think of at the moment. Using a try catch and setting the HTTP Status ...

既可捕获,又可举出例外。

我有一种办法,可以进入亚洲开发银行,因此,我国的亚行在多瑙河航道中的所有 st子都位于一个试捕区。 它正在追捕Kexception

Cross compiler exception handling - Can it be done safely?

I am doing some maintenance on a C++ windows dll library that is required to work with different VC++ compilers (as I don’t want to address different mangling schemes). I have already eliminated any ...

File Handling Issue

I am developing a tool in c#, at one instance I start writing into a xml file continuously using my tool,when i suddenly restart my machine the particular xml file gets corrupted, what is the reason ...

Watch a memory location/install data breakpoint from code?

We have a memory overwrite problem. At some point, during the course of our program, a memory location is being overwritten and causing our program to crash. the problem happens only in release mode. ...

Unit Test for Exceptions Message

Is there a simple (Attribute-driven) way to have the following test fail on the message of the exception. [TestMethod()] [ExpectedException(typeof(ArgumentException))] public void ExceptionTestTest() ...

热门标签