Member since
01-21-2019
5
Posts
1
Kudos Received
1
Solution
My Accepted Solutions
Title | Views | Posted |
---|---|---|
6455 | 10-09-2017 05:52 PM |
10-09-2017
05:52 PM
Hi @Aditya Sirna it's working now using (hbase client, phoenix jars and zookeeper jars. I get them from the hdp directories and I added the hbase_site.xml an core-site.xml in the classpath). About the url: "jdbc:phoenix:localhost:2181:/hbase:/keytab/ISMAEL.keytab:ISMAEL@MOCK" Thanks for your help. Best regards Ismael
... View more
10-05-2017
11:18 AM
Hi @Aditya SirnaAditya Thanks for the replay I confirm the cluster is kerberized that's why I tried the two ways with the keytab and without. I still have the same issue. Best regards Ismael
... View more
10-05-2017
09:22 AM
Hi guys, I followed some tutorials with adding hbase client jar and phoenix client jar, and I'm not to connect and execute my query. Can anyone give me some leeds. import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class Test {
public static void main(String[] args) throws SQLException {
// Statement stmt = null;
ResultSet rset = null;
try {
Class.forName("org.apache.phoenix.jdbc.PhoenixDriver");
} catch (ClassNotFoundException e1) {
System.out.println("Exception Loading Driver");
e1.printStackTrace();
}
try {
Connection con = DriverManager.getConnection("jdbc:phoenix:localhost:2181:/hbase-unsecure");
// Connection con =
// DriverManager.getConnection("jdbc:phoenix:localhost:/hbase-unsecure:./keytab/ISMAEL.keytab:ISMAEL@MOCK");
// stmt = con.createStatement();
//
// stmt.executeUpdate("create table test (mykey integer not null
// primary key, mycolumn varchar)");
// stmt.executeUpdate("upsert into test values (1,'Hello')");
// stmt.executeUpdate("upsert into test values (2,'World!')");
// con.commit();
PreparedStatement statement = con.prepareStatement("select * from dsp_paas:toto");
rset = statement.executeQuery();
while (rset.next()) {
System.out.println(rset.getString("cf1"));
}
statement.close();
con.close();
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
} I have this error message when I execute my code. SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
log4j:WARN No appenders could be found for logger (org.apache.hadoop.util.Shell).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
java.lang.RuntimeException: java.lang.NullPointerException
java.sql.SQLException: java.lang.RuntimeException: java.lang.NullPointerException
at org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:2482)
at org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:2389)
at org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:76)
at org.apache.phoenix.query.ConnectionQueryServicesImpl.init(ConnectionQueryServicesImpl.java:2389)
at org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:255)
at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.createConnection(PhoenixEmbeddedDriver.java:150)
at org.apache.phoenix.jdbc.PhoenixDriver.connect(PhoenixDriver.java:221)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:270)
at com.edf.dp.phoenix.Test.main(Test.java:24)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:218)
at org.apache.hadoop.hbase.client.ClientScanner.call(ClientScanner.java:327)
at org.apache.hadoop.hbase.client.ClientScanner.nextScanner(ClientScanner.java:302)
at org.apache.hadoop.hbase.client.ClientScanner.initializeScannerInConstruction(ClientScanner.java:167)
at org.apache.hadoop.hbase.client.ClientScanner.<init>(ClientScanner.java:162)
at org.apache.hadoop.hbase.client.HTable.getScanner(HTable.java:797)
at org.apache.hadoop.hbase.MetaTableAccessor.fullScan(MetaTableAccessor.java:602)
at org.apache.hadoop.hbase.MetaTableAccessor.tableExists(MetaTableAccessor.java:366)
at org.apache.hadoop.hbase.client.HBaseAdmin.tableExists(HBaseAdmin.java:403)
at org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:2417)
... 9 more
Caused by: java.lang.NullPointerException
at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.getMetaReplicaNodes(ZooKeeperWatcher.java:463)
at org.apache.hadoop.hbase.zookeeper.MetaTableLocator.blockUntilAvailable(MetaTableLocator.java:561)
at org.apache.hadoop.hbase.client.ZooKeeperRegistry.getMetaRegionLocation(ZooKeeperRegistry.java:61)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateMeta(ConnectionManager.java:1186)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1153)
at org.apache.hadoop.hbase.client.RpcRetryingCallerWithReadReplicas.getRegionLocations(RpcRetryingCallerWithReadReplicas.java:300)
at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:156)
at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:60)
at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:210)
... 18 more
... View more
Labels:
- Labels:
-
Apache HBase
-
Apache Phoenix