Pass the class name in config instead of concrete object. Excuse typos On Apr 20, 2016 9:43 PM, "Navin Ipe" <[email protected]> wrote:
> Does anyone know how to do this? If not adding a custom class, then at > least about how to maintain information retrieved from a database in a > single class which all spouts/bolts in all the workers will be able to > access? > > On Tue, Apr 19, 2016 at 2:52 PM, Navin Ipe < > [email protected]> wrote: > >> I have this >> >> Config config = new Config(); >> MongoDatabaseManager mongoManager = new MongoDatabaseManager(); >> config.put("MongoManager", mongoManager); >> >> and MongoDatabaseManager is an empty class: >> public class MongoDatabaseManager implements Serializable {} >> >> But after submitting the topology, I get this error: >> >> >> >> >> >> >> *14:45:18.320 [timer] DEBUG o.a.s.scheduler.SupervisorDetails - Creating >> a new supervisor (null-5b950364-129e-4e04-b10c-d1e496c12043) with >> resources: {"supervisor.cpu.capacity" 400.0, >> "supervisor.memory.capacity.mb" 3072.0}14:45:18.321 [main] ERROR >> o.a.s.s.o.a.z.s.NIOServerCnxnFactory - Thread Thread[main,5,main] >> diedjava.lang.IllegalArgumentException: Topology conf is not >> json-serializable at >> org.apache.storm.testing$submit_local_topology.invoke(testing.clj:299) >> ~[storm-core-1.0.0.jar:1.0.0] at >> org.apache.storm.LocalCluster$_submitTopology.invoke(LocalCluster.clj:49) >> ~[storm-core-1.0.0.jar:1.0.0] at >> org.apache.storm.LocalCluster.submitTopology(Unknown Source) >> ~[storm-core-1.0.0.jar:1.0.0] at >> com.slh.Basicstorm.BasicStorm.main(BasicStorm.java:44) ~[main/:na]* >> >> Why can't I add a custom class to config? The idea here is to store some >> info in the class so that all workers can access the information (because >> the class is part of the topology) even though they are part of different >> JVM's (the class can be accessed in the open() or prepare() functions of >> spouts or bolts, but first, I don't understand why this crash is happening). >> >> -- >> Regards, >> Navin >> > > > > -- > Regards, > Navin >
