You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Lorenzo <ce...@gmail.com> on 2007/04/19 13:31:01 UTC
Save MessageContext and java.io.NotSerializableException
Hi all,
i have to store messagecontexts. I check Sandesha2 source to see how it
do it and i try to do as follow:
public String save(String key, MessageContext messageContext){
if(key==null)
key = SandeshaUtil.getUUID();
try {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
removeMustUnderstand(messageContext.getEnvelope());
ObjectOutputStream s = new ObjectOutputStream(stream);
s.writeObject(messageContext);
s.close();
File file = new File("/home/test/msgCtx."+key);
FileOutputStream fileOutputStream = new FileOutputStream(file);
fileOutputStream.write(stream.toByteArray());
fileOutputStream.flush();
fileOutputStream.close();
}
catch(Exception e) {
log.error(e.toString());
}
return key;
}
but when it try to do s.writeObject(messageContext) it throws a
java.io.NotSerializableException:org.apache.axis2.context.MessageContext
any suggestion?
thx,
Lorenzo
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: Save MessageContext and java.io.NotSerializableException
Posted by Lorenzo <ce...@gmail.com>.
Ops... i can serialize OperationContext...
^_^
On gio, 2007-04-19 at 13:31 +0200, Lorenzo wrote:
> Hi all,
>
> i have to store messagecontexts. I check Sandesha2 source to see how it
> do it and i try to do as follow:
>
> public String save(String key, MessageContext messageContext){
> if(key==null)
> key = SandeshaUtil.getUUID();
> try {
> ByteArrayOutputStream stream = new ByteArrayOutputStream();
> removeMustUnderstand(messageContext.getEnvelope());
> ObjectOutputStream s = new ObjectOutputStream(stream);
> s.writeObject(messageContext);
> s.close();
>
> File file = new File("/home/test/msgCtx."+key);
> FileOutputStream fileOutputStream = new FileOutputStream(file);
> fileOutputStream.write(stream.toByteArray());
> fileOutputStream.flush();
> fileOutputStream.close();
> }
> catch(Exception e) {
> log.error(e.toString());
> }
> return key;
> }
>
> but when it try to do s.writeObject(messageContext) it throws a
> java.io.NotSerializableException:org.apache.axis2.context.MessageContext
>
> any suggestion?
>
> thx,
> Lorenzo
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org