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 Anisio Mendes Lacerda <an...@gmail.com> on 2008/04/02 18:51:33 UTC
Error msg: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/conf/Configuration
Hi,
me and my coleagues are implementing a small search engine in my University
Laboratory,
and we would like to use Hadoop as file system.
For now we are having troubles in running the following simple code example:
================================================
#include "hdfs.h"
int main(int argc, char **argv) {
hdfsFS fs = hdfsConnect("apolo.latin.dcc.ufmg.br", 51070);
if(!fs) {
fprintf(stderr, "Oops! Failed to connect to hdfs!\n");
exit(-1);
}
int result = hdfsDisconnect(fs);
if(!result) {
fprintf(stderr, "Oops! Failed to connect to hdfs!\n");
exit(-1);
}
}
================================================
The error msg is:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/hadoop/conf/Configuration
================================================
We configured the following enviroment variables:
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.13
export OS_NAME=linux
export OS_ARCH=i386
export LIBHDFS_BUILD_DIR=/mnt/hd1/hadoop/hadoop-0.14.4/libhdfs
export SHLIB_VERSION=1
export HADOOP_HOME=/mnt/hd1/hadoop/hadoop-0.14.4
export HADOOP_CONF_DIR=/mnt/hd1/hadoop/hadoop-0.14.4/conf
export HADOOP_LOG_DIR=/mnt/hd1/hadoop/hadoop-0.14.4/logs
The following commands were used to compile the codes:
In directory: hadoop-0.14.4/src/c++/libhdfs
1 - make all
2 - gcc -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.13/include/ -c my_hdfs_test.c
3 - gcc my_hdfs_test.o -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.13/include/
-L/mnt/hd1/hadoop/hadoop-0.14.4/libhdfs -lhdfs
-L/usr/lib/jvm/java-1.5.0-sun-1.5.0.13/jre/lib/i386/server -ljvm -o
my_hdfs_test
Obs:
The hadoop file system seems to be ok once we can run commands like this:
hadoop@apolo:/mnt/hd1/hadoop/hadoop-0.14.4$ bin/hadoop dfs -ls
Found 0 items
--
[]s
Anisio Mendes Lacerda
Re: Error msg: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/conf/Configuration
Posted by Anisio Mendes Lacerda <an...@gmail.com>.
Thanks a lot for help. Only for register I would like to post which
enviroment variables
I set:
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.13
export OS_NAME=linux
export OS_ARCH=i386
export LIBHDFS_BUILD_DIR=/mnt/hd1/hadoop/hadoop-0.14.4/libhdfs
export SHLIB_VERSION=1
export HADOOP_HOME=/mnt/hd1/hadoop/hadoop-0.14.4
export HADOOP_CONF_DIR=/mnt/hd1/hadoop/hadoop-0.14.4/conf
export HADOOP_LOG_DIR=/mnt/hd1/hadoop/hadoop-0.14.4/logs
export
LD_LIBRARY_PATH=/usr/lib/jvm/java-1.5.0-sun-1.5.0.13/jre/lib/i386/server:/mnt/hd1/hadoop/hadoop-0.14.4/libhdfs
export
CLASSPATH=/mnt/hd1/hadoop/hadoop-0.14.4/hadoop-0.14.4-core.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.13/jre/lib/i386:/usr/lib/jvm/java-1.5.0-sun-1.5.0.13/jre/lib/i386/server:/usr/lib/jvm/java-1.5.0-sun-1.5.0.13/jre/lib/i386/client:/usr/share/java:/usr/share/java/commons-logging-api.jar:/usr/share/java/:/usr/share/java/commons-logging.jar:/usr/share/java/log4j-1.2.jar
export
HADOOP_CLASSPATH=/mnt/hd1/hadoop/hadoop-0.14.4/hadoop-0.14.4-core.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.13/jre/lib/i386:/usr/lib/jvm/java-1.5.0-sun-1.5.0.13/jre/lib/i386/server:/usr/lib/jvm/java-1.5.0-sun-1.5.0.13/jre/lib/i386/client:/usr/share/java:/usr/share/java/commons-logging-api.jar:/usr/share/java/:/usr/share/java/commons-logging.jar:/usr/share/java/log4j-1.2.jar
See you,
Anisio
On Thu, Apr 3, 2008 at 8:51 AM, Peeyush Bishnoi <pe...@yahoo-inc.com>
wrote:
> Hello ,
>
> As this problem is related to CLASSPATh of hadoop , so just set the
> HADOOP_CLASSPATH or CLASSPATH with hadoop core jar
>
> ---
> Peeyush
>
>
> On Wed, 2008-04-02 at 13:51 -0300, Anisio Mendes Lacerda wrote:
>
> > Hi,
> >
> > me and my coleagues are implementing a small search engine in my
> University
> > Laboratory,
> > and we would like to use Hadoop as file system.
> >
> > For now we are having troubles in running the following simple code
> example:
> >
> > ================================================
> > #include "hdfs.h"
> > int main(int argc, char **argv) {
> > hdfsFS fs = hdfsConnect("apolo.latin.dcc.ufmg.br", 51070);
> > if(!fs) {
> > fprintf(stderr, "Oops! Failed to connect to hdfs!\n");
> > exit(-1);
> > }
> > int result = hdfsDisconnect(fs);
> > if(!result) {
> > fprintf(stderr, "Oops! Failed to connect to hdfs!\n");
> > exit(-1);
> > }
> > }
> > ================================================
> >
> > The error msg is:
> >
> > Exception in thread "main" java.lang.NoClassDefFoundError:
> > org/apache/hadoop/conf/Configuration
> >
> > ================================================
> >
> > We configured the following enviroment variables:
> >
> > export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.13
> > export OS_NAME=linux
> > export OS_ARCH=i386
> > export LIBHDFS_BUILD_DIR=/mnt/hd1/hadoop/hadoop-0.14.4/libhdfs
> > export SHLIB_VERSION=1
> >
> > export HADOOP_HOME=/mnt/hd1/hadoop/hadoop-0.14.4
> > export HADOOP_CONF_DIR=/mnt/hd1/hadoop/hadoop-0.14.4/conf
> > export HADOOP_LOG_DIR=/mnt/hd1/hadoop/hadoop-0.14.4/logs
> >
> > The following commands were used to compile the codes:
> >
> > In directory: hadoop-0.14.4/src/c++/libhdfs
> >
> > 1 - make all
> > 2 - gcc -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.13/include/ -c
> my_hdfs_test.c
> > 3 - gcc my_hdfs_test.o -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.13/include/
> > -L/mnt/hd1/hadoop/hadoop-0.14.4/libhdfs -lhdfs
> > -L/usr/lib/jvm/java-1.5.0-sun-1.5.0.13/jre/lib/i386/server -ljvm -o
> > my_hdfs_test
> >
> > Obs:
> >
> > The hadoop file system seems to be ok once we can run commands like
> this:
> >
> > hadoop@apolo:/mnt/hd1/hadoop/hadoop-0.14.4$ bin/hadoop dfs -ls
> > Found 0 items
> >
> >
> >
> >
> >
> >
>
--
[]s
Anisio Mendes Lacerda
Re: Error msg: Exception in thread "main"
java.lang.NoClassDefFoundError: org/apache/hadoop/conf/Configuration
Posted by Peeyush Bishnoi <pe...@yahoo-inc.com>.
Hello ,
As this problem is related to CLASSPATh of hadoop , so just set the
HADOOP_CLASSPATH or CLASSPATH with hadoop core jar
---
Peeyush
On Wed, 2008-04-02 at 13:51 -0300, Anisio Mendes Lacerda wrote:
> Hi,
>
> me and my coleagues are implementing a small search engine in my University
> Laboratory,
> and we would like to use Hadoop as file system.
>
> For now we are having troubles in running the following simple code example:
>
> ================================================
> #include "hdfs.h"
> int main(int argc, char **argv) {
> hdfsFS fs = hdfsConnect("apolo.latin.dcc.ufmg.br", 51070);
> if(!fs) {
> fprintf(stderr, "Oops! Failed to connect to hdfs!\n");
> exit(-1);
> }
> int result = hdfsDisconnect(fs);
> if(!result) {
> fprintf(stderr, "Oops! Failed to connect to hdfs!\n");
> exit(-1);
> }
> }
> ================================================
>
> The error msg is:
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/hadoop/conf/Configuration
>
> ================================================
>
> We configured the following enviroment variables:
>
> export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.13
> export OS_NAME=linux
> export OS_ARCH=i386
> export LIBHDFS_BUILD_DIR=/mnt/hd1/hadoop/hadoop-0.14.4/libhdfs
> export SHLIB_VERSION=1
>
> export HADOOP_HOME=/mnt/hd1/hadoop/hadoop-0.14.4
> export HADOOP_CONF_DIR=/mnt/hd1/hadoop/hadoop-0.14.4/conf
> export HADOOP_LOG_DIR=/mnt/hd1/hadoop/hadoop-0.14.4/logs
>
> The following commands were used to compile the codes:
>
> In directory: hadoop-0.14.4/src/c++/libhdfs
>
> 1 - make all
> 2 - gcc -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.13/include/ -c my_hdfs_test.c
> 3 - gcc my_hdfs_test.o -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.13/include/
> -L/mnt/hd1/hadoop/hadoop-0.14.4/libhdfs -lhdfs
> -L/usr/lib/jvm/java-1.5.0-sun-1.5.0.13/jre/lib/i386/server -ljvm -o
> my_hdfs_test
>
> Obs:
>
> The hadoop file system seems to be ok once we can run commands like this:
>
> hadoop@apolo:/mnt/hd1/hadoop/hadoop-0.14.4$ bin/hadoop dfs -ls
> Found 0 items
>
>
>
>
>
>