Not within the proxy. I am using the example proxy as is. We plan to use this proxy in the production system(after modifying it to handle large amount of traffic), so I wanted to keep the latency to a minimum.I dump the whole byteBuffer in an async queue.Another thread goes thru the queue and deserializes the objects,and this is where it fails.
Regds Monajit -----Original Message----- From: Mark Webb [mailto:[EMAIL PROTECTED] Sent: Mon 3/5/2007 3:52 PM To: [email protected] Subject: Re: SOS!!!.............org.apache.mina.common.BufferDataException: Object length should be greater than 4: 0 Are you using a serialization codec ? On 3/5/07, Monajit Choudhury <[EMAIL PROTECTED]> wrote: > Hi Mark > Thanks a lot for your response. Still I am getting the same error.Hereis > what I am doing now. > > public void onMessage(Message message) { > // TODO we do the processing here. It might be the we link the request recording stuffs here > MessageObject bb = (MessageObject)message.getMessageContent(); > SimpleProtocolDecoderOutput pd = new SimpleProtocolDecoderOutput( bb.getSession(),null); > > try { > new ObjectSerializationCodecFactory().getDecoder().decode(bb.getSession(), bb.getByteBuffer(), pd); > } catch (Exception e2) { > // TODO Auto-generated catch block > e2.printStackTrace(); > } > pd.flush(); > } > > The Message object wraps the ByteBuffer object within itself.The size of the stream is 0 and I think this is the problem. The client is able to receive the correct responses from the server via the proxy.This means the communication stream is working fine. I think I am not tapping the right stream.Any thoughts? > > Regds > Monajit > > > -----Original Message----- > From: Mark Webb [mailto:[EMAIL PROTECTED] > Sent: Mon 3/5/2007 2:41 PM > To: [email protected] > Subject: Re: SOS!!!.............org.apache.mina.common.BufferDataException: Object length should be greater than 4: 0 > > Try this... > > http://www.nabble.com/RE%3A-ObjectSerialization-problem-p7830060.html > > > On 3/5/07, Monajit Choudhury <[EMAIL PROTECTED]> wrote: > > > > Hi > > I am trying to mix the proxy example with the sumup example.So all client > > requests in the in the sumup example goes via this proxy.In the proxy I > > have a async queuing mechanism by which I dump the requests in a queue and > > desirialize it in a separate thread.Now here is the problem... > > This is the method in AbstractProxyIoHandler. > > public void messageReceived( IoSession session, Object message ) throws > > Exception > > { > > > > ByteBuffer rb = ( ByteBuffer ) message; > > ByteBuffer wb = ByteBuffer.allocate( rb.remaining() ); > > rb.mark(); > > wb.put( rb ); > > wb.flip(); > > ServiceContext ctx = ServiceContext.getContext(); > > Queue queue1 = (Queue) ctx.lookup("QM1.RecordingQ"); > > Message msg = new MessageImpl(wb); > > queue1.pushIntoQueue(msg); > > ( ( IoSession ) session.getAttachment() ).write( wb ); > > rb.reset(); > > SessionLog.info( session, rb.getString( CHARSET.newDecoder() ) ); > > } > > > > Now when i deque the object and do a wb.getObject(), i get the following > > exception. > > org.apache.mina.common.BufferDataException: Object length should be > > greater than 4: 0 > > > > Instead of this, the client gets the response properly.I think the proxy > > example was written to work with strings only. WHat changes do I need to > > make in the proxy to make it work with Objects?Please HELP!!!! > > > > > > Regds > > Monajit > > > > > > -- > ..Cheers > Mark > > -- ..Cheers Mark
