jar文件无法加载“无法加载类”

时间:2015-10-19 05:20:30

标签: java exception exception-handling dmoz

我正在尝试使用此DMOZ解析code文件。但是,在运行代码之后,应用程序在开始时停止,产生以下异常:

    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
    at org.apache.hadoop.conf.Configuration.<clinit>(Configuration.java:146)
    at org.apache.nutch.util.NutchConfiguration.create(NutchConfiguration.java:59)
    at dmozparser.DmozParser.main(DmozParser.java:375)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 3 more

如果jar设置为no-operation,那么为什么他们在这段代码中使用它? (如果是这种情况,如果不是这样,那么)如何解决这个问题?

修改

根据this我添加了另一个jar,现在又有一个例外:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.hadoop.conf.Configuration.<clinit>(Configuration.java:146) at org.apache.nutch.util.NutchConfiguration.create(NutchConfiguration.java:59) at dmozparser.DmozParser.main(DmozParser.java:339) Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 3 more

编辑2

已添加commons-logging-1.2.jar,现在似乎有UnsupportedOperationException

Failed to set setXIncludeAware(true) for parser org.apache.xerces.jaxp.DocumentBuilderFactoryImpl@723279cf:java.lang.UnsupportedOperationException: setXIncludeAware is not supported on this JAXP implementation or earlier: class org.apache.xerces.jaxp.DocumentBuilderFactoryImpl java.lang.UnsupportedOperationException: setXIncludeAware is not supported on this JAXP implementation or earlier: class org.apache.xerces.jaxp.DocumentBuilderFactoryImpl at javax.xml.parsers.DocumentBuilderFactory.setXIncludeAware(DocumentBuilderFactory.java:584) at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:1131) at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:1107) at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:1053) at org.apache.hadoop.conf.Configuration.set(Configuration.java:420) at org.apache.nutch.util.NutchConfiguration.setUUID(NutchConfiguration.java:41) at org.apache.nutch.util.NutchConfiguration.create(NutchConfiguration.java:60) at dmozparser.DmozParser.main(DmozParser.java:339)

这似乎不支持org.apache.xerces.jaxp.DocumentBuilderFactoryImpl但是如何用适当的替换它?

0 个答案:

没有答案