以编程方式从风暴螺栓中杀死拓扑时编译错误:对象和包同名 [英] Compile Error when killing topology from storm bolt programatically: object and package with same name

查看:30
本文介绍了以编程方式从风暴螺栓中杀死拓扑时编译错误:对象和包同名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找如何在我的 scala 项目中的风暴 1.2.1 中从风暴螺栓中终止拓扑.从这个answer中,我编写了以下代码:

I was looking for how to kill a topology from a storm bolt in storm 1.2.1 in my scala project. From this answer, I wrote following code to do it:

  private def shutTopology(){
    import org.apache.storm.utils.Utils
    import org.apache.storm.utils.NimbusClient
    val conf = Utils.readStormConfig
    val nimbusClient = 
NimbusClient.getConfiguredClient(conf).getClient
    nimbusClient.deactivate(topology_name)
  }

但它给出了以下错误:val conf = Utils.readStormConfig,如何解决这个问题?

But it given following error in line: val conf = Utils.readStormConfig, How to resolve this?

错误:(46, 17) 包守护进程包含同名的对象和包:nimbus

Error:(46, 17) package daemon contains object and package with same name: nimbus

其中一个需要从类路径中删除

one of them needs to be removed from classpath

val conf = Utils.readStormConfig

val conf = Utils.readStormConfig

我通过 sbtmvn 编译得到上述错误.我在 here 看到了一些描述,但对如何操作没有太多帮助解决这个问题.

I get above error by compiling via both sbt and mvn. I see some description for this here but not much help on how to resolve this.

根据 here 的答案,我能够使用以下方法在 sbt 中编译它scalac 选项:

Based on the answer here, I was able to compile this in sbt using following scalac options:

"-Yresolve-term-conflict:object"

我仍然无法完成此操作,如何在使用 maven 编译时解决此错误.

I am stil not able to get this done how to resolve this error when compiling with maven.

推荐答案

根据here的答案,我能够使用以下 scalac 选项在 sbt 中编译它:

Based on the answer here, I was able to compile this in sbt using following scalac options:

"-Yresolve-term-conflict:object"

为了使用 maven 进行编译,我按照建议此处对我的 pom.xml 进行了以下更改:

to get this compiled with maven, I did following changes in my pom.xml as suggested here:

<configuration>
      <scalaVersion>${scala.version}</scalaVersion>
      <args>
        <arg>-Yresolve-term-conflict:object</arg> //this was added
      </args>
      <jvmArgs>
        <jvmArg>-Xms2048m</jvmArg>
        <jvmArg>-Xmx4096m</jvmArg>
      </jvmArgs>
</configuration>

这篇关于以编程方式从风暴螺栓中杀死拓扑时编译错误:对象和包同名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆