日期:2014-05-16  浏览次数:20607 次

hadoop平台搭建出现问题,麻烦高手给解决一下~
这两天在linux上搭建hadoop平台,JDK,无密码SSH登陆都弄好了,java的hello world程序也跑出来了,我觉得JDK应该没问题了,今天装好了hadoop,然后用./bin/hadoop dfsadmin -report命令查看集群命令,结果出现一下错误
hadoop@ubuntu:/opt/hadoop/hadoop-0.20.2$ ./bin/hadoop dfsadmin -report
Exception in thread "main" java.lang.NoClassDefFoundError: javax/net/SocketFactory
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:762)
at org.apache.hadoop.net.NetUtils.getSocketFactoryFromProperty(NetUtils.java:109)
at org.apache.hadoop.net.NetUtils.getDefaultSocketFactory(NetUtils.java:93)
at org.apache.hadoop.net.NetUtils.getSocketFactory(NetUtils.java:73)
at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:186)
at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:170)
at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:82)
at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:1378)
at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:66)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1390)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:196)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:95)
at org.apache.hadoop.fs.FsShell.init(FsShell.java:82)
at org.apache.hadoop.hdfs.tools.DFSAdmin.run(DFSAdmin.java:767)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:79)
at org.apache.hadoop.hdfs.tools.DFSAdmin.main(DFSAdmin.java:846)
Caused by: java.lang.ClassNotFoundException: javax.net.SocketFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 31 more
我查了一下网上有人说是JDK环境变量没有配置好,我的环境变量配置如下:
在/etc/profile.d下新建文件java.sh,然后把权限改到最高了。。。java.sh内容如下:
#set jdk environment
export JAVA_HOME=/usr/local/jdk-1.6.0_25/usr/java/jdk1.6.0_25
export JRE_HOME-/usr/local/jdk-1.6.0_25/usr/java/jdk1.6.0_25/jre
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
到底是怎么解决呀,麻烦各位高手了~小弟非常感谢!!!!!

------解决方案--------------------
这句里的等号怎么写错减号了
export JRE_HOME-/usr/local/jdk-1.6.0_25/usr/java/jdk1.6.0_25/jre

另外环境变量是否配置好 在命令行分别输出一下
echo $JAVA_HOME
echo $JRE_HOME
echo $CLASSPATH