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

Re: ClassCastException



On Wed, 30 Aug 2000, Lars Steiger wrote:
> > I tried to test this by changing org.ozoneDB.test.simpleAutoImpl to:
> >
> > public class AutoImpl extends OzoneObject implements Auto {
> >
> >    Auto         link;
> >    ...
> >
> >    public Auto doSomthing (Auto auto) throws Exception {
> >       String linkName = link.name();
> >       System.out.println ("doSomething(): linkName=" + linkName);
> >       return link;
> >       }
> >    ...
> > }
> >
> > doSomthing() now does the same as CommisionImpl.getNumber(). Right?
> >
> 
> yes, that's right ...
> 
> >
> > But calling doSomething() in my test case returns exactly the expected results
> > - no exceptions.
> >
> > The result field is a _local_ variable of all proxy methods. OPP produces the
> > following code for the doSomething() method of the proxy:
> >
> > public org.ozoneDB.test.simple.Auto doSomthing (org.ozoneDB.test.simple.Auto
> >              arg0) throws java.lang.Exception {
> >
> >       try {
> >          Object target = link.fetch (this, Lock.LEVEL_READ);
> >          if (target != null) {
> >             arg0 = (org.ozoneDB.test.simple.Auto)ResultConverter.substituteOzoneCompatibles (arg0);
> >             return (org.ozoneDB.test.simple.Auto)ResultConverter.substituteOzoneCompatibles (((org.ozoneDB.test.simple.AutoImpl)target).doSomthing(arg0));
> >             }
> >          else {
> >             Object[] args = {arg0};
> >             Object result = link.invoke (this, 4, args, Lock.LEVEL_READ);
> >             return (org.ozoneDB.test.simple.Auto)result;
> >             }
> >          }
> >       catch (java.lang.Exception e) {
> >          e.fillInStackTrace();
> >          throw e;
> >          }
> >       }
> >
> > So, subsequent calls fo the same or different methods of the proxy cannot
> > affect each other.
> >
> > Are you on windows? If yes, can you test on Linux?
> 
> no, i have only a windows box ...
> 
> but on the basis of your response i tested it with references to a number of other ozone objects ... sometimes the expected result will be returned sometimes
> not ... 
Hmmm... maybe the problem is caused by outdated proxy classes. This is a very
common problem. We see this because proxies identify the method, that should
be called on the target, via an int index. This index is build on compile time.
If the target class is changed without rebuilding the proxies, then the mapping
between proxy and target methods is broken, which results in such strange
behaviour.

In the "XML Query - Frustration" thread Saravanan Bellan reported similar
problems when storing XML in ozone. A clean rebuild solved his problem.

> i will check the differences and if i get some news you will hear it ...
Thanks.


Falko
-- 
______________________________________________________________________
Falko Braeutigam                              mailto:falko@smb-tec.com
SMB GmbH                                        http://www.smb-tec.com