lonesome
lonesome

Reputation: 2542

jar file failed to be load "Failed to load class"

I am trying to parse a DMOZ file, using this code. However, after running the code, the application stops at the beginning, producing following exceptions:

    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

If the jar is set to be no-operation, then why they used it in this piece of code? (if that is the case and if it is not the case, then) How to fix this issue?

EDIT

according to this I added another jar and now there is another exception:

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

EDIT 2

Added commons-logging-1.2.jar and now it seems there is an 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)

This seems that org.apache.xerces.jaxp.DocumentBuilderFactoryImpl is not supported but how to replace it with an appropriate one?

Upvotes: 0

Views: 1221

Answers (0)

Related Questions