phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Grayson <tgray...@bluemetal.com>
Subject How to correctly use Maven with Phoenix 4.1.0?
Date Thu, 04 Sep 2014 04:49:48 GMT
I wrote a Java program that uses Maven to reference the Phoenix JDBC client.  My code compiled
and ran well under Phoenix versions 3.0.0 and 4.0.0.  However, when I upgraded to 4.1.0, I've
encountered a bunch of new problems.  I am developing my code in Windows 7 using Eclipse Luna
with Java 1.7 and the m2e plugin.  My questions are:

*         What is the best way to include the Phoenix dependencies in Maven?

*         How do I fix the error regarding the missing winutils.exe for Hadoop (see below)?

Here are the details.  Under 4.0.0, I had this dependency in my pom.xml, and everything worked
great:

    <dependency>
       <groupId>org.apache.phoenix</groupId>
       <artifactId>phoenix</artifactId>
       <version>4.0.0-incubating</version>
       <classifier>client</classifier>
    </dependency>

I attempted to upgrade to 4.1.0 by including this in my pom.xml:

    <dependency>
       <groupId>org.apache.phoenix</groupId>
       <artifactId>phoenix</artifactId>
       <version>4.1.0</version>
       <type>pom</type>
    </dependency>

I got this error:

java.sql.SQLException: No suitable driver found for jdbc:phoenix:<zookeeper>
       at java.sql.DriverManager.getConnection(Unknown Source)
       at java.sql.DriverManager.getConnection(Unknown Source)
       . . .

Notably, version 4.1.0 has no Maven dependency with the "client" classifier as in prior versions.
 It has become type "pom", which is new.

I had better results when I manually added the phoenix-4.1.0-client-hadoop2.jar to my local
Maven repository.  I used this command:

mvn install:install-file -Dfile=phoenix-4.1.0-client-hadoop2.jar -DgroupId=org.apache.phoenix
-DartifactId=phoenix-client-hadoop2 -Dversion=4.1.0 -Dpackaging=jar

Then I placed this dependency in the pom.xml:

    <dependency>
       <groupId>org.apache.phoenix</groupId>
       <artifactId>phoenix-client-hadoop2</artifactId>
       <version>4.1.0</version>
    </dependency>

The code then ran to completion, but I got this disturbing warning and error as it was launching:

14/09/03 01:02:29 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your
platform... using builtin-java classes where applicable
14/09/03 01:02:30 ERROR util.Shell: Failed to locate the winutils binary in the hadoop binary
path
java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.
       at org.apache.hadoop.util.Shell.getQualifiedBinPath(Shell.java:278)
       at org.apache.hadoop.util.Shell.getWinUtilsPath(Shell.java:300)
       at org.apache.hadoop.util.Shell.<clinit>(Shell.java:293)
       at org.apache.hadoop.util.StringUtils.<clinit>(StringUtils.java:76)
       at org.apache.hadoop.conf.Configuration.getStrings(Configuration.java:1514)
       at org.apache.hadoop.hbase.zookeeper.ZKConfig.makeZKProps(ZKConfig.java:113)
       at org.apache.hadoop.hbase.zookeeper.ZKConfig.getZKQuorumServersString(ZKConfig.java:265)
       at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.java:159)
       at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.java:134)
       at org.apache.hadoop.hbase.client.ZooKeeperKeepAliveConnection.<init>(ZooKeeperKeepAliveConnection.java:43)
       at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getKeepAliveZooKeeperWatcher(HConnectionManager.java:1769)
       at org.apache.hadoop.hbase.client.ZooKeeperRegistry.getClusterId(ZooKeeperRegistry.java:82)
       at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.retrieveClusterId(HConnectionManager.java:858)
       at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.<init>(HConnectionManager.java:663)
       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
       at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
       at java.lang.reflect.Constructor.newInstance(Unknown Source)
       at org.apache.hadoop.hbase.client.HConnectionManager.createConnection(HConnectionManager.java:415)
       at org.apache.hadoop.hbase.client.HConnectionManager.createConnection(HConnectionManager.java:310)
       at org.apache.phoenix.query.HConnectionFactory$HConnectionFactoryImpl.createConnection(HConnectionFactory.java:47)
       at org.apache.phoenix.query.ConnectionQueryServicesImpl.openConnection(ConnectionQueryServicesImpl.java:235)
       at org.apache.phoenix.query.ConnectionQueryServicesImpl.access$300(ConnectionQueryServicesImpl.java:147)
       at org.apache.phoenix.query.ConnectionQueryServicesImpl$9.call(ConnectionQueryServicesImpl.java:1510)
       at org.apache.phoenix.query.ConnectionQueryServicesImpl$9.call(ConnectionQueryServicesImpl.java:1489)
       at org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:77)
       at org.apache.phoenix.query.ConnectionQueryServicesImpl.init(ConnectionQueryServicesImpl.java:1489)
       at org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:162)
       at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.connect(PhoenixEmbeddedDriver.java:129)
       at org.apache.phoenix.jdbc.PhoenixDriver.connect(PhoenixDriver.java:133)
       at java.sql.DriverManager.getConnection(Unknown Source)
       at java.sql.DriverManager.getConnection(Unknown Source)
       . . .

I later found the Phoenix documentation on Maven<https://phoenix.apache.org/building.html>
and tried adding a dependency to phoenix-core:

       <dependency>
              <groupId>org.apache.phoenix</groupId>
              <artifactId>phoenix-core</artifactId>
              <version>4.1.0</version>
       </dependency>

This required me to add a dependency to tools.jar in the JDK.  Using ${java.home} in the systemPath
element does not work due to issues with the m2e plugin<http://stackoverflow.com/a/23129154>:

       <dependency>
              <groupId>jdk.tools</groupId>
              <artifactId>jdk.tools</artifactId>
              <version>1.6</version>
              <scope>system</scope>
              <systemPath>C:/Program Files/java/jdk1.7.0_67/lib/tools.jar</systemPath>
       </dependency>

This produces the same result-functional but with the wintools.exe error-that occurred with
the client jar that I manually inserted into my Maven repository.

I look forward to your advice.

Tom Grayson


Mime
View raw message