Re: Eclipse RCP Client via RMI over HTTP to a JBoss AS. ClassCastException

Gregg Wonderly <[email protected]> Fri, 27 Jan 2006 10:01:03 -0600
Newsgroups gmane.comp.java.sun.rmi
Message-ID <[email protected]>
rhuguet (sent by Nabble.com) wrote:
> Hi there
> I have problems to connect with an Eclipse RCP Client via RMI over HTTP to a JBoss AS.
>
> To avoid security problems i wrote a SecurityManager which allows everything:

It's also possible to just specify the use of a security policy file that has

grant {
        permission java.security.AllPermission;
};

in it instead.  That way, you can assert permissions when needed, without having
to remember that you are ignoring them in your security manager.  Hopefully
you're not doing this on a public network where a quick port scan might reveal
you.  Remember that people can send arbitrary objects into RMI and run code
locally by exploiting the deserialization mechanism which runs code before
security checks are made.  As a quick note, the JERI protocol stack (really
should be called RMI 2.0) in Jini 2.0 and later provide a mechanism for
performing permission checks based on the use of kerberos/x.5XX before
deserialization.

> What could be the problem, do You have any idea
> Best Regards and thanks in advance

It looks like you have a classloader conflict.  It appears that you are defining
the interface/class in both the downloaded jar and in the application.  The
downloaded jar should not carry the interface/class with it.

In Jini 2.0 and later there is a PreferredClassLoader mechanism utilized.  This
allows the jar file to carry the interface/class, but to not prefer it.  The
PreferredClassLoader will look inside the jar for the list of preferred
classes/packages, and always defer to the parent class loader when not preferred.

Print out the classloader tree for the two classes and see if they have a common
root classloader where the interface/class is defined.  If not, then this is
where the class cast exception is comming from.

Gregg Wonderly

===========================================================================
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