org.jboss.system
Class JBossRMIClassLoader

java.lang.Object
  extended byjava.rmi.server.RMIClassLoaderSpi
      extended byorg.jboss.system.JBossRMIClassLoader

public class JBossRMIClassLoader
extends java.rmi.server.RMIClassLoaderSpi

An implementation of RMIClassLoaderSpi to workaround the proxy ClassCastException problem in 1.4

THIS IS A HACK!

Sun's implementation uses the caller classloader when unmarshalling proxies. This is effectively jboss.jar since that is where JRMPInvokerProxy lives. On a redeploy the new interfaces are ignored because a proxy is already cached against the classloader.

Another redeployment problem is that the getClassAnnotation(String) will end up using the old deployment class loader and this can result in NPEs do the class loader being destroyed. This class ignores Sun's guess at a suitable classloader and uses the thread context classloader instead.

It has to exist in the system classloader so I have included it in "system" for inclusion in run.jar


Constructor Summary
JBossRMIClassLoader()
          Required constructor
 
Method Summary
 java.lang.String getClassAnnotation(java.lang.Class cl)
          Try to delegate an default to the java.rmi.server.codebase on any failure.
 java.lang.ClassLoader getClassLoader(java.lang.String codebase)
          Just delegate
 java.lang.Class loadClass(java.lang.String codebase, java.lang.String name, java.lang.ClassLoader ignored)
          Just delegate
 java.lang.Class loadProxyClass(java.lang.String codebase, java.lang.String[] interfaces, java.lang.ClassLoader ignored)
          Ignore the JVM, use the thread context classloader for proxy caching
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JBossRMIClassLoader

public JBossRMIClassLoader()
Required constructor

Method Detail

loadProxyClass

public java.lang.Class loadProxyClass(java.lang.String codebase,
                                      java.lang.String[] interfaces,
                                      java.lang.ClassLoader ignored)
                               throws java.net.MalformedURLException,
                                      java.lang.ClassNotFoundException
Ignore the JVM, use the thread context classloader for proxy caching

Throws:
java.net.MalformedURLException
java.lang.ClassNotFoundException

loadClass

public java.lang.Class loadClass(java.lang.String codebase,
                                 java.lang.String name,
                                 java.lang.ClassLoader ignored)
                          throws java.net.MalformedURLException,
                                 java.lang.ClassNotFoundException
Just delegate

Throws:
java.net.MalformedURLException
java.lang.ClassNotFoundException

getClassLoader

public java.lang.ClassLoader getClassLoader(java.lang.String codebase)
                                     throws java.net.MalformedURLException
Just delegate

Throws:
java.net.MalformedURLException

getClassAnnotation

public java.lang.String getClassAnnotation(java.lang.Class cl)
Try to delegate an default to the java.rmi.server.codebase on any failure.