storm作业提交到storm集群时,应该注意的地方

本地编写storm作业代码时用的storm-core依赖要和集群上依赖一致,否则会报版本错误。

<?xml version="1.0" encoding="UTF-8"?>


4.0.0

<groupId>com.jun.storm</groupId>
<artifactId>stormCount</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
    <groupId>org.apache.storm</groupId>
    <artifactId>storm-core</artifactId>
    <!--<scope>provided </scope>-->
    <version>1.2.2</version>
</dependency>
</dependencies>
<build>
    <plugins>
    <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
            <descriptorRefs>
                <!-- 将依赖的其他jar(如 MyLocalFileSpout,MySplit等)也一起打包 -->
                <descriptorRef>jar-with-dependencies</descriptorRef>
            </descriptorRefs>
            <archive>
                <manifest>
                    <!-- 可以在这里指定运行的主类,这样在打包为jar包后就可以不用指定需要运行的类 -->
                    <mainClass>
                        stormCount.StormTopologyDriver
                    </mainClass>
                </manifest>
            </archive>
        </configuration>
        <executions>
            <execution>
                <id>make-assembly</id>
                <phase>package</phase>
                <goals>
                    <goal>single</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>

本地pom.xml文件中,storm-core的作用域要修改为provide,这样打包时不会被打进去,因为集群上已经有storm的依赖了,否则会引起依赖冲突。

dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Exception in thread "main" java.lang.ExceptionInInitializerError
	at backtype.storm.topology.TopologyBuilder.createTopology(TopologyBuilder.java:106)
	at stormCount.StormTopologyDriver.main(StormTopologyDriver.java:26)
Caused by: java.lang.RuntimeException: Found multiple defaults.yaml resources. You're probably bundling the Storm  
jars with your topology jar. [jar:file:/root/stormCount-1.0-SNAPSHOT-jar-with-dependencies.jar!/defaults.yaml,  
jar:file:/itcast/apache-storm-1.2.2/lib/storm-core-1.2.2.jar!/defaults.yaml]
	at backtype.storm.utils.Utils.findAndReadConfigFile(Utils.java:133)
	at backtype.storm.utils.Utils.readDefaultConfig(Utils.java:160)
	at backtype.storm.utils.Utils.readStormConfig(Utils.java:184)
	at backtype.storm.utils.Utils.<clinit>(Utils.java:71)
	... 2 more
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值