Tuesday, 15 September 2015

java.lang.ClassNotFoundException: org.apache.hadoop.conf.Configuration -


I keep getting this error. I have included Hap Commons and Core Libs in classpath but still I'm getting it error. Support will be highly appreciated

Here's the way to troubleshoot: Look inside the jar which you perform To see if that class file is actually there:

  jar tvf target / my-jar-with-dependencies.jar | Grep hasoop / conf / configuration.class  

If it is not, you need to add it to your classpath or your jar will be packed.

What are you using Maven or some similar construction equipment? You can have a dependency with 'Scope', which means that it will be compiled only in your jar in certain circumstances.

  & lt; Dependency & gt; & Lt; Group & gt; Org.apache.hadoop & lt; / Group & gt; & Lt; ArtifactId & gt; Hadoop-Client & lt; / ArtifactId> & Lt; Version & gt; $ {Hasoop.version} & lt; / Edition & gt; & Lt; Scope & gt; Provided & lt; / Scope & gt; & Lt; / Dependencies & gt;  

In this example, the scope tag tells mewen that you are using this dependency for the building, but this indicates that dependency will be provided during runtime, so you Either add or remove the hayadip jar during this Runtime using -cp = / path / to / jar.jar . Another example of this kind of scope is 'test', which indicates that only the jar is needed in the path during the unit tests.


No comments:

Post a Comment