On 11/25/11 7:40 AM, Cesar Barria wrote:
I'm new to MINA and have been working on a small project for a few weeks now. 
My application is fairly simple… I'm sending commands to a server via POJO 
messages. In some cases the server or the client will send a file instead of a 
POJO. I'm using the StreamWriteFilter and the ObjectSerializationCodec 
ProtocolCodecFilter. I can send objects back and forth fairly successfully, but 
I can't send large files and sometimes even small files fail to be sent.

Here is the exception I get when sending files:

00:46:09] pool-4-thread-4 WARN  [] [] [client.ClientIoSessionHandler] - 
Exception: class org.apache.mina.filter.codec.ProtocolDecoderException State: 
RECV_FILE_WAIT
[00:46:09] pool-4-thread-4 ERROR  [] [] [client.ClientIoSessionHandler] - 
Throwable:
org.apache.mina.filter.codec.ProtocolDecoderException: 
org.apache.mina.core.buffer.BufferDataException: dataLength: 1347093252


Any ideas why am I getting this exception? How should I go about having the 
ObjectSerializationCodec handle the POJOs while StreamWriteFilter  handles the 
files?

Hi,

I haven't spent too much time analyzing the detail of your code, but I'm wondering if there isn't a difference in the encoder and decoder, when it comes to deal with files being sent : to me, it seems that the decoder is expecting the received message to be a serialized object, even if it's a file, and try to decode the first 4 bytes of the incoming message (which are containing the size of the transmitted object).

You should probably add some information in your sent messages to tell the decoder that it has to deal with a serialized object *or* a file.


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Reply via email to