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.

Can't connect phoenix with jdbc

Highlighted

Can't connect phoenix with jdbc

New Contributor

hello,everyone:

I have two servert application,one servlet Application is in the same lan with hbase cluster, this can work. can conect

the other is not in the same lan wiht hbase cluster,but can use vpn connect hbase cluster, but this servelt application cant

connect hbase cluter. the error followers, why?who can help me ? too strange

my connect string is jdbc:phoenix:10.0.0.7:2181:/hbase-unsecure

The error is;

Caused by: org.apache.phoenix.schema.TableNotFoundException: ERROR 1012 (42M03): Table undefined. tableName=SYSTEM.CATALOG at org.apache.phoenix.query.ConnectionQueryServicesImpl.getAllTableRegions(ConnectionQueryServicesImpl.java:436) ~[ConnectionQueryServicesImpl.class:4.4.0.2.4.2.0-258] at org.apache.phoenix.query.ConnectionQueryServicesImpl.checkClientServerCompatibility(ConnectionQueryServicesImpl.java:939) ~[ConnectionQueryServicesImpl.class:4.4.0.2.4.2.0-258] at org.apache.phoenix.query.ConnectionQueryServicesImpl.ensureTableCreated(ConnectionQueryServicesImpl.java:860) ~[ConnectionQueryServicesImpl.class:4.4.0.2.4.2.0-258] at org.apache.phoenix.query.ConnectionQueryServicesImpl.createTable(ConnectionQueryServicesImpl.java:1174) ~[ConnectionQueryServicesImpl.class:4.4.0.2.4.2.0-258] at org.apache.phoenix.query.DelegateConnectionQueryServices.createTable(DelegateConnectionQueryServices.java:112) ~[DelegateConnectionQueryServices.class:4.4.0.2.4.2.0-258] at org.apache.phoenix.schema.MetaDataClient.createTableInternal(MetaDataClient.java:1974) ~[MetaDataClient.class:4.4.0.2.4.2.0-258] at org.apache.phoenix.schema.MetaDataClient.createTable(MetaDataClient.java:770) ~[MetaDataClient.class:4.4.0.2.4.2.0-258] at org.apache.phoenix.compile.CreateTableCompiler$2.execute(CreateTableCompiler.java:186) ~[CreateTableCompiler$2.class:4.4.0.2.4.2.0-258] at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:305) ~[PhoenixStatement$2.class:4.4.0.2.4.2.0-258] at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:297) ~[PhoenixStatement$2.class:4.4.0.2.4.2.0-258] at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53) ~[CallRunner.class:4.4.0.2.4.2.0-258] at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:295) ~[PhoenixStatement.class:4.4.0.2.4.2.0-258] at org.apache.phoenix.jdbc.PhoenixStatement.executeUpdate(PhoenixStatement.java:1244) ~[PhoenixStatement.class:4.4.0.2.4.2.0-258] at org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:1850) ~[ConnectionQueryServicesImpl$12.class:4.4.0.2.4.2.0-258] at org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:1819) ~[ConnectionQueryServicesImpl$12.class:4.4.0.2.4.2.0-258] at org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:77) ~[PhoenixContextExecutor.class:4.4.0.2.4.2.0-258] at org.apache.phoenix.query.ConnectionQueryServicesImpl.init(ConnectionQueryServicesImpl.java:1819) ~[ConnectionQueryServicesImpl.class:4.4.0.2.4.2.0-258] at org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:180) ~[PhoenixDriver.class:4.4.0.2.4.2.0-258] at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.connect(PhoenixEmbeddedDriver.java:132) ~[PhoenixEmbeddedDriver.class:4.4.0.2.4.2.0-258] at org.apache.phoenix.jdbc.PhoenixDriver.connect(PhoenixDriver.java:151) ~[PhoenixDriver.class:4.4.0.2.4.2.0-258] at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38) ~[DriverConnectionFactory.class:1.4] at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582) ~[PoolableConnectionFactory.class:1.4] at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556) ~[BasicDataSource.class:1.4] at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545) ~[BasicDataSource.class:1.4] ... 30 more

3 REPLIES 3

Re: Can't connect phoenix with jdbc

New Contributor

Is this the first time you access phoenix? If so, it might be the case that you are accessing with a user that does not have permissions to create table. The first time that phoenix is accessed it tries to create system tables, which are necessary for the internal functioning. It could also be the case that the user doesn't have permissions to read from system.catalog, which might lead to this error too. In order to solve this, you should access hbase with sudo permissions and check if the tables exists. If they do, then grant them access to whichever users you need by adding them to hbase:acl table. If the tables do not exist, my recommendation is that you try to access phoenix with hbase sudo user at least once, so that the tables would be automatically created for you.

Re: Can't connect phoenix with jdbc

Super Guru

http://phoenix.apache.org/faq.html

Does the user have access to the underlying HBase?

Is there permissions required?

Can you access HBase?

Can you access anything else on the cluster from that machine?

Firewall issue?

Did you try with sqlline?

Re: Can't connect phoenix with jdbc

@pan bocun

I was facing same kind of issue. I have resolve this issue by using following steps:-

1) Edit Ambari->Hive->Configs->Advanced->Custom hive-site->Add Property..., add the following properties based on your HBase configurations(you can search in Ambari->HBase->Configs): custom hive-site.xml

hbase.zookeeper.quorum=xyz (find this property value from hbase )

zookeeper.znode.parent=/hbase-unsecure (find this property value from hbase )

phoenix.schema.mapSystemTablesToNamespace=true

phoenix.schema.isNamespaceMappingEnabled=true

2) Copy jar to /usr/hdp/current/hive-server2/auxlib from

/usr/hdp/2.5.6.0-40/phoenix/phoenix-4.7.0.2.5.6.0-40-hive.jar

/usr/hdp/2.5.6.0-40/phoenix/phoenix-hive-4.7.0.2.5.6.0-40-sources.jar If he jar is not working for you then just try to get following jar phoenix-hive-4.7.0.2.5.3.0-37.jar and copy this to /usr/hdp/current/hive-server2/auxlib

3) add property to custom-hive-env

HIVE_AUX_JARS_PATH=/usr/hdp/current/hive-server2/auxlib/4) Add follwoing property to custom-hbase-site.xmlphoenix.schema.mapSystemTablesToNamespace=true phoenix.schema.isNamespaceMappingEnabled=true

5) Also run following command

1) jar uf /usr/hdp/current/hive-server2/auxlib/phoenix-4.7.0.2.5.6.0-40-client.jar /etc/hive/conf/hive-site.xml

2) jar uf /usr/hdp/current/hive-server2/auxlib/phoenix-4.7.0.2.5.6.0-40-client.jar /etc/hbase/conf/hbase-site.xml

And I hope my solution will work for you :)