Support Questions

Find answers, ask questions, and share your expertise

Issue connecting to Phoenix with Sqlline

avatar
Expert Contributor

Have just manually installed Phoenix on a clean 2.4 pseudo-cluster and having connection issues. I am pretty sure it is a conflicting library, but they look ok to me (see below). Here is the chronology:

1. yum install phoenix

2. Fixed up the symbolic links in /usr/hdp/current/hbase/lib

3. Tweaked the hbase-site.xml in Ambari and restarted

4. Ran queryserver.py start

5. Tried to connect and no joy

Is there another library other than the phoenix client that is needed for jdbc?

Here is the command:

export
CLASSPATH=/usr/hdp/2.4.0.0-169/phoenix/phoenix-4.4.0.2.4.0.0-169-client.jar:$CLASSPATHecho "$CLASSPATH"/usr/hdp/2.4.0.0-169/phoenix/bin/sqlline.py
anteater-1.cloud.foo.com:2181 /hbase-unsecure

Here is the nasty error:

/usr/hdp/2.4.0.0-169/phoenix/phoenix-4.4.0.2.4.0.0-169-client.jar:sun.misc.SignalHandler not found in
gnu.gcj.runtime.SystemClassLoader{urls=[file:/etc/hbase/conf/,file:/usr/hdp/2.4.0.0-169/phoenix/bin/../phoenix-4.4.0.2.4.0.0-169-client.jar,file:./,file:/etc/hadoop/conf/,file:/usr/hdp/2.4.0.0-169/hadoop/conf/,file:/usr/hdp/2.4.0.0-169/hadoop-hdfs/./,file:./],
parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}Setting property: [isolation, TRANSACTION_READ_COMMITTED]Setting property: [run, /hbase-unsecure]issuing: !connect jdbc:phoenix:anteater-1.cloud.foo.com:2181
none none org.apache.phoenix.jdbc.PhoenixDriverConnecting to jdbc:phoenix:anteater-1.cloud.foo.com:2181java.lang.ClassFormatError:
org.apache.phoenix.jdbc.PhoenixDriver (unrecognized class file version)  at
java.lang.VMClassLoader.defineClass(libgcj.so.10)  at
java.lang.ClassLoader.defineClass(libgcj.so.10)  at
java.security.SecureClassLoader.defineClass(libgcj.so.10)  at
java.net.URLClassLoader.findClass(libgcj.so.10)  at
java.lang.ClassLoader.loadClass(libgcj.so.10)  at
java.lang.ClassLoader.loadClass(libgcj.so.10)  at
java.lang.Class.forName(libgcj.so.10)  at
sqlline.DatabaseConnection.connect(DatabaseConnection.java:115)  at
sqlline.DatabaseConnection.getConnection(DatabaseConnection.java:203)  at sqlline.Commands.connect(Commands.java:1064)  at
sqlline.Commands.connect(Commands.java:996)  at
java.lang.reflect.Method.invoke(libgcj.so.10)  at
sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:36)  at
sqlline.SqlLine.dispatch(SqlLine.java:804)  at
sqlline.SqlLine.initArgs(SqlLine.java:588)  at
sqlline.SqlLine.begin(SqlLine.java:656)  at
sqlline.SqlLine.start(SqlLine.java:398)  at
sqlline.SqlLine.main(SqlLine.java:292)java.io.FileNotFoundException: /hbase-unsecure (No such file
or directory)  at
gnu.java.nio.channels.FileChannelImpl.open(libgcj.so.10)  at
gnu.java.nio.channels.FileChannelImpl.<init>(libgcj.so.10)  at
gnu.java.nio.channels.FileChannelImpl.create(libgcj.so.10)  at
java.io.FileInputStream.<init>(libgcj.so.10)  at
java.io.FileInputStream.<init>(libgcj.so.10)  at
java.io.FileReader.<init>(libgcj.so.10)  at
sqlline.Commands.run(Commands.java:1235)  at
java.lang.reflect.Method.invoke(libgcj.so.10)  at
sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:36)  at
sqlline.SqlLine.dispatch(SqlLine.java:804)  at
sqlline.SqlLine.initArgs(SqlLine.java:613)  at
sqlline.SqlLine.begin(SqlLine.java:656)  at
sqlline.SqlLine.start(SqlLine.java:398)  at
sqlline.SqlLine.main(SqlLine.java:292)java.lang.ClassFormatError:
org.apache.phoenix.jdbc.PhoenixDriver (unrecognized class file version)  at
java.lang.VMClassLoader.defineClass(libgcj.so.10)  at
java.lang.ClassLoader.defineClass(libgcj.so.10)  at
java.security.SecureClassLoader.defineClass(libgcj.so.10)  at
java.net.URLClassLoader.findClass(libgcj.so.10)  at
java.lang.ClassLoader.loadClass(libgcj.so.10)  at
java.lang.ClassLoader.loadClass(libgcj.so.10)  at java.lang.Class.forName(libgcj.so.10)  at
sqlline.DatabaseConnection.connect(DatabaseConnection.java:115)  at
sqlline.DatabaseConnection.getConnection(DatabaseConnection.java:203)  at
sqlline.Commands.close(Commands.java:906)  at
sqlline.Commands.quit(Commands.java:870)  at
java.lang.reflect.Method.invoke(libgcj.so.10)  at
sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:36)  at
sqlline.SqlLine.dispatch(SqlLine.java:804)  at
sqlline.SqlLine.initArgs(SqlLine.java:617)  at
sqlline.SqlLine.begin(SqlLine.java:656)  at
sqlline.SqlLine.start(SqlLine.java:398)  at
sqlline.SqlLine.main(SqlLine.java:292)

And here are the libs, links, and some other information

################################################################################ 

Libraries under /usr/hdp

###############################################################################[root@anteater-1 hd>pwd
/usr/hdp

>ls current/phoe*
current/phoenix-client:bin  doc  lib 
phoenix-4.4.0.2.4.0.0-169-client.jar 
phoenix-4.4.0.2.4.0.0-169-server.jar 
phoenix-4.4.0.2.4.0.0-169-thin-client.jar  phoenix-client.jar  phoenix-server.jar  phoenix-thin-client.jarcurrent/phoenix-server:bin  doc  lib 
phoenix-4.4.0.2.4.0.0-169-client.jar 
phoenix-4.4.0.2.4.0.0-169-server.jar 
phoenix-4.4.0.2.4.0.0-169-thin-client.jar  phoenix-client.jar  phoenix-server.jar  phoenix-thin-client.jar[root@anteater-1 hdp]

# find . -name "*phoenix*.jar"

./2.4.0.0-169/hbase/lib/phoenix-server.jar./2.4.0.0-169/phoenix/phoenix-thin-client.jar./2.4.0.0-169/phoenix/phoenix-client.jar./2.4.0.0-169/phoenix/phoenix-4.4.0.2.4.0.0-169-client.jar./2.4.0.0-169/phoenix/lib/phoenix-spark-4.4.0.2.4.0.0-169.jar./2.4.0.0-169/phoenix/lib/phoenix-server-client-4.4.0.2.4.0.0-169.jar./2.4.0.0-169/phoenix/lib/phoenix-server-4.4.0.2.4.0.0-169-sources.jar./2.4.0.0-169/phoenix/lib/phoenix-server-4.4.0.2.4.0.0-169-runnable.jar./2.4.0.0-169/phoenix/lib/phoenix-server-4.4.0.2.4.0.0-169-test-sources.jar./2.4.0.0-169/phoenix/lib/phoenix-spark-4.4.0.2.4.0.0-169-sources.jar./2.4.0.0-169/phoenix/lib/phoenix-pig-4.4.0.2.4.0.0-169.jar./2.4.0.0-169/phoenix/lib/phoenix-server-4.4.0.2.4.0.0-169.jar./2.4.0.0-169/phoenix/lib/phoenix-spark-4.4.0.2.4.0.0-169-test-sources.jar./2.4.0.0-169/phoenix/lib/phoenix-core-4.4.0.2.4.0.0-169-test-sources.jar./2.4.0.0-169/phoenix/lib/phoenix-core-4.4.0.2.4.0.0-169-sources.jar./2.4.0.0-169/phoenix/lib/phoenix-core-4.4.0.2.4.0.0-169.jar./2.4.0.0-169/phoenix/lib/phoenix-server-4.4.0.2.4.0.0-169-tests.jar./2.4.0.0-169/phoenix/lib/phoenix-flume-4.4.0.2.4.0.0-169.jar./2.4.0.0-169/phoenix/lib/phoenix-core-4.4.0.2.4.0.0-169-tests.jar./2.4.0.0-169/phoenix/lib/phoenix-spark-4.4.0.2.4.0.0-169-tests.jar./2.4.0.0-169/phoenix/phoenix-4.4.0.2.4.0.0-169-server.jar./2.4.0.0-169/phoenix/phoenix-server.jar./2.4.0.0-169/phoenix/phoenix-4.4.0.2.4.0.0-169-thin-client.jar[root@anteater-1 hdp]# cd current[root@anteater-1 current]# ls -l ph*lrwxrwxrwx. 1 root root 28 Mar 15 13:26 phoenix-client ->
/usr/hdp/2.4.0.0-169/phoenixlrwxrwxrwx. 1 root root 28 Mar 15 13:26 phoenix-server ->
/usr/hdp/2.4.0.0-169/phoenix# For completeness[root@anteater-1 ~]# hbase version2016-03-16 15:13:56,355 INFO 
[main] util.VersionInfo: HBase 1.1.2.2.4.0.0-1692016-03-16 15:13:56,356 INFO 
[main] util.VersionInfo: Source code repository
git://c66-slave-38a0b1a6-7/grid/0/jenkins/workspace/HDP-build-centos6/bigtop/build/hbase/rpm/BUILD/hbase-1.1.2.2.4.0.0
revision=61dfb2b344f424a11f93b3f086eab815c1eb0b6a2016-03-16 15:13:56,356 INFO 
[main] util.VersionInfo: Compiled by jenkins on Wed Feb 10 07:08:51 UTC
20162016-03-16 15:13:56,356 INFO 
[main] util.VersionInfo: From source with checksum
afb8421bf497c0e82b9489877d53b904[root@anteater-1 ~]# [root@anteater-1 ~]# ps -ef | grep queryroot  8730  1  0
15:02 ?  00:00:00 python
./queryserver.py startroot  8731  8730  0
15:02 ?  00:00:02
/usr/jdk64/jdk1.8.0_60/bin/java -cp /etc/hbase/conf:/etc/hadoop/conf:/usr/hdp/2.4.0.0-169/phoenix/bin/../lib/phoenix-server-4.4.0.2.4.0.0-169-runnable.jar:/usr/hdp/2.4.0.0-169/phoenix/bin/../phoenix-4.4.0.2.4.0.0-169-client.jar
-Dproc_phoenixserver
-Dlog4j.configuration=file:/usr/hdp/2.4.0.0-169/phoenix/bin/log4j.properties
-Dpsql.root.logger=INFO,DRFA -Dpsql.log.dir=/var/log/hbase -Dpsql.log.file=phoenix-root-server.log
org.apache.phoenix.queryserver.server.Main
1 ACCEPTED SOLUTION

avatar

There are a couple of things you should do:

1. Instead of manually configuring, you should enable Phoenix under the HBase settings in Ambari by clicking the slider. This will put all the jars and XML configs in the correct place.

2. Connect to sqline using /usr/hdp/current/phoenix-client/bin/sqlline.py zookeeper_host:2181:/hbase-unsecure In your example, you have a space instead of ":" between 2181 and /hbase-unsecure

View solution in original post

8 REPLIES 8

avatar

There are a couple of things you should do:

1. Instead of manually configuring, you should enable Phoenix under the HBase settings in Ambari by clicking the slider. This will put all the jars and XML configs in the correct place.

2. Connect to sqline using /usr/hdp/current/phoenix-client/bin/sqlline.py zookeeper_host:2181:/hbase-unsecure In your example, you have a space instead of ":" between 2181 and /hbase-unsecure

avatar
Expert Contributor

Doh, you mean theres a button for that!?! Searching the docs for "install phoenix" points you to the manual method, and I tend to assume the hard way is the right way!

I was able to turn Phoenix on in Ambari on a clean 2.3.4 sandbox, on which I had not tried to manually install it. This was successful.

However, trying to setup with Ambari on the machine with the manual install there were still issues. So, I would probably have to root out the old one and try it again, but since this is a test instance, I can just rebuild. Thanks!

avatar
Super Guru

Also worth mentioning that sqlline.py doesn't require you do run the QueryServer. That's only for sqlline-thin.py (or if you have other reasons you want to run the queryserver).

avatar
Rising Star

The information about the "push button" method for enabling Phoenix through Ambari should be easier to find now. I added the steps to the Using Apache HBase and Apache Phoenix doc page last week (for HDP 2.4.0+). We on the Tech Docs team are aware that the search functionality on the docs.hortonworks.com page needs improvement. Plans are to improve the search feature this summer.

avatar
Contributor

@jbarnett May I please know the issue got solved or not , I'm facing the exact same issue with my newly installed hdp 2.4.2,even after I pushed the button . I do need to use phoenix badly together with hdp platform , is there any detailed document to make it work?

avatar
Master Guru

avatar
Contributor

Actually I fixed this problem by install hdp 2.4.2 and download and installed phoenix 4.7.0 without using hdp provided phoenix

in /usr/hdp/current/hbase-regionserver/lib folder

-rw-r--r-- 1 root root 18263 May 30 22:50 phoenix-server-4.7.0-HBase-1.1.jar
-rw-r--r-- 1 root root 3636606 May 30 22:50 phoenix-core-4.7.0-HBase-1.1.jar
remember to restart hbase and make sure you had done classpath as following before executing sqlline.py
export CLASSPATH=$CLASSPATH:/root/phoenix/phoenix-4.7.0-HBase-1.1-bin/phoenix-4.7.0-HBase-1.1-client.jar
sqline.py namenode:2181:/hbase-unsecure
0: jdbc:phoenix:localhost:2181:/hbase-unsecur> CREATE TABLE TABLE1 (ID BIGINT NOT NULL PRIMARY KEY, COL1 VARCHAR);
No rows affected (1.243 seconds)
0: jdbc:phoenix:localhost:2181:/hbase-unsecur> UPSERT INTO TABLE1 (ID, COL1) VALUES (1, 'test_row_1');
1 row affected (0.074 seconds)
0: jdbc:phoenix:localhost:2181:/hbase-unsecur> UPSERT INTO TABLE1 (ID, COL1) VALUES (2, 'test_row_2');
1 row affected (0.008 seconds)
0: jdbc:phoenix:localhost:2181:/hbase-unsecur> Closing: org.apache.phoenix.jdbc.PhoenixConnection

make sure 
spark.executor.extraClassPath
spark.driver.extraClassPath
should like following :
/root/phoenix/phoenix-4.7.0-HBase-1.1-bin/phoenix-spark-4.7.0-HBase-1.1.jar:/root/phoenix/phoenix-4.7.0-HBase-1.1-bin/phoenix-4.7.0-HBase-1.1-client-spark.jar:/usr/hdp/current/hbase-client/lib/*.jar
don't add phoenix client to the path ,it causing conflict with other jars. the jars added all have spark in it's name
import org.apache.spark.SparkContext
import org.apache.spark.sql.SQLContext
import org.apache.phoenix.spark._
val sqlContext = new SQLContext(sc)
val df = sqlContext.load(
  "org.apache.phoenix.spark",
  Map("table" -> "TABLE1", "zkUrl" -> "localhost:2181:/hbase-unsecure")
)
df.filter(df("COL1") === "test_row_1" && df("ID") === 1L).select(df("ID")).show 

avatar

Before executing sqlline, please set the HADOOP_CLASSPATH using phoenix client jar and /etc/hbase/conf

export HADOOP_CLASSPATH=/usr/hdp/current/phoenix-client/phoenix-client.jar:${HADOOP_CLASSPATH}:/etc/hbase/conf/


With above, I am able to connect.


Hope this helps!