Monajit,

I am glad that you solved your problem.
But please note that using a subject that starts with "SOS!!!............."
is not very polite and certainly does not guarantee a quicker response.

http://www.catb.org/~esr/faqs/smart-questions.html#bespecific

Maarten

On 3/5/07, Monajit Choudhury <[EMAIL PROTECTED]> wrote:
Hi
 I think I found where the problem is. Its not the problem with serialization. 
After going through the codecs of the sumup example I found that the whole 
object is not sent across.Only the primitive types are encoded and passed 
along.Thats the reason when I do a byteBuffer.getObject() I used to get a size 
0 buffer.I modified the codecs in the sumup example to pass the whole object 
and it worked.I mean atleast I stopped getting the error :-).
Regds
Monajit


-----Original Message-----
From: Monajit Choudhury [mailto:[EMAIL PROTECTED]
Sent: Mon 3/5/2007 4:39 PM
To: [email protected]
Subject: RE: SOS!!!.............org.apache.mina.common.BufferDataException: 
Object length should be greater than 4: 0


Thanks for the response Mark. Right now I am not worrying about the latency.But 
what I want to avoid in doing in my proxy is serializing and deserializing. I 
want to do that in a separate thread.The sumup client is using a codec to 
serialize the object and the server deserializes it.The proxy just acts as a 
tunnel.It forwards the resquests to the server without any intervention and 
this model works.Even if I want to add a codec into the proxy, where do I add 
it?

-----Original Message-----
From: Mark Webb [mailto:[EMAIL PROTECTED]
Sent: Mon 3/5/2007 4:08 PM
To: [email protected]
Subject: Re: SOS!!!.............org.apache.mina.common.BufferDataException: 
Object length should be greater than 4: 0

I have not worked much with serialization and mina, but I think you need
that codec to get things working.  My advice would be to get things working,
and then worry about latency/performance.

On 3/5/07, Monajit Choudhury <[EMAIL PROTECTED]> wrote:
>
>
> 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
>
>


--
..Cheers
Mark



Reply via email to