[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A couple of newbie questons



On Monday, April 9, 2001, at 12:23 AM, Gerd Mueller wrote:

1) What techniques can you share for debugging? I am getting
InstantiationExceptions when I try to create instances of certain
classes. In one case the problem went away - at the time I thought I had
been using OPP incorrectly but nothing seems to help this time. In the
following case, I recompiled the entire project and ran OPP on all my
*Impl classes. OPP reported no errors. I succeed in creating one object,
but when that object tries to create another one it fails.

Did you provide a default contructor for you database object ? Did you
provide any contructors ?

Yes, I have provided a default constructor with no arguments. I have simplified that constructor to the point where it does nothing, yet still I get the Exception. I'm sure I'll figure it out, but I was hoping for techniques.

My second question concerns the ability to modify classes that already
have instances in the database. I added a method to the interface of one
of my classes and thereafter got errors whenever trying to create a new
object of that type. The stack trace indicated that the UserBaseImpl
instance could not be serialized due to a version mismatch. I was a
little surprised to see that the UserBaseImpl was being serialized at
all - I thought *Impl instances stayed in the database process.

I don't have the stack trace for this one, and now cant even remember
the exact error, but it mentioned that the serial numbers of the classes
did not match.

Since ozone uses the Java serialization to store the objects you
need to be aware to provide a 'final static long serialVersionUID'
member. Please, read the Java documentation about this topic.

In the immortal words of Homer Simpson - "Doh!"

I saw that in the example code, along with explanation, but it didn't sink in. I guess my mental model of ozone didn't have Impl instances being serialized so I was not prepared for errors like that.

Thanks for your prompt and even helpful help.

Jerry Seeger