You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Khanh Nguyen <kn...@cs.umb.edu> on 2008/07/11 19:13:15 UTC

Issue adding hadoop-core.jar to project's build path

Hello,

I am new to Hadoop. I am currently working on a small project for the
Internet Archive's web crawler, Heritrix. My work requires me to use
Hadoop but I am running in a strange problem. As soon as I add
hadoop-core.jar to my project build path, junit tests in Heritrix ran
into problem with loggers. Please help.

If it helps, here is the stack trace

java.lang.ExceptionInInitializerError
	at org.archive.net.LaxURI.decode(LaxURI.java:125)
	at org.archive.net.LaxURI.decode(LaxURI.java:112)
	at org.archive.net.LaxURI.getPath(LaxURI.java:96)
	at org.archive.modules.extractor.ExtractorHTML.isHtmlExpectedHere(ExtractorHTML.java:686)
	at org.archive.modules.extractor.ExtractorHTML.shouldExtract(ExtractorHTML.java:543)
	at org.archive.modules.extractor.ContentExtractor.shouldProcess(ContentExtractor.java:74)
	at org.archive.modules.Processor.process(Processor.java:121)
	at org.archive.modules.extractor.StringExtractorTestBase.testOne(StringExtractorTestBase.java:69)
	at org.archive.modules.extractor.StringExtractorTestBase.testExtraction(StringExtractorTestBase.java:48)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at junit.framework.TestCase.runTest(TestCase.java:164)
	at junit.framework.TestCase.runBare(TestCase.java:130)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:120)
	at junit.framework.TestSuite.runTest(TestSuite.java:230)
	at junit.framework.TestSuite.run(TestSuite.java:225)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException: No suitable Log
constructor [Ljava.lang.Class;@1ea2dfe for
org.apache.commons.logging.impl.Log4JLogger (Caused by
java.lang.NoClassDefFoundError: org/apache/log4j/Category) (Caused by
org.apache.commons.logging.LogConfigurationException: No suitable Log
constructor [Ljava.lang.Class;@1ea2dfe for
org.apache.commons.logging.impl.Log4JLogger (Caused by
java.lang.NoClassDefFoundError: org/apache/log4j/Category))
	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
	at org.apache.commons.httpclient.util.EncodingUtil.<clinit>(EncodingUtil.java:54)
	... 27 more
Caused by: org.apache.commons.logging.LogConfigurationException: No
suitable Log constructor [Ljava.lang.Class;@1ea2dfe for
org.apache.commons.logging.impl.Log4JLogger (Caused by
java.lang.NoClassDefFoundError: org/apache/log4j/Category)
	at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413)
	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
	... 31 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
	at java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
	at java.lang.Class.getConstructor0(Class.java:2699)
	at java.lang.Class.getConstructor(Class.java:1657)
	at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410)
	... 32 more
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Category
	at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
	... 37 more





Thanks.

-k

Re: Issue adding hadoop-core.jar to project's build path

Posted by Khanh Nguyen <kn...@cs.umb.edu>.
Thank you very much. It works wonder !

On Fri, Jul 11, 2008 at 4:13 PM, tim robertson
<ti...@gmail.com> wrote:
> You need a Log4J on the classpath I think..."Caused
> by java.lang.NoClassDefFoundError: org/apache/log4j/Category"
>
> Cheers
>
> Tim
>
>
> On Fri, Jul 11, 2008 at 7:13 PM, Khanh Nguyen <kn...@cs.umb.edu> wrote:
>
>> Hello,
>>
>> I am new to Hadoop. I am currently working on a small project for the
>> Internet Archive's web crawler, Heritrix. My work requires me to use
>> Hadoop but I am running in a strange problem. As soon as I add
>> hadoop-core.jar to my project build path, junit tests in Heritrix ran
>> into problem with loggers. Please help.
>>
>> If it helps, here is the stack trace
>>
>> java.lang.ExceptionInInitializerError
>>        at org.archive.net.LaxURI.decode(LaxURI.java:125)
>>        at org.archive.net.LaxURI.decode(LaxURI.java:112)
>>        at org.archive.net.LaxURI.getPath(LaxURI.java:96)
>>        at
>> org.archive.modules.extractor.ExtractorHTML.isHtmlExpectedHere(ExtractorHTML.java:686)
>>        at
>> org.archive.modules.extractor.ExtractorHTML.shouldExtract(ExtractorHTML.java:543)
>>        at
>> org.archive.modules.extractor.ContentExtractor.shouldProcess(ContentExtractor.java:74)
>>        at org.archive.modules.Processor.process(Processor.java:121)
>>        at
>> org.archive.modules.extractor.StringExtractorTestBase.testOne(StringExtractorTestBase.java:69)
>>        at
>> org.archive.modules.extractor.StringExtractorTestBase.testExtraction(StringExtractorTestBase.java:48)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>        at junit.framework.TestCase.runTest(TestCase.java:164)
>>        at junit.framework.TestCase.runBare(TestCase.java:130)
>>        at junit.framework.TestResult$1.protect(TestResult.java:106)
>>        at junit.framework.TestResult.runProtected(TestResult.java:124)
>>        at junit.framework.TestResult.run(TestResult.java:109)
>>        at junit.framework.TestCase.run(TestCase.java:120)
>>        at junit.framework.TestSuite.runTest(TestSuite.java:230)
>>        at junit.framework.TestSuite.run(TestSuite.java:225)
>>        at
>> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
>>        at
>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>>        at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
>>        at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
>>        at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
>>        at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
>> Caused by: org.apache.commons.logging.LogConfigurationException:
>> org.apache.commons.logging.LogConfigurationException: No suitable Log
>> constructor [Ljava.lang.Class;@1ea2dfe for
>> org.apache.commons.logging.impl.Log4JLogger (Caused by
>> java.lang.NoClassDefFoundError: org/apache/log4j/Category) (Caused by
>> org.apache.commons.logging.LogConfigurationException: No suitable Log
>> constructor [Ljava.lang.Class;@1ea2dfe for
>> org.apache.commons.logging.impl.Log4JLogger (Caused by
>> java.lang.NoClassDefFoundError: org/apache/log4j/Category))
>>        at
>> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
>>        at
>> org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
>>        at
>> org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
>>        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
>>        at
>> org.apache.commons.httpclient.util.EncodingUtil.<clinit>(EncodingUtil.java:54)
>>        ... 27 more
>> Caused by: org.apache.commons.logging.LogConfigurationException: No
>> suitable Log constructor [Ljava.lang.Class;@1ea2dfe for
>> org.apache.commons.logging.impl.Log4JLogger (Caused by
>> java.lang.NoClassDefFoundError: org/apache/log4j/Category)
>>        at
>> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413)
>>        at
>> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
>>        ... 31 more
>> Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
>>        at java.lang.Class.getDeclaredConstructors0(Native Method)
>>        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
>>        at java.lang.Class.getConstructor0(Class.java:2699)
>>        at java.lang.Class.getConstructor(Class.java:1657)
>>        at
>> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410)
>>        ... 32 more
>> Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Category
>>        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>>        at java.security.AccessController.doPrivileged(Native Method)
>>        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>>        ... 37 more
>>
>>
>>
>>
>>
>> Thanks.
>>
>> -k
>>
>

Re: Issue adding hadoop-core.jar to project's build path

Posted by tim robertson <ti...@gmail.com>.
You need a Log4J on the classpath I think..."Caused
by java.lang.NoClassDefFoundError: org/apache/log4j/Category"

Cheers

Tim


On Fri, Jul 11, 2008 at 7:13 PM, Khanh Nguyen <kn...@cs.umb.edu> wrote:

> Hello,
>
> I am new to Hadoop. I am currently working on a small project for the
> Internet Archive's web crawler, Heritrix. My work requires me to use
> Hadoop but I am running in a strange problem. As soon as I add
> hadoop-core.jar to my project build path, junit tests in Heritrix ran
> into problem with loggers. Please help.
>
> If it helps, here is the stack trace
>
> java.lang.ExceptionInInitializerError
>        at org.archive.net.LaxURI.decode(LaxURI.java:125)
>        at org.archive.net.LaxURI.decode(LaxURI.java:112)
>        at org.archive.net.LaxURI.getPath(LaxURI.java:96)
>        at
> org.archive.modules.extractor.ExtractorHTML.isHtmlExpectedHere(ExtractorHTML.java:686)
>        at
> org.archive.modules.extractor.ExtractorHTML.shouldExtract(ExtractorHTML.java:543)
>        at
> org.archive.modules.extractor.ContentExtractor.shouldProcess(ContentExtractor.java:74)
>        at org.archive.modules.Processor.process(Processor.java:121)
>        at
> org.archive.modules.extractor.StringExtractorTestBase.testOne(StringExtractorTestBase.java:69)
>        at
> org.archive.modules.extractor.StringExtractorTestBase.testExtraction(StringExtractorTestBase.java:48)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at junit.framework.TestCase.runTest(TestCase.java:164)
>        at junit.framework.TestCase.runBare(TestCase.java:130)
>        at junit.framework.TestResult$1.protect(TestResult.java:106)
>        at junit.framework.TestResult.runProtected(TestResult.java:124)
>        at junit.framework.TestResult.run(TestResult.java:109)
>        at junit.framework.TestCase.run(TestCase.java:120)
>        at junit.framework.TestSuite.runTest(TestSuite.java:230)
>        at junit.framework.TestSuite.run(TestSuite.java:225)
>        at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
>        at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>        at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
>        at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
>        at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
>        at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.apache.commons.logging.LogConfigurationException:
> org.apache.commons.logging.LogConfigurationException: No suitable Log
> constructor [Ljava.lang.Class;@1ea2dfe for
> org.apache.commons.logging.impl.Log4JLogger (Caused by
> java.lang.NoClassDefFoundError: org/apache/log4j/Category) (Caused by
> org.apache.commons.logging.LogConfigurationException: No suitable Log
> constructor [Ljava.lang.Class;@1ea2dfe for
> org.apache.commons.logging.impl.Log4JLogger (Caused by
> java.lang.NoClassDefFoundError: org/apache/log4j/Category))
>        at
> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
>        at
> org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
>        at
> org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
>        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
>        at
> org.apache.commons.httpclient.util.EncodingUtil.<clinit>(EncodingUtil.java:54)
>        ... 27 more
> Caused by: org.apache.commons.logging.LogConfigurationException: No
> suitable Log constructor [Ljava.lang.Class;@1ea2dfe for
> org.apache.commons.logging.impl.Log4JLogger (Caused by
> java.lang.NoClassDefFoundError: org/apache/log4j/Category)
>        at
> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413)
>        at
> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
>        ... 31 more
> Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
>        at java.lang.Class.getDeclaredConstructors0(Native Method)
>        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
>        at java.lang.Class.getConstructor0(Class.java:2699)
>        at java.lang.Class.getConstructor(Class.java:1657)
>        at
> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410)
>        ... 32 more
> Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Category
>        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>        ... 37 more
>
>
>
>
>
> Thanks.
>
> -k
>