把storm-core改为jstorm-core遇到的坑

在pom中把apache的storm-core包依赖(版本2.1.1)改为alibaba的jstorm-core包依赖,运行程序报错,打印最多的是下面的异常日志。在网上也没有找到相应的解决办法。所有就记录下来:
ava.lang.RuntimeException: java.lang.IllegalStateException: Attempting to call unbound fn: #'carbonite.api/register-serializers
	at backtype.storm.serialization.SerializationFactory.getKryo(SerializationFactory.java:75) ~[jstorm-core-2.1.1.jar:na]
	at backtype.storm.serialization.KryoValuesDeserializer.<init>(KryoValuesDeserializer.java:33) ~[jstorm-core-2.1.1.jar:na]
	at backtype.storm.serialization.KryoTupleDeserializer.<init>(KryoTupleDeserializer.java:52) ~[jstorm-core-2.1.1.jar:na]
	at com.alibaba.jstorm.daemon.worker.WorkerData.updateKryoSerializer(WorkerData.java:420) ~[jstorm-core-2.1.1.jar:na]
	at com.alibaba.jstorm.daemon.worker.WorkerData.<init>(WorkerData.java:376) ~[jstorm-core-2.1.1.jar:na]
	at com.alibaba.jstorm.daemon.worker.Worker.<init>(Worker.java:67) ~[jstorm-core-2.1.1.jar:na]
	at com.alibaba.jstorm.daemon.worker.Worker.mk_worker(Worker.java:262) ~[jstorm-core-2.1.1.jar:na]
	at com.alibaba.jstorm.daemon.supervisor.SyncProcessEvent.launchWorker(SyncProcessEvent.java:446) ~[jstorm-core-2.1.1.jar:na]
	at com.alibaba.jstorm.daemon.supervisor.SyncProcessEvent.startNewWorkers(SyncProcessEvent.java:991) ~[jstorm-core-2.1.1.jar:na]
	at com.alibaba.jstorm.daemon.supervisor.SyncProcessEvent.run(SyncProcessEvent.java:187) ~[jstorm-core-2.1.1.jar:na]
	at com.alibaba.jstorm.daemon.supervisor.SyncSupervisorEvent.run(SyncSupervisorEvent.java:192) [jstorm-core-2.1.1.jar:na]
	at com.alibaba.jstorm.event.EventManagerImp.run(EventManagerImp.java:71) [jstorm-core-2.1.1.jar:na]
	at com.alibaba.jstorm.callback.AsyncLoopRunnable.run(AsyncLoopRunnable.java:95) [jstorm-core-2.1.1.jar:na]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]
Caused by: java.lang.IllegalStateException: Attempting to call unbound fn: #'carbonite.api/register-serializers
	at clojure.lang.Var$Unbound.throwArity(Var.java:43) ~[clojure-1.6.0.jar:na]
	at clojure.lang.AFn.invoke(AFn.java:36) ~[clojure-1.6.0.jar:na]
	at clojure.lang.Var.invoke(Var.java:383) ~[clojure-1.6.0.jar:na]
	at carbonite.JavaBridge.registerPrimitives(JavaBridge.java:43) ~[carbonite-1.4.0.jar:na]
	at backtype.storm.serialization.SerializationFactory.getKryo(SerializationFactory.java:72) ~[jstorm-core-2.1.1.jar:na]
	... 13 common frames omitted

在打印的很多日志中,终于发现了一处不同的错误日志:根据类的名字是序列号的相关类。

java.lang.ClassNotFoundException: com.twitter.chill.java.RegexSerializer, compiling:(carbonite/serializer.clj:1:1)
	at clojure.lang.Compiler.load(Compiler.java:7142)
	at clojure.lang.RT.loadResourceScript(RT.java:370)
	at clojure.lang.RT.loadResourceScript(RT.java:361)
	at clojure.lang.RT.load(RT.java:440)
	at clojure.lang.RT.load(RT.java:411)
	at clojure.core$load$fn__5066.invoke(core.clj:5641)
	at clojure.core$load.doInvoke(core.clj:5640)
	at clojure.lang.RestFn.invoke(RestFn.java:408)
	at clojure.core$load_one.invoke(core.clj:5446)
	at clojure.core$load_lib$fn__5015.invoke(core.clj:5486)
	at clojure.core$load_lib.doInvoke(core.clj:5485)
	at clojure.lang.RestFn.applyTo(RestFn.java:142)
	at clojure.core$apply.invoke(core.clj:626)
	at clojure.core$load_libs.doInvoke(core.clj:5524)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.core$apply.invoke(core.clj:626)
	at clojure.core$require.doInvoke(core.clj:5607)
	at clojure.lang.RestFn.invoke(RestFn.java:421)
	at carbonite.api$eval3$loading__4958__auto____4.invoke(api.clj:1)
	at carbonite.api$eval3.invoke(api.clj:1)
	at clojure.lang.Compiler.eval(Compiler.java:6703)
	at clojure.lang.Compiler.eval(Compiler.java:6692)
	at clojure.lang.Compiler.load(Compiler.java:7130)
	at clojure.lang.RT.loadResourceScript(RT.java:370)
	at clojure.lang.RT.loadResourceScript(RT.java:361)
	at clojure.lang.RT.load(RT.java:440)
	at clojure.lang.RT.load(RT.java:411)
	at clojure.core$load$fn__5066.invoke(core.clj:5641)
	at clojure.core$load.doInvoke(core.clj:5640)
	at clojure.lang.RestFn.invoke(RestFn.java:408)
	at clojure.core$load_one.invoke(core.clj:5446)
	at clojure.core$load_lib$fn__5015.invoke(core.clj:5486)
	at clojure.core$load_lib.doInvoke(core.clj:5485)
	at clojure.lang.RestFn.applyTo(RestFn.java:142)
	at clojure.core$apply.invoke(core.clj:626)
	at clojure.core$load_libs.doInvoke(core.clj:5524)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.core$apply.invoke(core.clj:626)
	at clojure.core$require.doInvoke(core.clj:5607)
	at clojure.lang.RestFn.invoke(RestFn.java:408)
	at clojure.lang.Var.invoke(Var.java:379)
	at carbonite.JavaBridge.initialize(JavaBridge.java:24)
	at carbonite.JavaBridge.registerPrimitives(JavaBridge.java:42)
	at backtype.storm.serialization.SerializationFactory.getKryo(SerializationFactory.java:72)
	at backtype.storm.serialization.KryoValuesDeserializer.<init>(KryoValuesDeserializer.java:33)
	at backtype.storm.serialization.KryoTupleDeserializer.<init>(KryoTupleDeserializer.java:52)
	at com.alibaba.jstorm.daemon.worker.WorkerData.updateKryoSerializer(WorkerData.java:420)
	at com.alibaba.jstorm.daemon.worker.WorkerData.<init>(WorkerData.java:376)
	at com.alibaba.jstorm.daemon.worker.Worker.<init>(Worker.java:67)
	at com.alibaba.jstorm.daemon.worker.Worker.mk_worker(Worker.java:262)
	at com.alibaba.jstorm.daemon.supervisor.SyncProcessEvent.launchWorker(SyncProcessEvent.java:446)
	at com.alibaba.jstorm.daemon.supervisor.SyncProcessEvent.startNewWorkers(SyncProcessEvent.java:991)
	at com.alibaba.jstorm.daemon.supervisor.SyncProcessEvent.run(SyncProcessEvent.java:187)
	at com.alibaba.jstorm.daemon.supervisor.SyncSupervisorEvent.run(SyncSupervisorEvent.java:192)
	at com.alibaba.jstorm.event.EventManagerImp.run(EventManagerImp.java:71)
	at com.alibaba.jstorm.callback.AsyncLoopRunnable.run(AsyncLoopRunnable.java:95)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: com.twitter.chill.java.RegexSerializer
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:61)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at carbonite.serializer$eval9$loading__4958__auto____10.invoke(serializer.clj:1)
	at carbonite.serializer$eval9.invoke(serializer.clj:1)
	at clojure.lang.Compiler.eval(Compiler.java:6703)
	at clojure.lang.Compiler.eval(Compiler.java:6692)
	at clojure.lang.Compiler.load(Compiler.java:7130)
	... 56 more

最后在项目中pom加入jstorm-core和chill-java依赖。问题解决了。另外也可以下载jstorm的源码,在jstorm-core的工程下的pom.xml文件中加入chill-java依赖,然后mvn install 到本地的maven仓库。以后使用jstorm-core,就不需要再要导入chill-java依赖。

<dependency>
    <groupId>com.twitter</groupId>
    <artifactId>chill-java</artifactId>
    <version>0.9.2</version>
</dependency>
这有个问题。为什么在jstorm中没有依赖这个包。在导入jstorm-core包,要导入chill-java包。在jstorm-core中需要序列化数据实现rpc中数据的传输,反而pom中缺少这个依赖。
阅读更多
文章标签: strom jstrom
个人分类: 大数据
上一篇linux系统activemq启动失败
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭