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

Please help: InvalidClassException


While using Ozone DB in a client-server environment powering a Tomcat servlet 
engine, I often stop and start the servlet engine together with the Ozone DB 
server. A SiteManagerImpl class accesses some Ozone objects when starting up 
the system. This works fine for the first time, when the database is empty. 
After the first run, the database is filled with objects. These objects 
should be available for reading at the next time. When I subsequently 
shutdown the system, compile, and start again, the Ozone server sometimes 
denies reading the objects from the database - and sometimes not. 

In WizardObjectContainer, the following method sometimes throws an 
InvalidClassException while the system is restarting:

-------- code snippet from WizardObjectContainer.java ---------
    public final void readExternal( ObjectInput in ) throws IOException, 
ClassNotFoundException {
        // System.out.println ("container.readExternal()...");
        byte streamVersion = in.readByte();
        target = (OzoneCompatible)in.readObject();
              >>>>>this line throws the exception<<<<<<

        if (target != null) {
            target.setContainer( this );
        // objID = (ObjectID)in.readObject();
        objID = new ObjectID( in.readLong() );
        name = null;
        if (in.readByte() != 0) {
            name = in.readUTF();
        state = (int)in.readByte();
---------------- end of code snippet -------------

Here is the stack trace of the exception:

-------- snip ---------
[warn] (903) Transaction: objectForName()
    java.io.InvalidClassException: com.sevenval.fit.contract.ozone.OzoneSi
            teManagerImpl; Local class not compatible: stream classdesc 
            ionUID=-4269804347343892228 local class 
        at java.io.ObjectStreamClass.validateLocalClass(ObjectStreamClass.jav
        at java.io.ObjectStreamClass.setClass(ObjectStreamClass.java:567)
        at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.j
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
        at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
        at org.ozoneDB.core.wizardStore.WizardObjectContainer.readExternal(Wi
        at org.ozoneDB.core.wizardStore.Cluster.readExternal(Cluster.java:340
        at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1212)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
        at org.ozoneDB.core.wizardStore.ClusterStore.loadData(ClusterStore.ja
        at org.ozoneDB.core.wizardStore.ClusterStore.loadCluster(ClusterStore
        at org.ozoneDB.core.wizardStore.WizardStore.containerForID(WizardStor
        at org.ozoneDB.core.wizardStore.WizardStore.containerForName(WizardSt
        at org.ozoneDB.core.Transaction.objectForName(Transaction.java:575)
        at org.ozoneDB.core.DbRemote.DbObjForName.perform(DbObjForName.java:3
        at org.ozoneDB.core.Transaction.performCommand(Transaction.java:273)
        at org.ozoneDB.core.TransactionManager.performCommand(TransactionMana
        at org.ozoneDB.core.TransactionManager.completeTransaction(Transactio
        at org.ozoneDB.core.TransactionManager.handleCommand(TransactionManag
        at org.ozoneDB.core.InvokeServer.handleClientEvent(InvokeServer.java:
        at org.ozoneDB.DxLib.net.DxMultiServerClient.run(DxMultiServerClient.
        at java.lang.Thread.run(Thread.java:484)
-------   snip ----------

The only workaround I know is to re-initialize the whole database, deleting 
all data. This is surely not desirable at all.

Please explain to me how I can get out of this situation, or how I can fix 
this. Maybe it's an Ozone bug, or an odd Java feature of de-serializing 
classes. I suppose the serialization class ID mismatch comes from proxy 
communication with the Ozone server, which might expect identical objects, 
but this identity is destroyed between compile/build cycles. I don't 
understand the Ozone implementation completely, so I'm not able to improve 
the readExternal() method in WizardObjectContainer. However, the class ID 
mismatch between different Ozone runs is strange and should not happen.

The software I'm using:

- Linux 2.2.16
- Sun Java JDK 1.3.0
- OzoneDB 0.6 (same WizardObjectContainer code also present in 1.0.1)

The Ozone 0.6 source code is included into the build system, and Ozone proxy 
code for SiteManagerImpl is auto-generated by Ant each turn-around 


Jörg Prante
Sevenval AG (HRB 32757) e-business marketing technologies
D-50667 Köln . Alter Markt 36-42
Fon +49 221 65 00 70 . Fax +49 221 42 49 891 . Mobile +49 175 466 19 18
http://www.sevenval.de . joerg@7val.com