Hi Will, On Sat, May 12, 2012 at 1:26 AM, Will Daniels <[email protected]>wrote:
> Hi, > > 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]. > > yep > 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... > > This issue was reported in: https://issues.apache.org/jira/browse/APLO-203 It's now been fixed in the nightly snapshot. Could verify it's working on there? > 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'); > > msg.appendChild(document.**createTextNode(message)); > log.appendChild(msg); > } > > 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 | > hawtdispatch-DEFAULT-1 > JVM : OpenJDK 64-Bit Server VM 1.6.0_24 (Sun Microsystems Inc.) | > console | hawtdispatch-DEFAULT-1 > Apollo : 1.3 (at: /usr/local/apache-apollo-1.3) | console | > hawtdispatch-DEFAULT-1 > ... > INFO | Accepting connections at: ws://0.0.0.0:61623/ | console | Apollo > Task > ... > WARN | java.lang.NullPointerException | > org.apache.activemq.apollo.**broker.Broker > | hawtdispatch-DEFAULT-2 > DEBUG | java.lang.NullPointerException | > org.apache.activemq.apollo.**broker.Broker > | hawtdispatch-DEFAULT-2 > java.lang.NullPointerException > at org.apache.activemq.apollo.**broker.protocol.** > AnyProtocolCodec$$anonfun$**read$1.apply(AnyProtocol.**scala:115) > at org.apache.activemq.apollo.**broker.protocol.** > AnyProtocolCodec$$anonfun$**read$1.apply(AnyProtocol.**scala:112) > at scala.collection.**IndexedSeqOptimized$class.** > foreach(IndexedSeqOptimized.**scala:34) > at scala.collection.mutable.**ArrayOps.foreach(ArrayOps.**scala:38) > at org.apache.activemq.apollo.**broker.protocol.** > AnyProtocolCodec.read(**AnyProtocol.scala:112) > at org.apache.activemq.apollo.**broker.jetty.** > WebSocketTransportFactory$**WebSocketTransport.drain_**inbound(** > WebSocketTransportFactory.**scala:395) > at org.apache.activemq.apollo.**broker.jetty.** > WebSocketTransportFactory$**WebSocketTransport$$anonfun$** > onMessage$1.apply$mcV$sp(**WebSocketTransportFactory.**scala:326) > at org.fusesource.hawtdispatch.**package$$anon$3.run(** > hawtdispatch.scala:357) > at org.fusesource.hawtdispatch.**internal.SerialDispatchQueue.** > run(SerialDispatchQueue.java:**96) > at org.fusesource.hawtdispatch.**internal.SerialDispatchQueue.** > run(SerialDispatchQueue.java:**96) > at org.fusesource.hawtdispatch.**internal.pool.SimpleThread.** > run(SimpleThread.java:77) > --- > > 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 :( > What error are you getting from the source build? > > Any advice about this issue would be much appreciated! > > Just try the nightly development snapshot. You can find links to it on the download page [1]. It should be much better. [1]: http://activemq.apache.org/apollo/download.html Thanks, > -Will > > > [1] https://github.com/apache/**activemq-apollo/commit/** > 5862484bc44c7f46457cb19cf6638b**fd3584595b<https://github.com/apache/activemq-apollo/commit/5862484bc44c7f46457cb19cf6638bfd3584595b> > [2] https://github.com/chirino/**stomp-websocket/blob/master/** > dist/stomp.js<https://github.com/chirino/stomp-websocket/blob/master/dist/stomp.js> > -- ** *Hiram Chirino* *Software Fellow | FuseSource Corp.* *[email protected] | fusesource.com* *skype: hiramchirino | twitter: @hiramchirino<http://twitter.com/hiramchirino> * *blog: Hiram Chirino's Bit Mojo <http://hiramchirino.com/blog/>* * * * *
