Up!
I test the same code with Mina 2.0.2 and problem does not occurs.

Is someone can help me please?

Le 04/05/2011 13:03, François Hamard a écrit :
Hello,

I test the new release of mina (2.0.3) and an error occurs on serial transport when I send a message (Encoding). Here is the error:

Exception in thread "Thread-13" java.lang.ClassCastException: com.intesens.communication.messages.network.dongle.outgoing.DetectDongleMessage cannot be cast to org.apache.mina.core.buffer.IoBuffer at org.apache.mina.transport.serial.SerialSessionImpl.flushWrites(SerialSessionImpl.java:178) at org.apache.mina.transport.serial.SerialSessionImpl.access$200(SerialSessionImpl.java:50) at org.apache.mina.transport.serial.SerialSessionImpl$WriteWorker.run(SerialSessionImpl.java:154)

My context is a 3 layer codec:

connector.getFilterChain().addLast(PROTOCOL_NAME_TRANSPORT,
new ProtocolCodecFilter(new TransportProtocolCodecFactory()));
connector.getFilterChain().addLast(PROTOCOL_NAME_INTERMEDIATE,
        new ProtocolCodecFilter(new DongleProtocolCodecFactory()));
connector.getFilterChain().addLast(PROTOCOL_NAME_BUSINESS,
new ProtocolCodecFilter(new BusinessProtocolCodecFactory()));

After some research in code, it appears that when a message is encoded, the first layer to encode is the Business protocol. That's OK. When it write to output, instead of given it to the intermediate layer, it is given to the "Next Layer" which is appears to be nothing because business layer is the last one.

org.apache.mina.filter.codec.AbstractProtocolEncoderOutput.java:56
    messageQueue.offer(encodedMessage);

org.apache.mina.filter.codec.ProtocolCodecFilter:461
nextFilter.filterWrite(session, new EncodedWriteRequest(encodedMessage,
                            future, writeRequest.getDestination()));

Do you know if it's a normal behavior? Do you see what changes could have cause this issue?
Cordialy,
Francois

Reply via email to