Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

scala hbase remote connection

Highlighted

scala hbase remote connection

New Contributor

Hi All,

I tried to develop Scala application which will works with HBase in another machine. How can I create a connection between my scala apps and HBase? I use these configuration but always return error

val zookeeperQuorumIP = "192.168.199.3"
val config = HBaseConfiguration.create()
config.set("hbase.zookeeper.quorum",zookeeperQuorumIP)

here is the error said 
14:33:02.180 [main-SendThread(192.168.199.3:2181)] INFO  org.apache.zookeeper.ClientCnxn - Opening socket connection to server 192.168.199.3/192.168.199.3:2181. Will not attempt to authenticate using SASL (unknown error)


4 REPLIES 4
Highlighted

Re: scala hbase remote connection

That is not a fatal error. Most clients do not need to do proper SASL authentication. The ZK client will automatically fall back to no authentication which is sufficient for normal HBase client interaction. You probably don't need to worry about it.

Highlighted

Re: scala hbase remote connection

Explorer

Hi @Josh Elser, I am also trying the same thing. My Scala code is on windows machine and my HBase is in a Virtual machine. I am getting below error:

D:\scala-hbase>sbt run
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; sup
port was removed in 8.0
[info] Set current project to scala-hbase (in build file:/D:/scala-hbase/)
[info] Running Hi
Hi!
log4j:WARN No appenders could be found for logger (org.apache.hadoop.security.Gr
oups).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more in
fo.
[error] (run-main-0) org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsE
xception: Failed 1 action: UnknownHostException: 1 time,
org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException: Failed 1 ac
tion: UnknownHostException: 1 time,
        at org.apache.hadoop.hbase.client.AsyncProcess$BatchErrors.makeException
(AsyncProcess.java:247)
        at org.apache.hadoop.hbase.client.AsyncProcess$BatchErrors.access$1800(A
syncProcess.java:227)
        at org.apache.hadoop.hbase.client.AsyncProcess.waitForAllPreviousOpsAndR
eset(AsyncProcess.java:1766)
        at org.apache.hadoop.hbase.client.BufferedMutatorImpl.backgroundFlushCom
mits(BufferedMutatorImpl.java:240)
        at org.apache.hadoop.hbase.client.BufferedMutatorImpl.flush(BufferedMuta
torImpl.java:190)
        at org.apache.hadoop.hbase.client.HTable.flushCommits(HTable.java:1495)
        at org.apache.hadoop.hbase.client.HTable.put(HTable.java:1086)
        at Hi$.main(hw.scala:16)
        at Hi.main(hw.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
[trace] Stack trace suppressed: run last compile:run for the full output.
java.lang.RuntimeException: Nonzero exit code: 1
        at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) Nonzero exit code: 1
[error] Total time: 533 s, completed Mar 31, 2017 1:50:22 AM

D:\scala-hbase>
Highlighted

Re: scala hbase remote connection

Please ask a new question in the future:

The logs tell you what is wrong:

UnknownHostException

You have a networking issue from your windows machine to the virtual machine.

Highlighted

Re: scala hbase remote connection

Explorer

Did you get any solution for this connectivity? I am also trying the same thing. My Scala code is on windows machine and my HBase is in a Virtual machine. I am getting below error:

D:\scala-hbase>sbt run
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; sup
port was removed in 8.0
[info] Set current project to scala-hbase (in build file:/D:/scala-hbase/)
[info] Running Hi
Hi!
log4j:WARN No appenders could be found for logger (org.apache.hadoop.security.Gr
oups).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more in
fo.
[error] (run-main-0) org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsE
xception: Failed 1 action: UnknownHostException: 1 time,
org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException: Failed 1 ac
tion: UnknownHostException: 1 time,
        at org.apache.hadoop.hbase.client.AsyncProcess$BatchErrors.makeException
(AsyncProcess.java:247)
        at org.apache.hadoop.hbase.client.AsyncProcess$BatchErrors.access$1800(A
syncProcess.java:227)
        at org.apache.hadoop.hbase.client.AsyncProcess.waitForAllPreviousOpsAndR
eset(AsyncProcess.java:1766)
        at org.apache.hadoop.hbase.client.BufferedMutatorImpl.backgroundFlushCom
mits(BufferedMutatorImpl.java:240)
        at org.apache.hadoop.hbase.client.BufferedMutatorImpl.flush(BufferedMuta
torImpl.java:190)
        at org.apache.hadoop.hbase.client.HTable.flushCommits(HTable.java:1495)
        at org.apache.hadoop.hbase.client.HTable.put(HTable.java:1086)
        at Hi$.main(hw.scala:16)
        at Hi.main(hw.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
[trace] Stack trace suppressed: run last compile:run for the full output.
java.lang.RuntimeException: Nonzero exit code: 1
        at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) Nonzero exit code: 1
[error] Total time: 533 s, completed Mar 31, 2017 1:50:22 AM

D:\scala-hbase>
Don't have an account?
Coming from Hortonworks? Activate your account here