On Wed, 2002-05-15 at 20:06, Simon Stewart wrote: > I have a simple EJB that has three fields ("ID", a "key" and a "value") > Key is a string, and value is given as being of class > java.io.Serializable, so this class represents a basic key/value pair. > Data appears to be serialized to the database okay (Postgres 7.2.1, > column type BYTEA) but as a byte array. (I'll paste it below so someone > can correct me when they want to) > > On deserializing the data, I get ClassCastErrors. The class being > recovered from the DB is "[B" according to the exception being thrown, > and that's just plain wrong. Anyone else seen this or got any ideas? A > > deserializedObject.getClass().getName() > > also returns "[B". More poking about reveals that this is a byte array. > Is it a quirk of my JDBC driver that this happens, or is this something > to do with JBoss' handling of serialzied objects in EJBs? I can post > code, should people need it. > > Currently using Postgres 7.2.1, JDK 1.4 (from Sun), JBoss 3RC2, the > usual suspects :)
I'm starting to suspect that JBoss might be the culprit here. If I manually extract an object from the byte array, it turns out to be a java.rmi.MarshalledObject when the expected class was java.lang.String. Can anyone shed some light on this? I'm using CMP 2, if that helps. Regards, Simon _______________________________________________________________ Have big pipes? SourceForge.net is looking for download mirrors. We supply the hardware. You get the recognition. Email Us: [EMAIL PROTECTED] _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user