2016-04-05 9 views
0

hbaseにタプルを書き込むhbase boltを持つストームトポロジを作成します。 しかし、トポロジを実行すると、常に以下のエラーが表示されます。 誰もこの問題を解決する方法を知っていますか?HBase設定がキー 'null'を使用して見つかりません

java.lang.IllegalArgumentException: HBase configuration not found using key 'null' 
at org.apache.storm.hbase.bolt.AbstractHBaseBolt.prepare(AbstractHBaseBolt.java:60) 

私はすでに以下のように、pom.xmlファイルでのHBase-site.xmlのをシリアライズ:

<plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-shade-plugin</artifactId> 
      <version>2.3</version> 
      <configuration> 
       <transformers> 
        <transformer 
         implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer"> 
        </transformer> 
       </transformers> 
      </configuration> 
      <executions> 
       <execution> 
        <phase>package</phase> 
        <goals> 
         <goal>shade</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>exec-maven-plugin</artifactId> 
      <version>1.2.1</version> 
      <executions> 
       <execution> 
        <goals> 
         <goal>exec</goal> 
        </goals> 
       </execution> 
      </executions> 
      <configuration> 
       <executable>java</executable> 
       <includeProjectDependencies>true</includeProjectDependencies> 
       <includePluginDependencies>false</includePluginDependencies> 
       <classpathScope>compile</classpathScope> 
       <mainClass>${storm.topology}</mainClass> 
      </configuration> 
     </plugin> 
    </plugins> 
    <resources> 
     <resource> 
      <directory>${basedir}/conf</directory> 
      <filtering>false</filtering> 
      <includes> 
       <include>hbase-site.xml</include> 
      </includes> 
     </resource> 
    </resources> 

は、事前にご協力いただきありがとうございます。

答えて

0

トポロジにhbase configパラメータを渡します。

public static final String HBASE_CONFIG_KEY = "hbase.conf"; 

1)嵐の設定では、新しい設定HBASE_CONFIG_KEYを設定します。私のために働いたHBaseのボルト設定セットの設定キーHBASE_CONFIG_KEY

HBaseBolt hBaseBolt = new HBaseBolt(topologyConfig.getProperty(CFG_HBASE_BOLT_TABLE_NAME), new CbossCdrRecordMapper()) 
      .withConfigKey(HBASE_CONFIG_KEY) 
      .withBatchSize(1000) 
      .withFlushIntervalSecs(flushInterval) 
      .withBatchSize(Integer.valueOf(topologyConfig.getProperty(CFG_HBASE_BOLT_BATCH_SIZE))); 

Config config = new Config(); 
String rootDir = topologyConfig.getProperty("hbase.rootdir"); 
Map<String, Object> hbConf = new HashMap<>(); 
hbConf.put("hbase.rootdir", rootDir); 
config.put(HBASE_CONFIG_KEY, hbConf); 
StormSubmitter.submitTopology(topologyName, config, buildTopology()); 

2)。

関連する問題