/** * Use MarshalledValue.Externalizer to serialize. * * @param mv * @return * @throws Exception */ private String serializeObj(MarshalledValue mv) throws Exception { if (externalizer == null) throw new IllegalStateException("Cannot serialize object: undefined marshaller"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); externalizer.writeObject(oos, mv); oos.close(); return Base64.encodeBytes(baos.toByteArray()); }