通过网友的帮助,打印加载路径地址,发现果然有个类在其他地方里存在,如下:
[[email protected] ~]$ hive
file:/home/hadoop/hadoop-1.0.3/conf/
file:/home/hadoop/jrockit-jdk1.6.0_29/lib/tools.jar
file:/home/hadoop/hadoop-1.0.3/
file:/home/hadoop/hadoop-1.0.3/hadoop-core-1.0.3.jar
file:/home/hadoop/hadoop-1.0.3/lib/asm-3.2.jar
file:/home/hadoop/hadoop-1.0.3/lib/aspectjrt-1.6.5.jar
file:/home/hadoop/hadoop-1.0.3/lib/aspectjtools-1.6.5.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-beanutils-1.7.0.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-beanutils-core-1.8.0.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-cli-1.2.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-codec-1.4.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-collections-3.2.1.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-configuration-1.6.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-daemon-1.0.1.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-digester-1.8.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-el-1.0.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-httpclient-3.0.1.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-io-2.1.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-lang-2.4.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-logging-1.1.1.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-logging-api-1.0.4.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-math-2.1.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-net-1.4.1.jar
file:/home/hadoop/hadoop-1.0.3/lib/core-3.1.1.jar
file:/home/hadoop/hadoop-1.0.3/lib/hadoop-capacity-scheduler-1.0.3.jar
file:/home/hadoop/hadoop-1.0.3/lib/hadoop-fairscheduler-1.0.3.jar
file:/home/hadoop/hadoop-1.0.3/lib/hadoop-thriftfs-1.0.3.jar
file:/home/hadoop/hadoop-1.0.3/lib/hbase-0.94.2.jar
file:/home/hadoop/hadoop-1.0.3/lib/hive-shims-0.9.0.jar
file:/home/hadoop/hadoop-1.0.3/lib/hsqldb-1.8.0.10.jar
file:/home/hadoop/hadoop-1.0.3/lib/jackson-core-asl-1.8.8.jar
file:/home/hadoop/hadoop-1.0.3/lib/jackson-mapper-asl-1.8.8.jar
file:/home/hadoop/hadoop-1.0.3/lib/jasper-compiler-5.5.12.jar
file:/home/hadoop/hadoop-1.0.3/lib/jasper-runtime-5.5.12.jar
file:/home/hadoop/hadoop-1.0.3/lib/jdeb-0.8.jar
file:/home/hadoop/hadoop-1.0.3/lib/jersey-core-1.8.jar
file:/home/hadoop/hadoop-1.0.3/lib/jersey-json-1.8.jar
file:/home/hadoop/hadoop-1.0.3/lib/jersey-server-1.8.jar
file:/home/hadoop/hadoop-1.0.3/lib/jets3t-0.6.1.jar
file:/home/hadoop/hadoop-1.0.3/lib/jetty-6.1.26.jar
file:/home/hadoop/hadoop-1.0.3/lib/jetty-util-6.1.26.jar
file:/home/hadoop/hadoop-1.0.3/lib/jsch-0.1.42.jar
file:/home/hadoop/hadoop-1.0.3/lib/junit-4.5.jar
file:/home/hadoop/hadoop-1.0.3/lib/kfs-0.2.2.jar
file:/home/hadoop/hadoop-1.0.3/lib/log4j-1.2.15.jar
file:/home/hadoop/hadoop-1.0.3/lib/mockito-all-1.8.5.jar
file:/home/hadoop/hadoop-1.0.3/lib/oro-2.0.8.jar
file:/home/hadoop/hadoop-1.0.3/lib/protobuf-java-2.4.0a.jar
file:/home/hadoop/hadoop-1.0.3/lib/servlet-api-2.5-20081211.jar
file:/home/hadoop/hadoop-1.0.3/lib/slf4j-api-1.4.3.jar
file:/home/hadoop/hadoop-1.0.3/lib/slf4j-log4j12-1.4.3.jar
file:/home/hadoop/hadoop-1.0.3/lib/xmlenc-0.52.jar
file:/home/hadoop/hadoop-1.0.3/lib/zookeeper-3.3.5.jar
file:/home/hadoop/hadoop-1.0.3/lib/jsp-2.1/jsp-2.1.jar
file:/home/hadoop/hadoop-1.0.3/lib/jsp-2.1/jsp-api-2.1.jar
file:/home/hadoop/
file:/home/hadoop/hive-0.11.0/conf/
file:/home/hadoop/hive-0.11.0/lib/antlr-runtime-3.4.jar
file:/home/hadoop/hive-0.11.0/lib/avro-1.7.1.jar
file:/home/hadoop/hive-0.11.0/lib/avro-mapred-1.7.1.jar
file:/home/hadoop/hive-0.11.0/lib/commons-cli-1.2.jar
file:/home/hadoop/hive-0.11.0/lib/commons-codec-1.4.jar
file:/home/hadoop/hive-0.11.0/lib/commons-collections-3.2.1.jar
file:/home/hadoop/hive-0.11.0/lib/commons-compress-1.4.1.jar
file:/home/hadoop/hive-0.11.0/lib/commons-configuration-1.6.jar
file:/home/hadoop/hive-0.11.0/lib/commons-dbcp-1.4.jar
file:/home/hadoop/hive-0.11.0/lib/commons-io-2.4.jar
file:/home/hadoop/hive-0.11.0/lib/commons-lang-2.4.jar
file:/home/hadoop/hive-0.11.0/lib/commons-logging-1.0.4.jar
file:/home/hadoop/hive-0.11.0/lib/commons-logging-api-1.0.4.jar
file:/home/hadoop/hive-0.11.0/lib/commons-pool-1.5.4.jar
file:/home/hadoop/hive-0.11.0/lib/datanucleus-connectionpool-2.0.3.jar
file:/home/hadoop/hive-0.11.0/lib/datanucleus-core-2.0.3.jar
file:/home/hadoop/hive-0.11.0/lib/datanucleus-enhancer-2.0.3.jar
file:/home/hadoop/hive-0.11.0/lib/datanucleus-rdbms-2.0.3.jar
file:/home/hadoop/hive-0.11.0/lib/derby-10.4.2.0.jar
file:/home/hadoop/hive-0.11.0/lib/guava-11.0.2.jar
file:/home/hadoop/hive-0.11.0/lib/hbase-0.94.6.1.jar
file:/home/hadoop/hive-0.11.0/lib/hbase-0.94.6.1-tests.jar
file:/home/hadoop/hive-0.11.0/lib/hive-beeline-0.11.0.jar
file:/home/hadoop/hive-0.11.0/lib/hive-cli-0.11.0.jar
file:/home/hadoop/hive-0.11.0/lib/hive-common-0.11.0.jar
file:/home/hadoop/hive-0.11.0/lib/hive-contrib-0.11.0.jar
file:/home/hadoop/hive-0.11.0/lib[[email protected] ~]$ hive
file:/home/hadoop/hadoop-1.0.3/conf/
file:/home/hadoop/jrockit-jdk1.6.0_29/lib/tools.jar
file:/home/hadoop/hadoop-1.0.3/
file:/home/hadoop/hadoop-1.0.3/hadoop-core-1.0.3.jar
file:/home/hadoop/hadoop-1.0.3/lib/asm-3.2.jar
file:/home/hadoop/hadoop-1.0.3/lib/aspectjrt-1.6.5.jar
file:/home/hadoop/hadoop-1.0.3/lib/aspectjtools-1.6.5.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-beanutils-1.7.0.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-beanutils-core-1.8.0.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-cli-1.2.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-codec-1.4.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-collections-3.2.1.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-configuration-1.6.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-daemon-1.0.1.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-digester-1.8.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-el-1.0.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-httpclient-3.0.1.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-io-2.1.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-lang-2.4.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-logging-1.1.1.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-logging-api-1.0.4.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-math-2.1.jar
file:/home/hadoop/hadoop-1.0.3/lib/commons-net-1.4.1.jar
file:/home/hadoop/hadoop-1.0.3/lib/core-3.1.1.jar
file:/home/hadoop/hadoop-1.0.3/lib/hadoop-capacity-scheduler-1.0.3.jar
file:/home/hadoop/hadoop-1.0.3/lib/hadoop-fairscheduler-1.0.3.jar
file:/home/hadoop/hadoop-1.0.3/lib/hadoop-thriftfs-1.0.3.jar
file:/home/hadoop/hadoop-1.0.3/lib/hbase-0.94.2.jar
file:/home/hadoop/hadoop-1.0.3/lib/hive-shims-0.9.0.jar
file:/home/hadoop/hadoop-1.0.3/lib/hsqldb-1.8.0.10.jar
file:/home/hadoop/hadoop-1.0.3/lib/jackson-core-asl-1.8.8.jar
file:/home/hadoop/hadoop-1.0.3/lib/jackson-mapper-asl-1.8.8.jar
file:/home/hadoop/hadoop-1.0.3/lib/jasper-compiler-5.5.12.jar
file:/home/hadoop/hadoop-1.0.3/lib/jasper-runtime-5.5.12.jar
file:/home/hadoop/hadoop-1.0.3/lib/jdeb-0.8.jar
file:/home/hadoop/hadoop-1.0.3/lib/jersey-core-1.8.jar
file:/home/hadoop/hadoop-1.0.3/lib/jersey-json-1.8.jar
file:/home/hadoop/hadoop-1.0.3/lib/jersey-server-1.8.jar
file:/home/hadoop/hadoop-1.0.3/lib/jets3t-0.6.1.jar
file:/home/hadoop/hadoop-1.0.3/lib/jetty-6.1.26.jar
file:/home/hadoop/hadoop-1.0.3/lib/jetty-util-6.1.26.jar
file:/home/hadoop/hadoop-1.0.3/lib/jsch-0.1.42.jar
file:/home/hadoop/hadoop-1.0.3/lib/junit-4.5.jar
file:/home/hadoop/hadoop-1.0.3/lib/kfs-0.2.2.jar
file:/home/hadoop/hadoop-1.0.3/lib/log4j-1.2.15.jar
file:/home/hadoop/hadoop-1.0.3/lib/mockito-all-1.8.5.jar
file:/home/hadoop/hadoop-1.0.3/lib/oro-2.0.8.jar
file:/home/hadoop/hadoop-1.0.3/lib/protobuf-java-2.4.0a.jar
file:/home/hadoop/hadoop-1.0.3/lib/servlet-api-2.5-20081211.jar
file:/home/hadoop/hadoop-1.0.3/lib/slf4j-api-1.4.3.jar
file:/home/hadoop/hadoop-1.0.3/lib/slf4j-log4j12-1.4.3.jar
file:/home/hadoop/hadoop-1.0.3/lib/xmlenc-0.52.jar
file:/home/hadoop/hadoop-1.0.3/lib/zookeeper-3.3.5.jar
file:/home/hadoop/hadoop-1.0.3/lib/jsp-2.1/jsp-2.1.jar
file:/home/hadoop/hadoop-1.0.3/lib/jsp-2.1/jsp-api-2.1.jar
file:/home/hadoop/
file:/home/hadoop/hive-0.11.0/conf/
file:/home/hadoop/hive-0.11.0/lib/antlr-runtime-3.4.jar
file:/home/hadoop/hive-0.11.0/lib/avro-1.7.1.jar
file:/home/hadoop/hive-0.11.0/lib/avro-mapred-1.7.1.jar
file:/home/hadoop/hive-0.11.0/lib/commons-cli-1.2.jar
file:/home/hadoop/hive-0.11.0/lib/commons-codec-1.4.jar
file:/home/hadoop/hive-0.11.0/lib/commons-collections-3.2.1.jar
file:/home/hadoop/hive-0.11.0/lib/commons-compress-1.4.1.jar
file:/home/hadoop/hive-0.11.0/lib/commons-configuration-1.6.jar
file:/home/hadoop/hive-0.11.0/lib/commons-dbcp-1.4.jar
file:/home/hadoop/hive-0.11.0/lib/commons-io-2.4.jar
file:/home/hadoop/hive-0.11.0/lib/commons-lang-2.4.jar
file:/home/hadoop/hive-0.11.0/lib/commons-logging-1.0.4.jar
file:/home/hadoop/hive-0.11.0/lib/commons-logging-api-1.0.4.jar
file:/home/hadoop/hive-0.11.0/lib/commons-pool-1.5.4.jar
file:/home/hadoop/hive-0.11.0/lib/datanucleus-connectionpool-2.0.3.jar
file:/home/hadoop/hive-0.11.0/lib/datanucleus-core-2.0.3.jar
file:/home/hadoop/hive-0.11.0/lib/datanucleus-enhancer-2.0.3.jar
file:/home/hadoop/hive-0.11.0/lib/datanucleus-rdbms-2.0.3.jar
file:/home/hadoop/hive-0.11.0/lib/derby-10.4.2.0.jar
file:/home/hadoop/hive-0.11.0/lib/guava-11.0.2.jar
file:/home/hadoop/hive-0.11.0/lib/hbase-0.94.6.1.jar
file:/home/hadoop/hive-0.11.0/lib/hbase-0.94.6.1-tests.jar
file:/home/hadoop/hive-0.11.0/lib/hive-beeline-0.11.0.jar
file:/home/hadoop/hive-0.11.0/lib/hive-cli-0.11.0.jar
file:/home/hadoop/hive-0.11.0/lib/hive-common-0.11.0.jar
file:/home/hadoop/hive-0.11.0/lib/hive-contrib-0.11.0.jar
file:/home/hadoop/hive-0.11.0/lib/hive-exec-0.11.0.jar
file:/home/hadoop/hive-0.11.0/lib/hive-hbase-handler-0.11.0.jar
file:/home/hadoop/hive-0.11.0/lib/hive-hwi-0.11.0.jar
file:/home/hadoop/hive-0.11.0/lib/hive-jdbc-0.11.0.jar
file:/home/hadoop/hive-0.11.0/lib/hive-metastore-0.11.0.jar
file:/home/hadoop/hive-0.11.0/lib/hive-serde-0.11.0.jar
file:/home/hadoop/hive-0.11.0/lib/hive-service-0.11.0.jar
file:/home/hadoop/hive-0.11.0/lib/hive-shims-0.11.0.jar
file:/home/hadoop/hive-0.11.0/lib/jackson-core-asl-1.8.8.jar
file:/home/hadoop/hive-0.11.0/lib/jackson-jaxrs-1.8.8.jar
file:/home/hadoop/hive-0.11.0/lib/jackson-mapper-asl-1.8.8.jar
file:/home/hadoop/hive-0.11.0/lib/jackson-xc-1.8.8.jar
file:/home/hadoop/hive-0.11.0/lib/JavaEWAH-0.3.2.jar
file:/home/hadoop/hive-0.11.0/lib/javolution-5.5.1.jar
file:/home/hadoop/hive-0.11.0/lib/jdo2-api-2.3-ec.jar
file:/home/hadoop/hive-0.11.0/lib/jetty-6.1.26.jar
file:/home/hadoop/hive-0.11.0/lib/jetty-util-6.1.26.jar
file:/home/hadoop/hive-0.11.0/lib/jline-0.9.94.jar
file:/home/hadoop/hive-0.11.0/lib/json-20090211.jar
file:/home/hadoop/hive-0.11.0/lib/libfb303-0.9.0.jar
file:/home/hadoop/hive-0.11.0/lib/libthrift-0.9.0.jar
file:/home/hadoop/hive-0.11.0/lib/log4j-1.2.16.jar
file:/home/hadoop/hive-0.11.0/lib/maven-ant-tasks-2.1.3.jar
file:/home/hadoop/hive-0.11.0/lib/metrics-core-2.1.2.jar
file:/home/hadoop/hive-0.11.0/lib/protobuf-java-2.4.1.jar
file:/home/hadoop/hive-0.11.0/lib/servlet-api-2.5-20081211.jar
file:/home/hadoop/hive-0.11.0/lib/slf4j-api-1.6.1.jar
file:/home/hadoop/hive-0.11.0/lib/slf4j-log4j12-1.6.1.jar
file:/home/hadoop/hive-0.11.0/lib/snappy-0.2.jar
file:/home/hadoop/hive-0.11.0/lib/ST4-4.0.4.jar
file:/home/hadoop/hive-0.11.0/lib/tempus-fugit-1.1.jar
file:/home/hadoop/hive-0.11.0/lib/xz-1.0.jar
file:/home/hadoop/hive-0.11.0/lib/zookeeper-3.4.3.jar
file:/home/hadoop/
file:/home/hadoop/hadoop-1.0.3/lib/hadoop-lzo-0.4.15.jar
注意红色字体部分,说明加载的顺序导致,不知道谁之前把hive-shims-0.9.0.jar拷贝到hadoop的lib目录下去了,去掉此jar,问题得到解决。
终于可以不在0.9的版本上做修改了,坑爹啊!!!!
附上打印类加载路径代码:
URL[] URLs=((URLClassLoader)CliDriver.class.getClassLoader()).getURLs();
for(URL url:URLs)
System.out.println(url);