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

A couple of newbie questons



I have been working with ozone in my spare moments and I have a couple of questions that should help me on the uptake.

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.

At first I thought the problem might be that I had a constructor that took 3 arguments, but I modified the code and it did not help.

I am interested in solving this particular problem, but even more interested in general techniques for resolving issues like this one.

Here is the code snippet:
String userClassName = DBUserImpl.class.getName();
try
{
DBUser newUser = (DBUser)database().createObject(userClassName);
newUser.initialize(user);


Stack trace on the server is as follows:

[warn] (666) Transaction: createObject()
java.lang.InstantiationException: com.JerSoft.buddy.server.DBUserImpl
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:237)
at org.ozoneDB.core.AbstractObjectContainer.createTarget(AbstractObjectContainer.java:227)
at org.ozoneDB.core.Transaction.createObject(Transaction.java:395)
at org.ozoneDB.Database.createObject(Database.java:90)
at org.ozoneDB.Database.createObject(Database.java:73)
at com.JerSoft.buddy.server.UserBaseImpl.addUser(UserBaseImpl.java:32)
at java.lang.reflect.Method.invoke(Native Method)
at org.ozoneDB.core.AbstractObjectContainer.invokeTarget(AbstractObjectContainer.java:212)
at org.ozoneDB.core.Transaction.invokeObject(Transaction.java:512)
at org.ozoneDB.core.DbRemote.DbInvoke.perform(DbInvoke.java:62)
at org.ozoneDB.core.Transaction.performCommand(Transaction.java:273)
at org.ozoneDB.core.TransactionManager.performCommand(TransactionManager.java:366)
at org.ozoneDB.core.TransactionManager.completeTransaction(TransactionManager.java:334)
at org.ozoneDB.core.TransactionManager.handleCommand(TransactionManager.java:249)
at org.ozoneDB.core.InvokeServer.handleClientEvent(InvokeServer.java:76)
at org.ozoneDB.DxLib.net.DxMultiServerClient.run(DxMultiServerClient.java:44)
at java.lang.Thread.run(Thread.java:496)


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.

I made sure that there were no other copies of the classes anywhere on my machine, restarted the server, and even restarted the machine. My only solution was to ditch the database and create a new one. Once I created a new database I created new instances of the class just fine. My assumption is that the problem arose from the difference between classes previously stored in the database and the new classes. How do I make a change to a class without having to worry about moving all my data from an old version?

Jerry Seeger