activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Will Daniels <>
Subject Null pointer exception in AnyProtocolCodec using WebSockets
Date Sat, 12 May 2012 05:26:19 GMT

I'm having problems using WebSockets with Apollo 1.3. I get a null pointer 
exception in AnyProtocol.scala at line 115 which looks like it might be caused 
by changes in 1.3 to do with buffer initialisation (git 5862484)[1].

Yet it seems like a big thing to break and I couldn't see any mention of this in 
the issue tracker or elsewhere, so I thought I should ask here in case I just 
missed something or the error looks like a problem with the way I'm using it...

I created a completely default broker instance and wrote some stuff in Python, 
then PHP to test it and all was seeming to work fine. I then took the modified 
stomp-websocket script (for binary packets) from chirino's fork at github[2] and 
wrote some simple javascript to test the websockets:

function logMessage(message)
	var log = document.getElementById('log');
	var msg = document.createElement('pre');


function startLog()
	var url = 'ws://localhost:61623/';

	logMessage('About to create STOMP client object...');
	var client = Stomp.client(url);

	client.debug = logMessage;

	client.connect('admin', 'password', function () {
		logMessage('Connected to local STOMP server (via WebSockets)');
		client.subscribe('/topic/test', function (frame) { logMessage(frame.body); });

This works as expected with 1.2 but with 1.3 it never gets the callback from 
client.connect, and I see the following in the Apollo log after setting debug 
log level for apollo-broker:

OS     : Linux 3.2.0-24-generic (Ubuntu 12.04 LTS) | console | 
JVM    : OpenJDK 64-Bit Server VM 1.6.0_24 (Sun Microsystems Inc.) | console | 
Apollo : 1.3 (at: /usr/local/apache-apollo-1.3) | console | hawtdispatch-DEFAULT-1
INFO  | Accepting connections at: ws:// | console | Apollo Task
WARN  | java.lang.NullPointerException | | hawtdispatch-DEFAULT-2
DEBUG | java.lang.NullPointerException | | hawtdispatch-DEFAULT-2
	at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:34)
	at scala.collection.mutable.ArrayOps.foreach(ArrayOps.scala:38)
	at org.fusesource.hawtdispatch.package$$anon$

I'm thinking whatever changes were made to determine the buffer sizes maybe did 
not account for WebSockets protocol? But both STOMP and WebSockets are 
completely new to me (as is Scala, Maven and even Java since the last 10 years) 
so I'm a bit out of my depth trying to understand it all at once to be sure it's 
not something I've done wrong, much less try to fix this myself. I haven't even 
managed to get Apollo to build from source yet... one problem after another with 
it :(

Any advice about this issue would be much appreciated!



View raw message