phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 夏凉 <luoxiulu...@163.com>
Subject Re:Re: Problem of Phoenix Hello World sample
Date Sun, 31 Aug 2014 04:26:38 GMT


Thanks Alex. I will try it later.


Liang





At 2014-08-30 09:00:55, "Alex Kamil" <alex.kamil@gmail.com> wrote:

Liang,


a few things to try
1.add in the beginning:
public static String JDBC_DRIVER = "org.apache.phoenix.jdbc.PhoenixDriver";
 try {

                Class.forName(JDBC_DRIVER);

        } catch (ClassNotFoundException e) {

                e.printStackTrace();

        }

2. update /etc/hosts with your server hostname, example here :https://issues.apache.org/jira/browse/PHOENIX-1194

3. try connecting with sqlline first:

phoenix/bin/sqlline.py ana-poc-01

cheers

Alex

|
|



On Fri, Aug 29, 2014 at 3:01 PM, 夏凉 <luoxiulu955@163.com> wrote:

Hi there,


I have a problem of HelloWorld example. http://phoenix.apache.org/faq.html


[stsuid@ana-poc-01:~/HDP]$java -cp "./HDP/phoenix/hadoop-2/phoenix-4.0.0-incubating-client.jar:."
HelloWorld
Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:phoenix:ana-poc-01
at java.sql.DriverManager.getConnection(DriverManager.java:596)
at java.sql.DriverManager.getConnection(DriverManager.java:233)
at HelloWorld.main(HelloWorld.java:14)


My environment:
hadoop version: hadoop-2.2.0
hbase version: hbase-0.98.5
phoenix version: phoenix-4.0.0


I changed hbase.defaults.for.version over to 0.98.1-hadoop2 in hbase-defaul.xml in phoenix-4.0.0/hadoop-2/phoenix-4.0.0-incubating-client.jar
<property skipInDoc="true">
    <name>hbase.defaults.for.version</name>
    <value>0.98.1-hadoop2</value>
    <description>This defaults file was compiled for version ${project.version}. This
variable is used
    to make sure that a user doesn't have an old version of hbase-default.xml on the
    classpath.</description>
</property>


I copied phoenix-*.jar to HBase lib folder and restarted HBase.
I added the phoenix-4.0.0-incubating-client.jar to the classpath of ana-poc-01(my phoenix
client)


I only changed zookeeper name in java code:
Connection con = DriverManager.getConnection("jdbc:phoenix:ana-poc-01");


Then in command line, I run:
[stsuid@ana-poc-01:~/HDP]$javac HelloWorld.java
[stsuid@ana-poc-01:~/HDP]$java -cp "./HDP/phoenix/hadoop-2/phoenix-4.0.0-incubating-client.jar:."
HelloWorld


What may cause this problem? Anyone has some ideas?


Thanks,
Liang






Mime
View raw message