I do remember looking at this code in JAWS and saying to myself 'I don't see how that can work, but nobody's complaining, so I'll leave it be.' Simon, I take it you're getting this problem with non-jdk classes? There may be some crufty instanceof testing in there.
-danch Simon Stewart wrote: > On Wed, May 15, 2002 at 10:48:48PM -0500, Dain Sundstrom wrote: > >>>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. >>> >>JBossCMP stores objects in serialized form using a MarshalledObject. I >>copied this code from JAWS, so I am not sure of the reasons. I think it >>has something to do with portability of stored objects, but the real >>reason is it works. >> > > Agreed, storing Objects as MarshalledObjects is the Right Way to store > things into the database so that they can be recovered, but that > doesn't explain why when I store an Object via CMP, a byte array is > returned on subsequent get()s. I can convert the byte array into an > ObjectInputStream, pull out the MarshalledObject and then do a get() > on that to restore the object, but that shouldn't be necessary. > > For an interface like this: > > public void setObject( String key, Object value ); > public Object getObject( key ); > > and then attempt to use it: > > SomeEJB.setObject( "key", new URL( "http://www.foo.com" ) ); > URL url = (URL) SomeEJB.getObject( "key" ); > > I should _not_ be getting a ClassCastException (from memory: this > happened last night, and I've kludged a work-around using Strings) > when I call get(), but that's exactly what happens! > > I can extract the necessary bits from my code and send it to you as a > simple test case if that would help.... > > Regards, > > Simon > > -- ========================================================================= Disclaimer: All statements are my own, personal opinions and have nothing to do with the opinions of employer, wife, or cat. They may not have anything to do with objective reality, as a matter of fact. Your Milage May Vary, Excludes Delivery Charges, etc. ========================================================================= _______________________________________________________________ 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