clustering error

117 views
Skip to first unread message

Brian Lalor

unread,
Sep 6, 2012, 4:33:46 PM9/6/12
to ve...@googlegroups.com
I've got Vert.x embedded into Jenkins via a custom plugin, with clustering enabled. First I start Jenkins with the plugin and wait for the Hazelcast stuff to settle down. Then I start another JS verticle (code below). When the JS verticle has done its thing, I ^C to kill it, wait for the Hazelcast stuff to settle down again, and then start up the JS verticle again. This time the embedded Vert.x instance throws an exception when performing an EventBus.publish(), complaining that the class "org.vertx.java.core.eventbus.impl.hazelcast.HazelcastServerID" cannot be found.

Any thoughts?

JavaScript code:
load('vertx.js');

function hndl1(msg) {
console.log("jenkins-vertx -- " + JSON.stringify(msg));
}

function hndl2(msg) {
console.log("jenkins.item -- " + JSON.stringify(msg));
}

function hndl3(msg) {
console.log("jenkins.run -- " + JSON.stringify(msg));
}

var hndl1_id = vertx.eventBus.registerHandler("jenkins-vertx", hndl1);
var hndl2_id = vertx.eventBus.registerHandler("jenkins.item", hndl2);
var hndl3_id = vertx.eventBus.registerHandler("jenkins.run", hndl3);

function vertxStop() {
console.log("stopping");

vertx.eventBus.unregisterHandler(hndl1_id, hndl1);
vertx.eventBus.unregisterHandler(hndl2_id, hndl2);
vertx.eventBus.unregisterHandler(hndl3_id, hndl3);
}

console.log("ready");

vertx.eventBus.send(
"jenkins",
{
"action": "scheduleBuild",
"data": {
"projectName": "parameterized",
"params": {
"key":"vert.x value",
"foo":"bar"
}
}
},
function(r) {
console.log(JSON.stringify(r));
}
);



Stack trace from embedded instance:
com.hazelcast.nio.HazelcastSerializationException: Problem when serializing type 0
at com.hazelcast.nio.AbstractSerializer.toObject(AbstractSerializer.java:121)
at com.hazelcast.nio.AbstractSerializer.toObject(AbstractSerializer.java:148)
at com.hazelcast.nio.Serializer.readObject(Serializer.java:71)
at com.hazelcast.impl.ThreadContext.toObject(ThreadContext.java:130)
at com.hazelcast.nio.IOUtil.toObject(IOUtil.java:160)
at com.hazelcast.impl.base.Values$ValueIterator.next(Values.java:102)
at org.vertx.java.core.eventbus.impl.hazelcast.HazelcastSubsMap$3.handle(HazelcastSubsMap.java:102)
at org.vertx.java.core.eventbus.impl.hazelcast.HazelcastSubsMap$3.handle(HazelcastSubsMap.java:94)
at org.vertx.java.core.impl.BlockingAction$1$1.run(BlockingAction.java:60)
at org.vertx.java.core.impl.Context$2.run(Context.java:118)
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.processEventQueue(AbstractNioWorker.java:361)
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:245)
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35)
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)
at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.io.IOException: Problem reading DataSerializable class : org.vertx.java.core.eventbus.impl.hazelcast.HazelcastServerID, exception: java.lang.ClassNotFoundException: org.vertx.java.core.eventbus.impl.hazelcast.HazelcastServerID
at com.hazelcast.nio.Serializer$DataSerializer.read(Serializer.java:107)
at com.hazelcast.nio.Serializer$DataSerializer.read(Serializer.java:79)
at com.hazelcast.nio.AbstractSerializer.toObject(AbstractSerializer.java:119)
... 17 more

Brian Lalor

unread,
Sep 6, 2012, 6:18:45 PM9/6/12
to ve...@googlegroups.com
On Sep 6, 2012, at 2:33 PM, Brian Lalor <bla...@bravo5.org> wrote:

> This time the embedded Vert.x instance throws an exception when performing an EventBus.publish(), complaining that the class "org.vertx.java.core.eventbus.impl.hazelcast.HazelcastServerID" cannot be found.

It appears I had a class loader conflict with Jenkins. I made a wrapper method for the EventBus publish method which seems to have helped:

static void ebPublish(final String addr, final JsonObject obj) {
ClassLoader oldContextClassLoader =
Thread.currentThread().getContextClassLoader();

Thread.currentThread().setContextClassLoader(PluginImpl.class.getClassLoader());

try {
getVertx().eventBus().publish(addr, obj);
} finally {
Thread.currentThread().setContextClassLoader(oldContextClassLoader);
}

}

Reply all
Reply to author
Forward
0 new messages