Re: ClassCastException with inner-class application
Niclas Hedhman <[email protected]> Mon, 1 Dec 2008 08:45:24 +0100
| Newsgroups | gmane.comp.java.sun.rmi |
|---|---|
| Message-ID | <[email protected]> |
Inner classes don't have a default public constructor unless they are static. What you think is a public default constructor in a non-static inner class is behind the scenes in fact a constructor that takes the outer class' instance. I am not sure this is the problem in your case, but that is my initial gut feeling. Cheers Niclas On Tue, Nov 18, 2008 at 4:01 PM, Abdullah Odeh Al-Zaghameem <[email protected]> wrote: > Hi all, > > I'm developing a new distributed model (T-side and B-side) that is using inner- > classes at T-side. When I try to invoke a method of B-side remote instance > (say b.method(innerClassInstance))from within inner-class of T-side, I got > the following Exception: > > -------------------------------------------------------------------- > java.lang.reflect.InvocationTargetException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown > Source) > at java.lang.reflect.Method.invoke(Unknown Source) > ... etc > > Caused By: > java.lang.ClassCastException: cannot assign instance of $Proxy2 to field > allInOnePkg.ChangeTheDecore$_DT__innerInterface.this$0 of type > allInOnePkg.ChangeTheDecore in instance of > allInOnePkg.ChangeTheDecore$_DT__innerInterface > at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues > (Unknown Source) > at java.io.ObjectStreamClass.setObjFieldValues(Unknown Source) > ... 39 more!! > > -------------------------------------------------------------------- > Where: > _DT__innerInterface is the inner class that implements the interface > innerInterface. > > Any suggestions in this regard are highly appreciated. > Thanks in advance. > > =========================================================================== > To unsubscribe, send email to [email protected] and include in the body > of the message "signoff RMI-USERS". For general help, send email to > [email protected] and include in the body of the message "help". > > For a list of frequently asked RMI questions please refer to: > http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html > > To view past RMI-USERS postings, please see: > http://archives.java.sun.com/archives/rmi-users.html > =========================================================================== To unsubscribe, send email to [email protected] and include in the body of the message "signoff RMI-USERS". For general help, send email to [email protected] and include in the body of the message "help". For a list of frequently asked RMI questions please refer to: http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html To view past RMI-USERS postings, please see: http://archives.java.sun.com/archives/rmi-users.html