mongodb - ERROR backtype.storm.util - Async loop died! java.lang.RuntimeException: java.lang.NullPointerException -
i trying write output of storm word count program mongodb.this error getting when executing program.though able print reusult.problem starts when trying write output.
the error generated :
jun 01, 2015 3:24:23 pm com.mongodb.dbtcpconnector fetchmaxbsonobjectsize warning: exception determining maxbson size using0 java.io.ioexception: couldn't connect [ritesh-rm/127.0.1.1:27017] bc:java.net.connectexception: connection refused @ com.mongodb.dbport._open(dbport.java:206) @ com.mongodb.dbport.go(dbport.java:94) @ com.mongodb.dbport.go(dbport.java:75) @ com.mongodb.dbport.findone(dbport.java:129) @ com.mongodb.dbport.runcommand(dbport.java:138) @ com.mongodb.dbtcpconnector.fetchmaxbsonobjectsize(dbtcpconnector.java:419) @ com.mongodb.mongo.getmaxbsonobjectsize(mongo.java:541) @ com.mongodb.dbapilayer$mycollection.insert(dbapilayer.java:237) @ com.mongodb.dbapilayer$mycollection.insert(dbapilayer.java:210) @ com.mongodb.dbcollection.insert(dbcollection.java:80) @ bolts.wordcounter.execute(wordcounter.java:88) @ backtype.storm.topology.basicboltexecutor.execute(basicboltexecutor.java:50) @ backtype.storm.daemon.executor$fn__3439$tuple_action_fn__3441.invoke(executor.clj:633) @ backtype.storm.daemon.executor$mk_task_receiver$fn__3362.invoke(executor.clj:401) @ backtype.storm.disruptor$clojure_handler$reify__1445.onevent(disruptor.clj:58) @ backtype.storm.utils.disruptorqueue.consumebatchtocursor(disruptorqueue.java:125) @ backtype.storm.utils.disruptorqueue.consumebatchwhenavailable(disruptorqueue.java:99) @ backtype.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:80) @ backtype.storm.daemon.executor$fn__3439$fn__3451$fn__3498.invoke(executor.clj:748) @ backtype.storm.util$async_loop$fn__460.invoke(util.clj:463) @ clojure.lang.afn.run(afn.java:24) @ java.lang.thread.run(thread.java:745) jun 01, 2015 3:24:23 pm com.mongodb.dbtcpconnector fetchmaxbsonobjectsize warning: exception determining maxbson size using0 java.io.ioexception: couldn't connect [ritesh-rm/127.0.1.1:27017] bc:java.net.connectexception: connection refused @ com.mongodb.dbport._open(dbport.java:206) @ com.mongodb.dbport.go(dbport.java:94) @ com.mongodb.dbport.go(dbport.java:75) @ com.mongodb.dbport.findone(dbport.java:129) @ com.mongodb.dbport.runcommand(dbport.java:138) @ com.mongodb.dbtcpconnector.fetchmaxbsonobjectsize(dbtcpconnector.java:419) @ com.mongodb.dbtcpconnector.checkmaster(dbtcpconnector.java:406) @ com.mongodb.dbtcpconnector.say(dbtcpconnector.java:144) @ com.mongodb.dbtcpconnector.say(dbtcpconnector.java:137) @ com.mongodb.dbapilayer$mycollection.insert(dbapilayer.java:255) @ com.mongodb.dbapilayer$mycollection.insert(dbapilayer.java:210) @ com.mongodb.dbcollection.insert(dbcollection.java:80) @ bolts.wordcounter.execute(wordcounter.java:88) @ backtype.storm.topology.basicboltexecutor.execute(basicboltexecutor.java:50) @ backtype.storm.daemon.executor$fn__3439$tuple_action_fn__3441.invoke(executor.clj:633) @ backtype.storm.daemon.executor$mk_task_receiver$fn__3362.invoke(executor.clj:401) @ backtype.storm.disruptor$clojure_handler$reify__1445.onevent(disruptor.clj:58) @ backtype.storm.utils.disruptorqueue.consumebatchtocursor(disruptorqueue.java:125) @ backtype.storm.utils.disruptorqueue.consumebatchwhenavailable(disruptorqueue.java:99) @ backtype.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:80) @ backtype.storm.daemon.executor$fn__3439$fn__3451$fn__3498.invoke(executor.clj:748) @ backtype.storm.util$async_loop$fn__460.invoke(util.clj:463) @ clojure.lang.afn.run(afn.java:24) @ java.lang.thread.run(thread.java:745) jun 01, 2015 3:24:23 pm com.mongodb.dbportpool goterror warning: emptying dbportpool localhost:27017 b/c of error java.io.ioexception: couldn't connect [ritesh-rm/127.0.1.1:27017] bc:java.net.connectexception: connection refused @ com.mongodb.dbport._open(dbport.java:206) @ com.mongodb.dbport.go(dbport.java:94) @ com.mongodb.dbport.go(dbport.java:75) @ com.mongodb.dbport.say(dbport.java:70) @ com.mongodb.dbtcpconnector.say(dbtcpconnector.java:151) @ com.mongodb.dbtcpconnector.say(dbtcpconnector.java:137) @ com.mongodb.dbapilayer$mycollection.insert(dbapilayer.java:255) @ com.mongodb.dbapilayer$mycollection.insert(dbapilayer.java:210) @ com.mongodb.dbcollection.insert(dbcollection.java:80) @ bolts.wordcounter.execute(wordcounter.java:88) @ backtype.storm.topology.basicboltexecutor.execute(basicboltexecutor.java:50) @ backtype.storm.daemon.executor$fn__3439$tuple_action_fn__3441.invoke(executor.clj:633) @ backtype.storm.daemon.executor$mk_task_receiver$fn__3362.invoke(executor.clj:401) @ backtype.storm.disruptor$clojure_handler$reify__1445.onevent(disruptor.clj:58) @ backtype.storm.utils.disruptorqueue.consumebatchtocursor(disruptorqueue.java:125) @ backtype.storm.utils.disruptorqueue.consumebatchwhenavailable(disruptorqueue.java:99) @ backtype.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:80) @ backtype.storm.daemon.executor$fn__3439$fn__3451$fn__3498.invoke(executor.clj:748) @ backtype.storm.util$async_loop$fn__460.invoke(util.clj:463) @ clojure.lang.afn.run(afn.java:24) @ java.lang.thread.run(thread.java:745) 8037 [thread-9-word-counter] error backtype.storm.util - async loop died! java.lang.runtimeexception: java.lang.nullpointerexception @ backtype.storm.utils.disruptorqueue.consumebatchtocursor(disruptorqueue.java:128) ~[storm-core-0.9.4.jar:0.9.4] @ backtype.storm.utils.disruptorqueue.consumebatchwhenavailable(disruptorqueue.java:99) ~[storm-core-0.9.4.jar:0.9.4] @ backtype.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:80) ~[storm-core-0.9.4.jar:0.9.4] @ backtype.storm.daemon.executor$fn__3439$fn__3451$fn__3498.invoke(executor.clj:748) ~[storm-core-0.9.4.jar:0.9.4] @ backtype.storm.util$async_loop$fn__460.invoke(util.clj:463) ~[storm-core-0.9.4.jar:0.9.4] @ clojure.lang.afn.run(afn.java:24) [clojure-1.5.1.jar:na] @ java.lang.thread.run(thread.java:745) [na:1.7.0_79] caused by: java.lang.nullpointerexception: null @ com.mongodb.dbtcpconnector._error(dbtcpconnector.java:287) ~[com.mongodb.jar:na] @ com.mongodb.dbtcpconnector.say(dbtcpconnector.java:161) ~[com.mongodb.jar:na] @ com.mongodb.dbtcpconnector.say(dbtcpconnector.java:137) ~[com.mongodb.jar:na] @ com.mongodb.dbapilayer$mycollection.insert(dbapilayer.java:255) ~[com.mongodb.jar:na] @ com.mongodb.dbapilayer$mycollection.insert(dbapilayer.java:210) ~[com.mongodb.jar:na] @ com.mongodb.dbcollection.insert(dbcollection.java:80) ~[com.mongodb.jar:na] @ bolts.wordcounter.execute(wordcounter.java:88) ~[classes/:na] @ backtype.storm.topology.basicboltexecutor.execute(basicboltexecutor.java:50) ~[storm-core-0.9.4.jar:0.9.4] @ backtype.storm.daemon.executor$fn__3439$tuple_action_fn__3441.invoke(executor.clj:633) ~[storm-core-0.9.4.jar:0.9.4] @ backtype.storm.daemon.executor$mk_task_receiver$fn__3362.invoke(executor.clj:401) ~[storm-core-0.9.4.jar:0.9.4] @ backtype.storm.disruptor$clojure_handler$reify__1445.onevent(disruptor.clj:58) ~[storm-core-0.9.4.jar:0.9.4] @ backtype.storm.utils.disruptorqueue.consumebatchtocursor(disruptorqueue.java:125) ~[storm-core-0.9.4.jar:0.9.4] ... 6 common frames omitted 8038 [thread-9-word-counter] error backtype.storm.daemon.executor - java.lang.runtimeexception: java.lang.nullpointerexception @ backtype.storm.utils.disruptorqueue.consumebatchtocursor(disruptorqueue.java:128) ~[storm-core-0.9.4.jar:0.9.4] @ backtype.storm.utils.disruptorqueue.consumebatchwhenavailable(disruptorqueue.java:99) ~[storm-core-0.9.4.jar:0.9.4] @ backtype.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:80) ~[storm-core-0.9.4.jar:0.9.4] @ backtype.storm.daemon.executor$fn__3439$fn__3451$fn__3498.invoke(executor.clj:748) ~[storm-core-0.9.4.jar:0.9.4] @ backtype.storm.util$async_loop$fn__460.invoke(util.clj:463) ~[storm-core-0.9.4.jar:0.9.4] @ clojure.lang.afn.run(afn.java:24) [clojure-1.5.1.jar:na] @ java.lang.thread.run(thread.java:745) [na:1.7.0_79] caused by: java.lang.nullpointerexception: null @ com.mongodb.dbtcpconnector._error(dbtcpconnector.java:287) ~[com.mongodb.jar:na] @ com.mongodb.dbtcpconnector.say(dbtcpconnector.java:161) ~[com.mongodb.jar:na] @ com.mongodb.dbtcpconnector.say(dbtcpconnector.java:137) ~[com.mongodb.jar:na] @ com.mongodb.dbapilayer$mycollection.insert(dbapilayer.java:255) ~[com.mongodb.jar:na] @ com.mongodb.dbapilayer$mycollection.insert(dbapilayer.java:210) ~[com.mongodb.jar:na] @ com.mongodb.dbcollection.insert(dbcollection.java:80) ~[com.mongodb.jar:na] @ bolts.wordcounter.execute(wordcounter.java:88) ~[classes/:na] @ backtype.storm.topology.basicboltexecutor.execute(basicboltexecutor.java:50) ~[storm-core-0.9.4.jar:0.9.4] @ backtype.storm.daemon.executor$fn__3439$tuple_action_fn__3441.invoke(executor.clj:633) ~[storm-core-0.9.4.jar:0.9.4] @ backtype.storm.daemon.executor$mk_task_receiver$fn__3362.invoke(executor.clj:401) ~[storm-core-0.9.4.jar:0.9.4] @ backtype.storm.disruptor$clojure_handler$reify__1445.onevent(disruptor.clj:58) ~[storm-core-0.9.4.jar:0.9.4] @ backtype.storm.utils.disruptorqueue.consumebatchtocursor(disruptorqueue.java:125) ~[storm-core-0.9.4.jar:0.9.4] ... 6 common frames omitted 8137 [thread-9-word-counter] error backtype.storm.util - halting process: ("worker died") java.lang.runtimeexception: ("worker died") @ backtype.storm.util$exit_process_bang_.doinvoke(util.clj:325) [storm-core-0.9.4.jar:0.9.4] @ clojure.lang.restfn.invoke(restfn.java:423) [clojure-1.5.1.jar:na] @ backtype.storm.daemon.worker$fn__4693$fn__4694.invoke(worker.clj:491) [storm-core-0.9.4.jar:0.9.4] @ backtype.storm.daemon.executor$mk_executor_data$fn__3272$fn__3273.invoke(executor.clj:240) [storm-core-0.9.4.jar:0.9.4] @ backtype.storm.util$async_loop$fn__460.invoke(util.clj:473) [storm-core-0.9.4.jar:0.9.4] @ clojure.lang.afn.run(afn.java:24) [clojure-1.5.1.jar:na] @ java.lang.thread.run(thread.java:745) [na:1.7.0_79]
****wordcounter bolt****
public class wordcounter extends basebasicbolt { integer id; string name; map<string, integer> counters; /** * @ end of spout (when cluster shutdown * show word counters */ @override public void cleanup() { /*try{ mongoclient client = new mongoclient(new serveraddress("localhost", 27017)); db database = client.getdb("storm"); final dbcollection collection = database.getcollection("query"); basicdbobject dbobject = new basicdbobject(); for(map.entry<string, integer> entry : counters.entryset()){ dbobject.put("searchitem",entry.getkey()); dbobject.put("count",entry.getvalue()); collection.insert(dbobject); } client.close(); }catch (unknownhostexception e) { e.printstacktrace(); }*/ } /** * on create */ @override public void prepare(map stormconf, topologycontext context) { this.counters = new hashmap<string, integer>(); this.name = context.getthiscomponentid(); this.id = context.getthistaskid(); } @override public void declareoutputfields(outputfieldsdeclarer declarer) {} @override public void execute(tuple input, basicoutputcollector collector) { string str = input.getstring(0); /** * if word dosn't exist in map create * this, if not add 1 */ try{ mongo mongo = new mongo("localhost", 27017); db db = mongo.getdb("query"); final dbcollection table = db.getcollection("query"); basicdbobject dbobject = new basicdbobject(); if(!counters.containskey(str)){ counters.put(str, 1); dbobject.put("searchitem",str); dbobject.put("count",1); table.insert(dbobject); }else{ integer c = counters.get(str) + 1; counters.put(str, c); basicdbobject query = new basicdbobject(); query.put("searchitem", str); basicdbobject documentdetail = new basicdbobject(); documentdetail.put("count", c); basicdbobject updateobj = new basicdbobject(); updateobj.put("$set", documentdetail); table.update(query, updateobj); } }catch (unknownhostexception e) { e.printstacktrace(); } system.out.println("in counter : "); }
}
because of mongodb version facing error. changed in pom.xml , things working fine.
<dependency> <groupid>org.mongodb</groupid> <artifactid>mongo-java-driver</artifactid> <version>3.0.1</version> </dependency>
Comments
Post a Comment