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

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

问题描述

我一直在寻找如何在我的 Scala 项目中从风暴 1.2.1 中的风暴螺栓中杀死拓扑.从这个答案,我编写了以下代码来做到这一点:

 private def ShutTopology(){导入 org.apache.storm.utils.Utils导入 org.apache.storm.utils.NimbusClientval conf = Utils.readStormConfigval nimbusClient =NimbusClient.getConfiguredClient(conf).getClientnimbusClient.deactivate(topology_name)}

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

<块引用>

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

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

val conf = Utils.readStormConfig

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

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

-Yresolve-term-conflict:object"

在使用 maven 编译时,我仍然无法解决此错误.

解决方案

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

"-Yresolve-term-conflict:object"

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

<预><代码><配置><scalaVersion>${scala.version}</scalaVersion><参数><arg>-Yresolve-term-conflict:object</arg>//这是添加的</args><jvmArgs><jvmArg>-Xms2048m</jvmArg><jvmArg>-Xmx4096m</jvmArg></jvmArgs></配置>

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

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

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

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.

Edit:

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

"-Yresolve-term-conflict:object"

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

解决方案

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

"-Yresolve-term-conflict:object"

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天全站免登陆