Anyone experience issues serializing SimpleSession ? 
The following works for String but fails for SimpleSession. The reason I am
converting to bytes is to use ZooKeeper for clustering, but I can't get over
not being able to rehydrate a SimpleSession.
private byte[] toBytes(Object value) {
                try {
                        ByteArrayOutputStream baos = new 
ByteArrayOutputStream() ;
                        ObjectOutputStream oos = new ObjectOutputStream(baos);
                    oos.writeObject(value);
                    oos.flush();
                    oos.close();
                    // Get the bytes of the serialized object
                    byte[] buf  = baos.toByteArray();
                    return buf;
                } catch (IOException io) {
                        throw new CacheException(io);
                }
        }
        
        //@SuppressWarnings("unchecked")
        private Object fromBytes(byte[] bytes) {
                try {
                        ObjectInputStream ois = new ObjectInputStream(new
ByteArrayInputStream(bytes));
                        Object value =  ois.readObject();
                    ois.close();
                    return value;
                } catch (ClassNotFoundException e) {
                        throw new CacheException(e);
                } catch (IOException e) {
                        throw new CacheException(e);
                } catch (ClassCastException e) {
                        throw new CacheException(e);
                }
        }
-- 
View this message in context: 
http://shiro-user.582556.n2.nabble.com/serialization-problem-with-SimpleSession-tp5537015p5537015.html
Sent from the Shiro User mailing list archive at Nabble.com.

Reply via email to