-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Jonathan,
On 5/20/20 10:55, Jonathan Yom-Tov wrote: > I implemented my own Store which uses Redis to persist sessions > (I'm using Jedis as the interface library). I copied most of the > load()/save() code from FileStore. When my Store loads the session > from Redis I consistently get java.io.StreamCorruptedException: > Inconsistent vector internals. Any ideas on why this might be > happening? Does everything work if you don't have a java.util.Vector in your sessio n? Possibly relevant: https://bugs.openjdk.java.net/browse/JDK-8216331 - -chris > > Here's the relevant code: @Override public Session load(String > sessionId) throws ClassNotFoundException, IOException { > System.out.println("JEDIS load " + sessionId); String key = > getKey(sessionId); byte[] bytes = jedis.get(key.getBytes(UTF8)); > System.out.println("JEDIS loaded " + bytes.length + " bytes"); > > ClassLoader oldThreadContextCL = > manager.getContext().bind(Globals.IS_SECURITY_ENABLED, null); try > (ByteArrayInputStream bis = new ByteArrayInputStream(bytes); > ObjectInputStream ois = new ObjectInputStream(bis)) { > StandardSession session = (StandardSession) > manager.createEmptySession(); session.readObjectData(ois); > session.setManager(manager); > > return session; } catch (Exception e) { > System.err.println(e.getMessage()); e.printStackTrace(); return > null; } finally { > manager.getContext().unbind(Globals.IS_SECURITY_ENABLED, > oldThreadContextCL); } } > > @Override public void save(Session session) throws IOException { > System.out.println("JEDIS save " + session.getId()); String key = > getKey(session.getId()); try (ByteArrayOutputStream bos = new > ByteArrayOutputStream(); ObjectOutputStream oos = new > ObjectOutputStream(bos)) { > ((StandardSession)session).writeObjectData(oos); > jedis.set(key.getBytes(UTF8), bos.toByteArray()); } } > -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl7H6Y0ACgkQHPApP6U8 pFinPxAAitgiD5+T/KfdmKdRuwgUjT+mZi94HaajY9gRmkcFYSvTp3Dp7f1fJIfz nPb/TlzfzCnhqeJLMNcTGB5AH7UG/SrQRftBdb/sTcxW3M4+WNklhfwAw3OrjnQG GbHVF8O38T6dfHhc7WonXY90Cs1qZ0c1jtsQUStPZHdvD7cee3vO69RYyxH8AB1D dc6m5Yp15MdK3l18iCawotvNXqtSHEiWQtArKRh/xWtv/O+0H5EqanzWgKdc0tWf e2UqDL7w+pMuD9gTP5yYtSfaYjXyJoT3Yf9yqfGlaKizvsceTFImU1e4/cj9x1fK 9sds6G0SPRVBcdT2yhzN/qLeXWlcpDh8+TImqtVL1lEJzVXQgol5aWzDJivyLv62 t5Xp+RB9YdA9cbY2OP5lDQI5sD6p7FP1TeZMdsd49ns4TkkTQBffTmX4jwlP0Mrh zJPJg88u1lGsmJ/TRxLPHMgyEDU2VSduYMzcFYiLcYweYfYxlyFhIcZvGxj1+knq dEe3CfYKG1IHBvhcR5maXV7cjUr5bf5dLOWbme+XT+Qd9i2Lnd1p9aVm/lGDieOi C3L67vS+vQ7s1cly96vMMtDjnuPHyKsmBpyMMjGJV3WsYl5nuPxKzyywbKjWHa2l m7ouCRI39pf3zUYbbWs52qEGg2uDjax+BDnvAkj6V+HI7mLdqsQ= =p/9Q -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org