Monday, October 26, 2015

Cloudera :: at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)

I tried to run below code fragment in eclipse. My project was built using maven.

=================================================

package thbase.tutorialPoint;

/*
 * Compile and run with:
 * javac -cp `hbase classpath` TestHBase.java
 * java -cp `hbase classpath` TestHBase
 */
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.*;
import org.apache.hadoop.hbase.client.*;
import org.apache.hadoop.hbase.util.*;

public class TestHBase {
public static void main(String[] args) throws Exception {
System.out.println("***1");
Configuration conf = HBaseConfiguration.create();
System.out.println(conf);
System.out.println(conf.getResource("core-default.xml"));
System.out.println(conf.getResource("core-site.xml"));
System.out.println(conf.getResource("hbase-default.xml"));
HBaseAdmin admin = new HBaseAdmin(conf);
try {
HTable table = new HTable(conf, "test-table");
Put put = new Put(Bytes.toBytes("test-key"));
put.add(Bytes.toBytes("cf"), Bytes.toBytes("q"),
Bytes.toBytes("value"));
table.put(put);
} finally {
// admin.close();
}
}
}

==========================================


I get the below error

======================================================================

***
Configuration: core-default.xml, core-site.xml, hbase-default.xml, hbase-site.xml
jar:file:/home/cloudera/.m2/repository/org/apache/hadoop/hadoop-core/0.20.2/hadoop-core-0.20.2.jar!/core-default.xml
null
jar:file:/home/cloudera/.m2/repository/org/apache/hbase/hbase/0.90.3/hbase-0.90.3.jar!/hbase-default.xml
2015-10-25 23:29:43,378 INFO  [main] zookeeper.ZooKeeper: Client environment:zookeeper.version=3.3.2-1031432, built on 11/05/2010 05:32 GMT
2015-10-25 23:29:43,389 INFO  [main] zookeeper.ZooKeeper: Client environment:host.name=quickstart.cloudera
2015-10-25 23:29:43,389 INFO  [main] zookeeper.ZooKeeper: Client environment:java.version=1.7.0_67
2015-10-25 23:29:43,389 INFO  [main] zookeeper.ZooKeeper: Client environment:java.vendor=Oracle Corporation
2015-10-25 23:29:43,389 INFO  [main] zookeeper.ZooKeeper: Client environment:java.home=/usr/java/jdk1.7.0_67-cloudera/jre
2015-10-25 23:29:43,389 INFO  [main] zookeeper.ZooKeeper: Client environment:java.class.path=/home/cloudera/workspace/HelloHadoop/target/classes:/etc/hbase/conf:/home/cloudera/.m2/repository/org/apache/hadoop/hadoop-core/0.20.2/hadoop-core-0.20.2.jar:/home/cloudera/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar:/home/cloudera/.m2/repository/xmlenc/xmlenc/0.52/xmlenc-0.52.jar:/home/cloudera/.m2/repository/commons-httpclient/commons-httpclient/3.0.1/commons-httpclient-3.0.1.jar:/home/cloudera/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar:/home/cloudera/.m2/repository/commons-net/commons-net/1.4.1/commons-net-1.4.1.jar:/home/cloudera/.m2/repository/org/mortbay/jetty/jetty/6.1.14/jetty-6.1.14.jar:/home/cloudera/.m2/repository/org/mortbay/jetty/jetty-util/6.1.14/jetty-util-6.1.14.jar:/home/cloudera/.m2/repository/tomcat/jasper-runtime/5.5.12/jasper-runtime-5.5.12.jar:/home/cloudera/.m2/repository/tomcat/jasper-compiler/5.5.12/jasper-compiler-5.5.12.jar:/home/cloudera/.m2/repository/org/mortbay/jetty/jsp-api-2.1/6.1.14/jsp-api-2.1-6.1.14.jar:/home/cloudera/.m2/repository/org/mortbay/jetty/jsp-2.1/6.1.14/jsp-2.1-6.1.14.jar:/home/cloudera/.m2/repository/ant/ant/1.6.5/ant-1.6.5.jar:/home/cloudera/.m2/repository/commons-el/commons-el/1.0/commons-el-1.0.jar:/home/cloudera/.m2/repository/net/java/dev/jets3t/jets3t/0.7.1/jets3t-0.7.1.jar:/home/cloudera/.m2/repository/org/mortbay/jetty/servlet-api-2.5/6.1.14/servlet-api-2.5-6.1.14.jar:/home/cloudera/.m2/repository/net/sf/kosmosfs/kfs/0.3/kfs-0.3.jar:/home/cloudera/.m2/repository/junit/junit/4.5/junit-4.5.jar:/home/cloudera/.m2/repository/hsqldb/hsqldb/1.8.0.10/hsqldb-1.8.0.10.jar:/home/cloudera/.m2/repository/oro/oro/2.0.8/oro-2.0.8.jar:/home/cloudera/.m2/repository/org/eclipse/jdt/core/3.1.1/core-3.1.1.jar:/home/cloudera/.m2/repository/org/apache/hbase/hbase/0.90.3/hbase-0.90.3.jar:/home/cloudera/.m2/repository/com/google/guava/guava/r06/guava-r06.jar:/home/cloudera/.m2/repository/commons-lang/commons-lang/2.5/commons-lang-2.5.jar:/home/cloudera/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/home/cloudera/.m2/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar:/home/cloudera/.m2/repository/org/apache/hadoop/avro/1.3.3/avro-1.3.3.jar:/home/cloudera/.m2/repository/org/apache/zookeeper/zookeeper/3.3.2/zookeeper-3.3.2.jar:/home/cloudera/.m2/repository/org/apache/thrift/thrift/0.2.0/thrift-0.2.0.jar:/home/cloudera/.m2/repository/org/jruby/jruby-complete/1.6.0/jruby-complete-1.6.0.jar:/home/cloudera/.m2/repository/org/slf4j/slf4j-api/1.5.8/slf4j-api-1.5.8.jar:/home/cloudera/.m2/repository/org/slf4j/slf4j-log4j12/1.5.8/slf4j-log4j12-1.5.8.jar:/home/cloudera/.m2/repository/com/google/protobuf/protobuf-java/2.3.0/protobuf-java-2.3.0.jar:/home/cloudera/.m2/repository/com/sun/jersey/jersey-core/1.4/jersey-core-1.4.jar:/home/cloudera/.m2/repository/com/sun/jersey/jersey-json/1.4/jersey-json-1.4.jar:/home/cloudera/.m2/repository/org/codehaus/jettison/jettison/1.1/jettison-1.1.jar:/home/cloudera/.m2/repository/com/sun/xml/bind/jaxb-impl/2.1.12/jaxb-impl-2.1.12.jar:/home/cloudera/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.5.5/jackson-core-asl-1.5.5.jar:/home/cloudera/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.5.5/jackson-jaxrs-1.5.5.jar:/home/cloudera/.m2/repository/org/codehaus/jackson/jackson-xc/1.5.5/jackson-xc-1.5.5.jar:/home/cloudera/.m2/repository/com/sun/jersey/jersey-server/1.4/jersey-server-1.4.jar:/home/cloudera/.m2/repository/asm/asm/3.1/asm-3.1.jar:/home/cloudera/.m2/repository/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1.jar:/home/cloudera/.m2/repository/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar:/home/cloudera/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar:/home/cloudera/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar:/home/cloudera/.m2/repository/org/apache/hbase/hbase-client/1.1.2/hbase-client-1.1.2.jar:/home/cloudera/.m2/repository/org/apache/hbase/hbase-annotations/1.1.2/hbase-annotations-1.1.2.jar:/usr/java/jdk1.7.0_67-cloudera/lib/tools.jar:/home/cloudera/.m2/repository/org/apache/hbase/hbase-common/1.1.2/hbase-common-1.1.2.jar:/home/cloudera/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar:/home/cloudera/.m2/repository/org/apache/hbase/hbase-protocol/1.1.2/hbase-protocol-1.1.2.jar:/home/cloudera/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar:/home/cloudera/.m2/repository/io/netty/netty-all/4.0.23.Final/netty-all-4.0.23.Final.jar:/home/cloudera/.m2/repository/org/apache/htrace/htrace-core/3.1.0-incubating/htrace-core-3.1.0-incubating.jar:/home/cloudera/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.13/jackson-mapper-asl-1.9.13.jar:/home/cloudera/.m2/repository/org/jruby/jcodings/jcodings/1.0.8/jcodings-1.0.8.jar:/home/cloudera/.m2/repository/org/jruby/joni/joni/2.1.2/joni-2.1.2.jar:/home/cloudera/.m2/repository/org/apache/hadoop/hadoop-auth/2.5.1/hadoop-auth-2.5.1.jar:/home/cloudera/.m2/repository/org/apache/httpcomponents/httpclient/4.2.5/httpclient-4.2.5.jar:/home/cloudera/.m2/repository/org/apache/httpcomponents/httpcore/4.2.4/httpcore-4.2.4.jar:/home/cloudera/.m2/repository/org/apache/directory/server/apacheds-kerberos-codec/2.0.0-M15/apacheds-kerberos-codec-2.0.0-M15.jar:/home/cloudera/.m2/repository/org/apache/directory/server/apacheds-i18n/2.0.0-M15/apacheds-i18n-2.0.0-M15.jar:/home/cloudera/.m2/repository/org/apache/directory/api/api-asn1-api/1.0.0-M20/api-asn1-api-1.0.0-M20.jar:/home/cloudera/.m2/repository/org/apache/directory/api/api-util/1.0.0-M20/api-util-1.0.0-M20.jar:/home/cloudera/.m2/repository/org/apache/hadoop/hadoop-common/2.5.1/hadoop-common-2.5.1.jar:/home/cloudera/.m2/repository/org/apache/hadoop/hadoop-annotations/2.5.1/hadoop-annotations-2.5.1.jar:/home/cloudera/.m2/repository/org/apache/commons/commons-math3/3.1.1/commons-math3-3.1.1.jar:/home/cloudera/.m2/repository/commons-configuration/commons-configuration/1.6/commons-configuration-1.6.jar:/home/cloudera/.m2/repository/commons-digester/commons-digester/1.8/commons-digester-1.8.jar:/home/cloudera/.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar:/home/cloudera/.m2/repository/commons-beanutils/commons-beanutils-core/1.8.0/commons-beanutils-core-1.8.0.jar:/home/cloudera/.m2/repository/org/apache/avro/avro/1.7.4/avro-1.7.4.jar:/home/cloudera/.m2/repository/com/thoughtworks/paranamer/paranamer/2.3/paranamer-2.3.jar:/home/cloudera/.m2/repository/org/xerial/snappy/snappy-java/1.0.4.1/snappy-java-1.0.4.1.jar:/home/cloudera/.m2/repository/com/jcraft/jsch/0.1.42/jsch-0.1.42.jar:/home/cloudera/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar:/home/cloudera/.m2/repository/org/apache/commons/commons-compress/1.4.1/commons-compress-1.4.1.jar:/home/cloudera/.m2/repository/org/tukaani/xz/1.0/xz-1.0.jar:/home/cloudera/.m2/repository/org/apache/hadoop/hadoop-mapreduce-client-core/2.5.1/hadoop-mapreduce-client-core-2.5.1.jar:/home/cloudera/.m2/repository/org/apache/hadoop/hadoop-yarn-common/2.5.1/hadoop-yarn-common-2.5.1.jar:/home/cloudera/.m2/repository/org/apache/hadoop/hadoop-yarn-api/2.5.1/hadoop-yarn-api-2.5.1.jar:/home/cloudera/.m2/repository/io/netty/netty/3.6.2.Final/netty-3.6.2.Final.jar:/home/cloudera/.m2/repository/com/github/stephenc/findbugs/findbugs-annotations/1.3.9-1/findbugs-annotations-1.3.9-1.jar
2015-10-25 23:29:43,389 INFO  [main] zookeeper.ZooKeeper: Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2015-10-25 23:29:43,389 INFO  [main] zookeeper.ZooKeeper: Client environment:java.io.tmpdir=/tmp
2015-10-25 23:29:43,389 INFO  [main] zookeeper.ZooKeeper: Client environment:java.compiler=
2015-10-25 23:29:43,389 INFO  [main] zookeeper.ZooKeeper: Client environment:os.name=Linux
2015-10-25 23:29:43,389 INFO  [main] zookeeper.ZooKeeper: Client environment:os.arch=amd64
2015-10-25 23:29:43,390 INFO  [main] zookeeper.ZooKeeper: Client environment:os.version=2.6.32-358.el6.x86_64
2015-10-25 23:29:43,390 INFO  [main] zookeeper.ZooKeeper: Client environment:user.name=cloudera
2015-10-25 23:29:43,390 INFO  [main] zookeeper.ZooKeeper: Client environment:user.home=/home/cloudera
2015-10-25 23:29:43,390 INFO  [main] zookeeper.ZooKeeper: Client environment:user.dir=/home/cloudera/workspace/HelloHadoop
2015-10-25 23:29:43,392 INFO  [main] zookeeper.ZooKeeper: Initiating client connection, connectString=localhost:2181 sessionTimeout=180000 watcher=hconnection
2015-10-25 23:29:43,454 INFO  [main-SendThread()] zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181
2015-10-25 23:29:43,527 INFO  [main-SendThread(localhost:2181)] zookeeper.ClientCnxn: Socket connection established to localhost/127.0.0.1:2181, initiating session
2015-10-25 23:29:43,627 INFO  [main-SendThread(localhost:2181)] zookeeper.ClientCnxn: Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x150a2c7aa8f000b, negotiated timeout = 40000
Exception in thread "main" java.lang.NumberFormatException: For input string: "60000�;�W��_�PBUF

quickstart.cloudera �� �����*

at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:492)
at java.lang.Integer.parseInt(Integer.java:527)
at org.apache.hadoop.hbase.HServerAddress.(HServerAddress.java:63)
at org.apache.hadoop.hbase.MasterAddressTracker.getMasterAddress(MasterAddressTracker.java:63)
at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getMaster(HConnectionManager.java:353)
at org.apache.hadoop.hbase.client.HBaseAdmin.(HBaseAdmin.java:89)
at thbase.tutorialPoint.TestHBase.main(TestHBase.java:21)

======================================================================

In my pom.xml

I have

====================================================================


<!-- hadoop dependency -->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>0.20.2</version>
</dependency>

<!-- hbase -->
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase</artifactId>
<version>0.90.3</version>
</dependency>

<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>1.1.2</version>
</dependency>

====================================================================

The problem or Issue is inside the versions of the dependencies

we have included 0.****  with 1.****

so the solution

include all dependencies with compatible version
that is from either

0.**** or from only 1.****

I have used 1.1.1 versions for all
===================================================================


<dependencies>
<!-- hadoop dependency -->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>1.1.1</version>
</dependency>


<!-- hbase
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>1.1.1</version>
</dependency> -->



<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>1.1.1</version>
</dependency>

</dependencies>


=================================================================

This will solve the issue