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 Ryan Cole <ry...@rycole.com> on 2012/04/30 17:15:36 UTC

Can't construct instance of class org.apache.hadoop.conf.Configuration

Hello,

I'm trying to run an application, written in C++, that uses libhdfs. I have
compiled the code and get an error when I attempt to run the application.
The error that I am getting is as follows: "Can't construct instance of
class org.apache.hadoop.conf.Configuration".

Initially, I was receiving an error saying that CLASSPATH was not set. That
was easy, so I set CLASSPATH to include the following three directories, in
this order:


   1. $HADOOP_HOME
   2. $HADOOP_HOME/lib
   3. $HADOOP_HOME/conf

The CLASSPATH not set error went away, and now I receive the error about
the Configuration class. I'm assuming that I do not have something on the
path that I need to, but everything I have read says to simply include
these three directories.

Does anybody have any idea what I might be missing? Full exception pasted
below.

Thanks,
Ryan

Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/hadoop/conf/Configuration
> Caused by: java.lang.ClassNotFoundException:
> org.apache.hadoop.conf.Configuration
>         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)
> Can't construct instance of class org.apache.hadoop.conf.Configuration
> node: /home/ryan/.node-gyp/0.7.8/src/node_object_wrap.h:61: void
> node::ObjectWrap::Wrap(v8::Handle<v8::Object>): Assertion
> `handle_.IsEmpty()' failed.
> Aborted (core dumped)

Re: Can't construct instance of class org.apache.hadoop.conf.Configuration

Posted by Ryan Cole <ry...@rycole.com>.
Brock,

Ah, thanks. I did not realize that you could do that. That sets the correct
CLASSPATH! Thanks.

Ryan

On Mon, Apr 30, 2012 at 10:22 AM, Brock Noland <br...@cloudera.com> wrote:

> Hi,
>
> I would try this:
>
> export CLASSPATH=$(hadoop classpath)
>
> Brock
>
> On Mon, Apr 30, 2012 at 10:15 AM, Ryan Cole <ry...@rycole.com> wrote:
> > Hello,
> >
> > I'm trying to run an application, written in C++, that uses libhdfs. I
> have
> > compiled the code and get an error when I attempt to run the application.
> > The error that I am getting is as follows: "Can't construct instance of
> > class org.apache.hadoop.conf.Configuration".
> >
> > Initially, I was receiving an error saying that CLASSPATH was not set.
> That
> > was easy, so I set CLASSPATH to include the following three directories,
> in
> > this order:
> >
> >
> >   1. $HADOOP_HOME
> >   2. $HADOOP_HOME/lib
> >   3. $HADOOP_HOME/conf
> >
> > The CLASSPATH not set error went away, and now I receive the error about
> > the Configuration class. I'm assuming that I do not have something on the
> > path that I need to, but everything I have read says to simply include
> > these three directories.
> >
> > Does anybody have any idea what I might be missing? Full exception pasted
> > below.
> >
> > Thanks,
> > Ryan
> >
> > Exception in thread "main" java.lang.NoClassDefFoundError:
> >> org/apache/hadoop/conf/Configuration
> >> Caused by: java.lang.ClassNotFoundException:
> >> org.apache.hadoop.conf.Configuration
> >>         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)
> >> Can't construct instance of class org.apache.hadoop.conf.Configuration
> >> node: /home/ryan/.node-gyp/0.7.8/src/node_object_wrap.h:61: void
> >> node::ObjectWrap::Wrap(v8::Handle<v8::Object>): Assertion
> >> `handle_.IsEmpty()' failed.
> >> Aborted (core dumped)
>
>
>
> --
> Apache MRUnit - Unit testing MapReduce -
> http://incubator.apache.org/mrunit/
>

Re: Can't construct instance of class org.apache.hadoop.conf.Configuration

Posted by Brock Noland <br...@cloudera.com>.
Hi,

I would try this:

export CLASSPATH=$(hadoop classpath)

Brock

On Mon, Apr 30, 2012 at 10:15 AM, Ryan Cole <ry...@rycole.com> wrote:
> Hello,
>
> I'm trying to run an application, written in C++, that uses libhdfs. I have
> compiled the code and get an error when I attempt to run the application.
> The error that I am getting is as follows: "Can't construct instance of
> class org.apache.hadoop.conf.Configuration".
>
> Initially, I was receiving an error saying that CLASSPATH was not set. That
> was easy, so I set CLASSPATH to include the following three directories, in
> this order:
>
>
>   1. $HADOOP_HOME
>   2. $HADOOP_HOME/lib
>   3. $HADOOP_HOME/conf
>
> The CLASSPATH not set error went away, and now I receive the error about
> the Configuration class. I'm assuming that I do not have something on the
> path that I need to, but everything I have read says to simply include
> these three directories.
>
> Does anybody have any idea what I might be missing? Full exception pasted
> below.
>
> Thanks,
> Ryan
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
>> org/apache/hadoop/conf/Configuration
>> Caused by: java.lang.ClassNotFoundException:
>> org.apache.hadoop.conf.Configuration
>>         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)
>> Can't construct instance of class org.apache.hadoop.conf.Configuration
>> node: /home/ryan/.node-gyp/0.7.8/src/node_object_wrap.h:61: void
>> node::ObjectWrap::Wrap(v8::Handle<v8::Object>): Assertion
>> `handle_.IsEmpty()' failed.
>> Aborted (core dumped)



-- 
Apache MRUnit - Unit testing MapReduce - http://incubator.apache.org/mrunit/