phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Taylor <jamestay...@apache.org>
Subject Re: Re: Problem of Phoenix Hello World sample
Date Tue, 02 Sep 2014 20:40:15 GMT
Hi Liang,
I recommend you try this with the binaries we package in our 4.1 release
instead: http://phoenix.apache.org/download.html

Thanks,
James


On Tue, Sep 2, 2014 at 10:50 AM, 夏凉 <luoxiulu955@163.com> wrote:

> Hi Alex,
>
> I changed the code, but it still doesn't work. It output following error
> messages:
>
> [stsuid@ana-poc-01:~/HDP]$java -cp
> "./phoenix/hadoop-2/phoenix-4.0.0-incubating-client.jar:." HelloWorld
> Failed to instantiate SLF4J LoggerFactory
> Reported exception:
> java.lang.NoClassDefFoundError: org/apache/log4j/Level
> at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
> at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
> at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:279)
> at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252)
> at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:265)
> at org.apache.phoenix.jdbc.PhoenixDriver.<clinit>(PhoenixDriver.java:52)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:190)
> at HelloWorld.main(HelloWorld.java:16)
> Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level
> at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
> ... 9 more
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/log4j/Level
> at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
> at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
> at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:279)
> at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252)
> at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:265)
> at org.apache.phoenix.jdbc.PhoenixDriver.<clinit>(PhoenixDriver.java:52)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:190)
> at HelloWorld.main(HelloWorld.java:16)
> Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level
> at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
>
> I also tried to add slf4j-api-1.6.4.jar to my classpath and run code from
> eclipse directly, but it showed the same error message.
>
> Sqlline works well, so I think hostname will not be an issue.
> I just wonder if the command line I used is correct or not, or if there
> maybe any problem when I setup phoenix.
>
> I set the classpath in .bash_profile:
> export PHOENIX_HOME=$HDP_HOME/phoenix
> export
> CLASS_PATH=$CLASS_PATH:$PHOENIX_HOME/hadoop-2/phoenix-4.0.0-incubating-client.jar
>
> Command line I used:
> [stsuid@ana-poc-01:~/HDP]$javac HelloWorld.java
> [stsuid@ana-poc-01:~/HDP]$java -cp
> "./phoenix/hadoop-2/phoenix-4.0.0-incubating-client.jar:." HelloWorld
>
> Thanks,
>
>
> 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