Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/339.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用键';找不到HBase配置;空';_Java_Maven_Hbase_Apache Storm - Fatal编程技术网

Java 使用键';找不到HBase配置;空';

Java 使用键';找不到HBase配置;空';,java,maven,hbase,apache-storm,Java,Maven,Hbase,Apache Storm,我创建了一个storm拓扑,它使用hbase螺栓将元组写入hbase。 但是当我运行拓扑时,它总是显示下面的错误。 有人知道如何解决这个问题吗 java.lang.IllegalArgumentException: HBase configuration not found using key 'null' at org.apache.storm.hbase.bolt.AbstractHBaseBolt.prepare(AbstractHBaseBolt.java:60) 我已经在pom.x

我创建了一个storm拓扑,它使用hbase螺栓将元组写入hbase。 但是当我运行拓扑时,它总是显示下面的错误。 有人知道如何解决这个问题吗

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>

org.apache.maven.plugins
maven阴影插件
2.3
包裹
阴凉处
org.codehaus.mojo
execmaven插件
1.2.1
执行官
JAVA
真的
假的
编译
${storm.topology}
${basedir}/conf
假的
hbase-site.xml

提前感谢您的帮助。

将hbase配置参数传递给您的拓扑

public static final String HBASE_CONFIG_KEY = "hbase.conf";
1) 在storm配置中,输入新设置HBASE\u配置键

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());
这对我很管用

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)));