org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil

Simon Stewart wrote:

> Standard JDK classes: java.lang.String, java.net.URL and
> java.util.Date.
> 
> It seems as if the code is not going through the steps necessary to
> unmarshal (?) the Object before returning it. From your description,
> it sounds as if some "instanceof" testing is done before the class is
> returned. I would hazard a guess that a test to see whether the result
> is of type "byte[]" doesn't then go on to check whether this is a
> MarshalledObject?
> 
> Out of curiousity whereabouts is the code?  I can download the latest
> CVS code and have a look at it given enough time.
> 
> Also, looking at the interface I gave below, there is a slight error:
> I used Serializable rather than Object to ensure that data _could_ be
> stored in the database in the first place.
> 
> Thanks for looking into this.
> 
> Regards,
> 
> Simon
> 
> On Thu, May 16, 2002 at 09:31:45AM -0500, Dan Christopherson wrote:
> 
>>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....
>>>
> 



_______________________________________________________________

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

Reply via email to