cloudfoundry-community / java-nats

NATS Client for Java
Apache License 2.0
51 stars 33 forks source link

Cannot decode vcap.component.discover response #36

Closed alexvasseur closed 8 years ago

alexvasseur commented 8 years ago

request("vcap.component.discover"...)

gives me the error below. Is there some version mismatch with this library and some NATS version or message? (using Pivotal Cloud Foundry 1.7)

2016-08-03 09:37:50.847 TRACE 80908 --- [ntLoopGroup-3-1] nats.codec.ServerFrameDecoder            : Decoding 'INFO {"server_id":"70d82cfbfbe524c30b5985dfb19edf1c","version":"0.5.6","host":"192.168.33.2","port":4222,"auth_required":true,"ssl_required":false,"max_payload":1048576} '
2016-08-03 09:37:50.849 TRACE 80908 --- [ntLoopGroup-3-1] nats.codec.ClientFrameEncoder            : Encoding 'nats.codec.ClientConnectFrame@332e91e1'
2016-08-03 09:37:50.851 DEBUG 80908 --- [ntLoopGroup-3-1] nats.client.NatsImpl                     : Server ready
2016-08-03 09:37:50.851 TRACE 80908 --- [ntLoopGroup-3-1] nats.codec.ClientFrameEncoder            : Encoding 'nats.codec.ClientSubscribeFrame@57d6e5fc'
2016-08-03 09:37:50.851 TRACE 80908 --- [ntLoopGroup-3-1] nats.codec.ClientFrameEncoder            : Encoding 'nats.codec.ClientPublishFrame@6b13ed73'
2016-08-03 09:37:50.861 TRACE 80908 --- [ntLoopGroup-3-1] nats.codec.ServerFrameDecoder            : Decoding 'MSG _INBOX.f0a3a9e29e73eef18cdb2125076a0e 1 198'
2016-08-03 09:37:50.866 ERROR 80908 --- [ntLoopGroup-3-1] nats.client.NatsImpl                     : Error

io.netty.handler.codec.DecoderException: java.lang.UnsupportedOperationException: direct buffer
    at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:422) ~[netty-all-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:248) ~[netty-all-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372) [netty-all-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:358) [netty-all-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:350) [netty-all-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) [netty-all-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:372) [netty-all-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:358) [netty-all-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) [netty-all-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:123) [netty-all-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:571) [netty-all-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:512) [netty-all-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:426) [netty-all-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:398) [netty-all-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:877) [netty-all-4.1.3.Final.jar:4.1.3.Final]
    at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144) [netty-all-4.1.3.Final.jar:4.1.3.Final]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]
Caused by: java.lang.UnsupportedOperationException: direct buffer
    at io.netty.buffer.PooledUnsafeDirectByteBuf.array(PooledUnsafeDirectByteBuf.java:343) ~[netty-all-4.1.3.Final.jar:4.1.3.Final]
    at nats.codec.ServerFrameDecoder.decodeCommand(ServerFrameDecoder.java:66) ~[nats-client-0.6.4.jar:na]
    at nats.codec.ServerFrameDecoder.decodeCommand(ServerFrameDecoder.java:32) ~[nats-client-0.6.4.jar:na]
    at nats.codec.AbstractFrameDecoder.decode(AbstractFrameDecoder.java:53) ~[nats-client-0.6.4.jar:na]
    at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:367) ~[netty-all-4.1.3.Final.jar:4.1.3.Final]
    ... 16 common frames omitted

2016-08-03 09:37:50.866 TRACE 80908 --- [ntLoopGroup-3-1] nats.codec.ServerFrameDecoder            : Decoding ''
2016-08-03 09:37:50.867 ERROR 80908 --- [ntLoopGroup-3-1] nats.client.NatsImpl                     : Error

io.netty.handler.codec.DecoderException: nats.codec.NatsDecodingException: Don't know how to handle the following sent by the Nats server: 
    at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:422) ~[netty-all-4.1.3.Final.jar:4.1.3.Final]
mheath commented 8 years ago

Which version of java-nats are you using? Do you have a different version of Netty in your classpath than what java-nats is expecting?

It shouldn't matter which version of CF you're using since you will only be getting JSON back from NATS.

BTW - I'm not sure if "vcap.component.discover" still does anything useful in PCF 1.7 since Cloud Foundry has been moving away from NATS for years. If you want to monitor the individual components in CF, use the Loggregator Firehose.

alexvasseur commented 8 years ago

0.6.6 works with Spring boot 1.3.6