#13 RMIIO not usabel with hierarchical classloaders

rmiio-2.0.4
closed
nobody
None
1
2013-09-23
2013-09-18
Anonymous
No

I am developing a Netbeans RCP application with J2EE backend (Glassfish). On the server and the client side I had the problem that I must use a custom RemoteStreamExporter class. This class is rather easy to write but all calls are throwing a ClassNotFoundException.

Therefore I checked out the source code and saw that the responsible class is using the method forName() without any parameter. This is problematic if more than one classloader is used because it does not search in the actual classloader for the object, instat it searches in the root class loader for the object. This issue is present in Glassfish, Netbeans RCP, Eclipse RCP and maybe in JBoss 7 as well.

Here are the changes (if you advice me I can check in the changed file) in
RemoteStreamExporter:
try {
_INSTANCE = (RemoteStreamExporter)
Class.forName(exporterClassName, true,
Thread.currentThread().getContextClassLoader()).newInstance();
} catch (Exception e) {
throw new IllegalArgumentException(
"could not instantiate exporter " +
exporterClassName, e);
}

Hopefully it helps anybody to use RMIIO with one of the mentioned applications

Discussion

  • James Ahlborn
    James Ahlborn
    2013-09-20

    yep, this is a reasonable fix, i'll try to integrate that soon.

     
  • James Ahlborn
    James Ahlborn
    2013-09-23

    • Group: Unassigned --> rmiio-2.0.4
     
  • James Ahlborn
    James Ahlborn
    2013-09-23

    • status: open --> closed
     
  • James Ahlborn
    James Ahlborn
    2013-09-23

    this will be in the 2.0.4 release.

     


Anonymous


Cancel   Add attachments