简体   繁体   English

无法为Storm的JdbcInsertBolt加载Phoenix JDBC驱动程序

[英]Can't load Phoenix JDBC driver for Storm's JdbcInsertBolt

During initialization of Apache's Storm JdbcInsertBolt I get an error 在Apache的Storm JdbcInsertBolt初始化期间,出现错误

java.lang.ClassCastException: 
  Cannot cast org.apache.phoenix.jdbc.PhoenixDriver to javax.sql.DataSource
at com.zaxxer.hikari.util.UtilityElf.createInstance(UtilityElf.java:90)
at com.zaxxer.hikari.pool.PoolBase.initializeDataSource(PoolBase.java:292)
at com.zaxxer.hikari.pool.PoolBase.<init>(PoolBase.java:84)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:102)
at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:71)
at org.apache.storm.jdbc.common.HikariCPConnectionProvider.prepare(HikariCPConnectionProvider.java:53)
at org.apache.storm.jdbc.mapper.SimpleJdbcMapper.<init>(SimpleJdbcMapper.java:43)

from the underlying HikariCPConnectionProvider . 从基础HikariCPConnectionProvider Whats wrong? 怎么了?

I am following http://storm.apache.org/releases/1.1.2/storm-jdbc.html , here is what I am doing based on that: 我正在关注http://storm.apache.org/releases/1.1.2/storm-jdbc.html ,这是基于此我正在做的事情:

I like to write data from a Apache Storm topology to a HBase table via Phoenix. 我喜欢通过Phoenix将数据从Apache Storm拓扑写入HBase表。 For that I downloaded the driver-file ( phoenix-4.7.0.2.6.5.3003-25-client.jar ) from my cluster-Server and added it to my local maven repository: 为此,我从集群服务器下载了驱动程序文件( phoenix-4.7.0.2.6.5.3003-25-client.jar ),并将其添加到本地maven存储库中:

mvn install:install-file 
  -Dfile=lib\phoenix-4.7.0.2.6.5.3003-25-client.jar 
  -DgroupId=org.apache.phoenix 
  -DartifactId=phoenix-jdbc -Dversion=4.7.0 -Dpackaging=jar

After that I updated my .pom : 之后,我更新了.pom

<dependency>
    <groupId>org.apache.phoenix</groupId>
    <artifactId>phoenix-jdbc</artifactId>
    <version>4.7.0</version>
</dependency>

Now add Storm's JDBC-Bolt: 现在添加Storm的JDBC-Bolt:

<dependency>
    <groupId>org.apache.storm</groupId>
    <artifactId>storm-jdbc</artifactId>
    <version>1.2.2</version>
    <scope>provided</scope>
</dependency>

and I am set-up to use the bolt. 并且我准备使用螺栓。 First: Setup Connection-Provider: 首先:设置连接提供程序:

Map hikariConfigMap = new HashMap();
hikariConfigMap.put("dataSourceClassName", "org.apache.phoenix.jdbc.PhoenixDriver");
hikariConfigMap.put("dataSource.url", "<zookeeperQuorumURI>:2181:/hbase-unsecure");
this.connectionProvider = new HikariCPConnectionProvider(hikariConfigMap);

Now initialize the tuple-values-to-db-columns-mapper 现在将元组值初始化为db-columns-mapper

this.simpleJdbcMapper = new SimpleJdbcMapper(this.tablename, connectionProvider);

During this the error mentioned above happens. 在此期间,发生上述错误。

Just for completeness: The JdbcInsertBolt gets created like this: 仅出于完整性考虑: JdbcInsertBolt的创建如下:

new JdbcInsertBolt(this.connectionProvider, this.simpleJdbcMapper)
        .withTableName(this.tablename)
        .withQueryTimeoutSecs(30);

have you tried to set : 您是否尝试设定:

driverClassName -> org.apache.phoenix.jdbc.PhoenixDriver. driverClassName- > org.apache.phoenix.jdbc.PhoenixDriver。 The current code seems to have set the dataSourceClassName which is different i guess 当前代码似乎已经设置了dataSourceClassName,我猜这是不同的

Refering this 引用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM