我运行一些Java代码,它将上传:storm-starter-topologies-0.9.6.jar
从示例中,控制台显示:


  535 [main] INFO backtype.storm.StormSubmitter-上传拓扑jar C:\ apachestorm096 \ examples \ storm-starter \ storm-starter-topologies-0.9.6.jar到分配的位置:¨/ usr / local / storm /data¨ /nimbus/inbox/stormjar-8b5acdaf-e6ce-4b01-9ea9-9bd92e30f417.jar
  
  1066 [main] INFO backtype.storm.StormSubmitter-已成功将拓扑jar上传到指定位置:¨/ usr / local / storm /data¨/ nimbus / inbox / stormjar-8b5acdaf-e6ce-4b01-9ea9-9bd92e30f417.jar


但是我也得到一个错误:


  线程“主” org.apache.thrift7.TApplicationException中的异常:submitTopology失败:响应不正确


在Storm UI中显示提交的拓扑...
但是什么也没有发生,没有溪流,没有喷口,没有螺栓...没有工人...
Eclipse在本地运行,并且storm + zookeeper在虚拟机上运行。

这是代码:

  TopologyBuilder builder = new TopologyBuilder();
  Config conf = new Config();
  conf.put(Config.NIMBUS_HOST, "100.0.0.26");
  conf.put(Config.STORM_ZOOKEEPER_PORT, "2181");

  conf.setNumWorkers(20);
  conf.setMaxSpoutPending(5000);

  StormSubmitter submitter = new StormSubmitter();
  conf.setDebug(true);
  Map storm_conf = Utils.readStormConfig();
  storm_conf.put("nimbus.host", "100.0.0.26");
  Client client = NimbusClient.getConfiguredClient(storm_conf).getClient();
  try {
      NimbusClient nimbus = new NimbusClient(storm_conf, "100.0.0.26", 6627);


  //submitter.submitTopology("blub", conf, builder.createTopology());

  String inputJar = "C:\\apachestorm096\\examples\\storm-starter\\storm-starter-topologies-0.9.6.jar";
  // upload topology jar to Cluster using StormSubmitter
 String uploadedJarLocation = StormSubmitter.submitJar(storm_conf,inputJar);

 System.out.println("Try ... ");
 try {

      String jsonConf = JSONValue.toJSONString(storm_conf);
      System.out.println("Config : " + jsonConf );

      nimbus.getClient().send_getNimbusConf();
      Thread.sleep(5000);
      System.out.println("Out of sleep ... ");
      nimbus.getClient().submitTopology("word-count", uploadedJarLocation, jsonConf, builder.createTopology());


  } catch (AlreadyAliveException e) {  // (AlreadyAliveException ae) {
      e.printStackTrace();
  }

最佳答案

由于设置的配置参数太少而引发错误。
我忘了设置NIMBUS_THRIFT_PORT,我也更改了配置的定义方式...

  TopologyBuilder builder = new TopologyBuilder();
  Map conf = new HashMap();
  //Map conf = Utils.readStormConfig();
  conf.put(Config.NIMBUS_HOST, "100.0.0.26");
  conf.put(Config.NIMBUS_THRIFT_PORT , 6627 );
  conf.put(Config.STORM_ZOOKEEPER_PORT, 2181 );
  conf.put(Config.TOPOLOGY_WORKERS , 4);

  conf.put("storm.thrift.transport", "backtype.storm.security.auth.SimpleTransportPlugin");

关于java - 异常:submitTopology失败:响应不正确,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34473864/

10-13 09:46