java.rmi.server
Class RMIClassLoader

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.rmi.server.RMIClassLoader

public class RMIClassLoader
extends Object sample code for java.lang.Object definition code for java.lang.Object

RMIClassLoader comprises static methods to support dynamic class loading with RMI. Included are methods for loading classes from a network location (one or more URLs) and obtaining the location from which an existing class should be loaded by remote parties. These methods are used by the RMI runtime when marshalling and unmarshalling classes contained in the arguments and return values of remote method calls, and they also may be invoked directly by applications in order to mimic RMI's dynamic class loading behavior.

The implementation of the following static methods

is provided by an instance of RMIClassLoaderSpi sample code for java.rmi.server.RMIClassLoaderSpi definition code for java.rmi.server.RMIClassLoaderSpi , the service provider interface for those methods. When one of the methods is invoked, its behavior is to delegate to a corresponding method on the service provider instance. The details of how each method delegates to the provider instance is described in the documentation for each particular method.

The service provider instance is chosen as follows:

Since:
JDK1.1
See Also:
RMIClassLoaderSpi sample code for java.rmi.server.RMIClassLoaderSpi definition code for java.rmi.server.RMIClassLoaderSpi

Method Summary
static String sample code for java.lang.String definition code for java.lang.String getClassAnnotation sample code for java.rmi.server.RMIClassLoader.getClassAnnotation(java.lang.Class) definition code for java.rmi.server.RMIClassLoader.getClassAnnotation(java.lang.Class) (Class sample code for java.lang.Class definition code for java.lang.Class <?> cl)
          Returns the annotation string (representing a location for the class definition) that RMI will use to annotate the class descriptor when marshalling objects of the given class.
static ClassLoader sample code for java.lang.ClassLoader definition code for java.lang.ClassLoader getClassLoader sample code for java.rmi.server.RMIClassLoader.getClassLoader(java.lang.String) definition code for java.rmi.server.RMIClassLoader.getClassLoader(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  codebase)
          Returns a class loader that loads classes from the given codebase URL path.
static RMIClassLoaderSpi sample code for java.rmi.server.RMIClassLoaderSpi definition code for java.rmi.server.RMIClassLoaderSpi getDefaultProviderInstance sample code for java.rmi.server.RMIClassLoader.getDefaultProviderInstance() definition code for java.rmi.server.RMIClassLoader.getDefaultProviderInstance() ()
          Returns the canonical instance of the default provider for the service provider interface RMIClassLoaderSpi sample code for java.rmi.server.RMIClassLoaderSpi definition code for java.rmi.server.RMIClassLoaderSpi .
static Object sample code for java.lang.Object definition code for java.lang.Object getSecurityContext sample code for java.rmi.server.RMIClassLoader.getSecurityContext(java.lang.ClassLoader) definition code for java.rmi.server.RMIClassLoader.getSecurityContext(java.lang.ClassLoader) (ClassLoader sample code for java.lang.ClassLoader definition code for java.lang.ClassLoader  loader)
          Deprecated. no replacement. As of the Java 2 platform v1.2, RMI no longer uses this method to obtain a class loader's security context.
static Class sample code for java.lang.Class definition code for java.lang.Class <?> loadClass sample code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String) definition code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Deprecated. replaced by loadClass(String,String) method
static Class sample code for java.lang.Class definition code for java.lang.Class <?> loadClass sample code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String, java.lang.String) definition code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String, java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  codebase, String sample code for java.lang.String definition code for java.lang.String  name)
          Loads a class from a codebase URL path.
static Class sample code for java.lang.Class definition code for java.lang.Class <?> loadClass sample code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String, java.lang.String, java.lang.ClassLoader) definition code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String, java.lang.String, java.lang.ClassLoader) (String sample code for java.lang.String definition code for java.lang.String  codebase, String sample code for java.lang.String definition code for java.lang.String  name, ClassLoader sample code for java.lang.ClassLoader definition code for java.lang.ClassLoader  defaultLoader)
          Loads a class from a codebase URL path, optionally using the supplied loader.
static Class sample code for java.lang.Class definition code for java.lang.Class <?> loadClass sample code for java.rmi.server.RMIClassLoader.loadClass(java.net.URL, java.lang.String) definition code for java.rmi.server.RMIClassLoader.loadClass(java.net.URL, java.lang.String) (URL sample code for java.net.URL definition code for java.net.URL  codebase, String sample code for java.lang.String definition code for java.lang.String  name)
          Loads a class from a codebase URL.
static Class sample code for java.lang.Class definition code for java.lang.Class <?> loadProxyClass sample code for java.rmi.server.RMIClassLoader.loadProxyClass(java.lang.String, java.lang.String[], java.lang.ClassLoader) definition code for java.rmi.server.RMIClassLoader.loadProxyClass(java.lang.String, java.lang.String[], java.lang.ClassLoader) (String sample code for java.lang.String definition code for java.lang.String  codebase, String sample code for java.lang.String definition code for java.lang.String [] interfaces, ClassLoader sample code for java.lang.ClassLoader definition code for java.lang.ClassLoader  defaultLoader)
          Loads a dynamic proxy class (see Proxy sample code for java.lang.reflect.Proxy definition code for java.lang.reflect.Proxy ) that implements a set of interfaces with the given names from a codebase URL path.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Method Detail

loadClass sample code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String) definition code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String)

@Deprecated
public static Class sample code for java.lang.Class definition code for java.lang.Class <?> loadClass(String sample code for java.lang.String definition code for java.lang.String  name)
                          throws MalformedURLException sample code for java.net.MalformedURLException definition code for java.net.MalformedURLException ,
                                 ClassNotFoundException sample code for java.lang.ClassNotFoundException definition code for java.lang.ClassNotFoundException 
Deprecated. replaced by loadClass(String,String) method

Loads the class with the specified name.

This method delegates to loadClass(String,String) sample code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String, java.lang.String) definition code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String, java.lang.String) , passing null as the first argument and name as the second argument.

Parameters:
name - the name of the class to load
Returns:
the Class object representing the loaded class
Throws:
MalformedURLException sample code for java.net.MalformedURLException definition code for java.net.MalformedURLException - if a provider-specific URL used to load classes is invalid
ClassNotFoundException sample code for java.lang.ClassNotFoundException definition code for java.lang.ClassNotFoundException - if a definition for the class could not be found at the codebase location
See Also:
loadClass(String,String) sample code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String, java.lang.String) definition code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String, java.lang.String)

loadClass sample code for java.rmi.server.RMIClassLoader.loadClass(java.net.URL, java.lang.String) definition code for java.rmi.server.RMIClassLoader.loadClass(java.net.URL, java.lang.String)

public static Class sample code for java.lang.Class definition code for java.lang.Class <?> loadClass(URL sample code for java.net.URL definition code for java.net.URL  codebase,
                                 String sample code for java.lang.String definition code for java.lang.String  name)
                          throws MalformedURLException sample code for java.net.MalformedURLException definition code for java.net.MalformedURLException ,
                                 ClassNotFoundException sample code for java.lang.ClassNotFoundException definition code for java.lang.ClassNotFoundException 
Loads a class from a codebase URL. If codebase is null, then this method will behave the same as loadClass(String,String) sample code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String, java.lang.String) definition code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String, java.lang.String) with a null codebase and the given class name.

This method delegates to the RMIClassLoaderSpi.loadClass(String,String,ClassLoader) sample code for java.rmi.server.RMIClassLoaderSpi.loadClass(java.lang.String, java.lang.String, java.lang.ClassLoader) definition code for java.rmi.server.RMIClassLoaderSpi.loadClass(java.lang.String, java.lang.String, java.lang.ClassLoader) method of the provider instance, passing the result of invoking URL.toString() sample code for java.net.URL.toString() definition code for java.net.URL.toString() on the given URL (or null if codebase is null) as the first argument, name as the second argument, and null as the third argument.

Parameters:
codebase - the URL to load the class from, or null
name - the name of the class to load
Returns:
the Class object representing the loaded class
Throws:
MalformedURLException sample code for java.net.MalformedURLException definition code for java.net.MalformedURLException - if codebase is null and a provider-specific URL used to load classes is invalid
ClassNotFoundException sample code for java.lang.ClassNotFoundException definition code for java.lang.ClassNotFoundException - if a definition for the class could not be found at the specified URL

loadClass sample code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String, java.lang.String) definition code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String, java.lang.String)

public static Class sample code for java.lang.Class definition code for java.lang.Class <?> loadClass(String sample code for java.lang.String definition code for java.lang.String  codebase,
                                 String sample code for java.lang.String definition code for java.lang.String  name)
                          throws MalformedURLException sample code for java.net.MalformedURLException definition code for java.net.MalformedURLException ,
                                 ClassNotFoundException sample code for java.lang.ClassNotFoundException definition code for java.lang.ClassNotFoundException 
Loads a class from a codebase URL path.

This method delegates to the RMIClassLoaderSpi.loadClass(String,String,ClassLoader) sample code for java.rmi.server.RMIClassLoaderSpi.loadClass(java.lang.String, java.lang.String, java.lang.ClassLoader) definition code for java.rmi.server.RMIClassLoaderSpi.loadClass(java.lang.String, java.lang.String, java.lang.ClassLoader) method of the provider instance, passing codebase as the first argument, name as the second argument, and null as the third argument.

Parameters:
codebase - the list of URLs (separated by spaces) to load the class from, or null
name - the name of the class to load
Returns:
the Class object representing the loaded class
Throws:
MalformedURLException sample code for java.net.MalformedURLException definition code for java.net.MalformedURLException - if codebase is non-null and contains an invalid URL, or if codebase is null and a provider-specific URL used to load classes is invalid
ClassNotFoundException sample code for java.lang.ClassNotFoundException definition code for java.lang.ClassNotFoundException - if a definition for the class could not be found at the specified location
Since:
1.2

loadClass sample code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String, java.lang.String, java.lang.ClassLoader) definition code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String, java.lang.String, java.lang.ClassLoader)

public static Class sample code for java.lang.Class definition code for java.lang.Class <?> loadClass(String sample code for java.lang.String definition code for java.lang.String  codebase,
                                 String sample code for java.lang.String definition code for java.lang.String  name,
                                 ClassLoader sample code for java.lang.ClassLoader definition code for java.lang.ClassLoader  defaultLoader)
                          throws MalformedURLException sample code for java.net.MalformedURLException definition code for java.net.MalformedURLException ,
                                 ClassNotFoundException sample code for java.lang.ClassNotFoundException definition code for java.lang.ClassNotFoundException 
Loads a class from a codebase URL path, optionally using the supplied loader. This method should be used when the caller would like to make available to the provider implementation an additional contextual class loader to consider, such as the loader of a caller on the stack. Typically, a provider implementation will attempt to resolve the named class using the given defaultLoader, if specified, before attempting to resolve the class from the codebase URL path.

This method delegates to the RMIClassLoaderSpi.loadClass(String,String,ClassLoader) sample code for java.rmi.server.RMIClassLoaderSpi.loadClass(java.lang.String, java.lang.String, java.lang.ClassLoader) definition code for java.rmi.server.RMIClassLoaderSpi.loadClass(java.lang.String, java.lang.String, java.lang.ClassLoader) method of the provider instance, passing codebase as the first argument, name as the second argument, and defaultLoader as the third argument.

Parameters:
codebase - the list of URLs (separated by spaces) to load the class from, or null
name - the name of the class to load
defaultLoader - additional contextual class loader to use, or null
Returns:
the Class object representing the loaded class
Throws:
MalformedURLException sample code for java.net.MalformedURLException definition code for java.net.MalformedURLException - if codebase is non-null and contains an invalid URL, or if codebase is null and a provider-specific URL used to load classes is invalid
ClassNotFoundException sample code for java.lang.ClassNotFoundException definition code for java.lang.ClassNotFoundException - if a definition for the class could not be found at the specified location
Since:
1.4

loadProxyClass sample code for java.rmi.server.RMIClassLoader.loadProxyClass(java.lang.String, java.lang.String[], java.lang.ClassLoader) definition code for java.rmi.server.RMIClassLoader.loadProxyClass(java.lang.String, java.lang.String[], java.lang.ClassLoader)

public static Class sample code for java.lang.Class definition code for java.lang.Class <?> loadProxyClass(String sample code for java.lang.String definition code for java.lang.String  codebase,
                                      String sample code for java.lang.String definition code for java.lang.String [] interfaces,
                                      ClassLoader sample code for java.lang.ClassLoader definition code for java.lang.ClassLoader  defaultLoader)
                               throws ClassNotFoundException sample code for java.lang.ClassNotFoundException definition code for java.lang.ClassNotFoundException ,
                                      MalformedURLException sample code for java.net.MalformedURLException definition code for java.net.MalformedURLException 
Loads a dynamic proxy class (see Proxy sample code for java.lang.reflect.Proxy definition code for java.lang.reflect.Proxy ) that implements a set of interfaces with the given names from a codebase URL path.

The interfaces will be resolved similar to classes loaded via the loadClass(String,String) sample code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String, java.lang.String) definition code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String, java.lang.String) method using the given codebase.

This method delegates to the RMIClassLoaderSpi.loadProxyClass(String,String[],ClassLoader) sample code for java.rmi.server.RMIClassLoaderSpi.loadProxyClass(java.lang.String, java.lang.String[], java.lang.ClassLoader) definition code for java.rmi.server.RMIClassLoaderSpi.loadProxyClass(java.lang.String, java.lang.String[], java.lang.ClassLoader) method of the provider instance, passing codebase as the first argument, interfaces as the second argument, and defaultLoader as the third argument.

Parameters:
codebase - the list of URLs (space-separated) to load classes from, or null
interfaces - the names of the interfaces for the proxy class to implement
defaultLoader - additional contextual class loader to use, or null
Returns:
a dynamic proxy class that implements the named interfaces
Throws:
MalformedURLException sample code for java.net.MalformedURLException definition code for java.net.MalformedURLException - if codebase is non-null and contains an invalid URL, or if codebase is null and a provider-specific URL used to load classes is invalid
ClassNotFoundException sample code for java.lang.ClassNotFoundException definition code for java.lang.ClassNotFoundException - if a definition for one of the named interfaces could not be found at the specified location, or if creation of the dynamic proxy class failed (such as if Proxy.getProxyClass(ClassLoader,Class[]) sample code for java.lang.reflect.Proxy.getProxyClass(java.lang.ClassLoader, java.lang.Class...) definition code for java.lang.reflect.Proxy.getProxyClass(java.lang.ClassLoader, java.lang.Class...) would throw an IllegalArgumentException for the given interface list)
Since:
1.4

getClassLoader sample code for java.rmi.server.RMIClassLoader.getClassLoader(java.lang.String) definition code for java.rmi.server.RMIClassLoader.getClassLoader(java.lang.String)

public static ClassLoader sample code for java.lang.ClassLoader definition code for java.lang.ClassLoader  getClassLoader(String sample code for java.lang.String definition code for java.lang.String  codebase)
                                  throws MalformedURLException sample code for java.net.MalformedURLException definition code for java.net.MalformedURLException ,
                                         SecurityException sample code for java.lang.SecurityException definition code for java.lang.SecurityException 
Returns a class loader that loads classes from the given codebase URL path.

The class loader returned is the class loader that the loadClass(String,String) sample code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String, java.lang.String) definition code for java.rmi.server.RMIClassLoader.loadClass(java.lang.String, java.lang.String) method would use to load classes for the same codebase argument.

This method delegates to the RMIClassLoaderSpi.getClassLoader(String) sample code for java.rmi.server.RMIClassLoaderSpi.getClassLoader(java.lang.String) definition code for java.rmi.server.RMIClassLoaderSpi.getClassLoader(java.lang.String) method of the provider instance, passing codebase as the argument.

If there is a security manger, its checkPermission method will be invoked with a RuntimePermission("getClassLoader") permission; this could result in a SecurityException. The provider implementation of this method may also perform further security checks to verify that the calling context has permission to connect to all of the URLs in the codebase URL path.

Parameters:
codebase - the list of URLs (space-separated) from which the returned class loader will load classes from, or null
Returns:
a class loader that loads classes from the given codebase URL path
Throws:
MalformedURLException sample code for java.net.MalformedURLException definition code for java.net.MalformedURLException - if codebase is non-null and contains an invalid URL, or if codebase is null and a provider-specific URL used to identify the class loader is invalid
SecurityException sample code for java.lang.SecurityException definition code for java.lang.SecurityException - if there is a security manager and the invocation of its checkPermission method fails, or if the caller does not have permission to connect to all of the URLs in the codebase URL path
Since:
1.3

getClassAnnotation sample code for java.rmi.server.RMIClassLoader.getClassAnnotation(java.lang.Class<?>) definition code for java.rmi.server.RMIClassLoader.getClassAnnotation(java.lang.Class<?>)

public static String sample code for java.lang.String definition code for java.lang.String  getClassAnnotation(Class sample code for java.lang.Class definition code for java.lang.Class <?> cl)
Returns the annotation string (representing a location for the class definition) that RMI will use to annotate the class descriptor when marshalling objects of the given class.

This method delegates to the RMIClassLoaderSpi.getClassAnnotation(Class) sample code for java.rmi.server.RMIClassLoaderSpi.getClassAnnotation(java.lang.Class) definition code for java.rmi.server.RMIClassLoaderSpi.getClassAnnotation(java.lang.Class) method of the provider instance, passing cl as the argument.

Parameters:
cl - the class to obtain the annotation for
Returns:
a string to be used to annotate the given class when it gets marshalled, or null
Throws:
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if cl is null
Since:
1.2

getDefaultProviderInstance sample code for java.rmi.server.RMIClassLoader.getDefaultProviderInstance() definition code for java.rmi.server.RMIClassLoader.getDefaultProviderInstance()

public static RMIClassLoaderSpi sample code for java.rmi.server.RMIClassLoaderSpi definition code for java.rmi.server.RMIClassLoaderSpi  getDefaultProviderInstance()
Returns the canonical instance of the default provider for the service provider interface RMIClassLoaderSpi sample code for java.rmi.server.RMIClassLoaderSpi definition code for java.rmi.server.RMIClassLoaderSpi . If the system property java.rmi.server.RMIClassLoaderSpi is not defined, then the RMIClassLoader static methods will use the canonical instance of the default provider as the service provider instance.

If there is a security manager, its checkPermission method will be invoked with a RuntimePermission("setFactory") permission; this could result in a SecurityException.

The default service provider instance implements RMIClassLoaderSpi sample code for java.rmi.server.RMIClassLoaderSpi definition code for java.rmi.server.RMIClassLoaderSpi as follows:

The getClassAnnotation sample code for java.rmi.server.RMIClassLoaderSpi.getClassAnnotation(java.lang.Class) definition code for java.rmi.server.RMIClassLoaderSpi.getClassAnnotation(java.lang.Class) method returns a String representing the codebase URL path that a remote party should use to download the definition for the specified class. The format of the returned string is a path of URLs separated by spaces. The codebase string returned depends on the defining class loader of the specified class:

  • If the class loader is the system class loader (see ClassLoader.getSystemClassLoader() sample code for java.lang.ClassLoader.getSystemClassLoader() definition code for java.lang.ClassLoader.getSystemClassLoader() ), a parent of the system class loader such as the loader used for installed extensions, or the bootstrap class loader (which may be represented by null), then the value of the java.rmi.server.codebase property (or possibly an earlier cached value) is returned, or null is returned if that property is not set.

  • Otherwise, if the class loader is an instance of URLClassLoader, then the returned string is a space-separated list of the external forms of the URLs returned by invoking the getURLs methods of the loader. If the URLClassLoader was created by this provider to service an invocation of its loadClass or loadProxyClass methods, then no permissions are required to get the associated codebase string. If it is an arbitrary other URLClassLoader instance, then if there is a security manager, its checkPermission method will be invoked once for each URL returned by the getURLs method, with the permission returned by invoking openConnection().getPermission() on each URL; if any of those invocations throws a SecurityException or an IOException, then the value of the java.rmi.server.codebase property (or possibly an earlier cached value) is returned, or null is returned if that property is not set.

  • Finally, if the class loader is not an instance of URLClassLoader, then the value of the java.rmi.server.codebase property (or possibly an earlier cached value) is returned, or null is returned if that property is not set.

For the implementations of the methods described below, which all take a String parameter named codebase that is a space-separated list of URLs, each invocation has an associated codebase loader that is identified using the codebase argument in conjunction with the current thread's context class loader (see Thread.getContextClassLoader() sample code for java.lang.Thread.getContextClassLoader() definition code for java.lang.Thread.getContextClassLoader() ). When there is a security manager, this provider maintains an internal table of class loader instances (which are at least instances of URLClassLoader sample code for java.net.URLClassLoader definition code for java.net.URLClassLoader ) keyed by the pair of their parent class loader and their codebase URL path (an ordered list of URLs). If the codebase argument is null, the codebase URL path is the value of the system property java.rmi.server.codebase or possibly an earlier cached value. For a given codebase URL path passed as the codebase argument to an invocation of one of the below methods in a given context, the codebase loader is the loader in the table with the specified codebase URL path and the current thread's context class loader as its parent. If no such loader exists, then one is created and added to the table. The table does not maintain strong references to its contained loaders, in order to allow them and their defined classes to be garbage collected when not otherwise reachable. In order to prevent arbitrary untrusted code from being implicitly loaded into a virtual machine with no security manager, if there is no security manager set, the codebase loader is just the current thread's context class loader (the supplied codebase URL path is ignored, so remote class loading is disabled).

The getClassLoader sample code for java.rmi.server.RMIClassLoaderSpi.getClassLoader(java.lang.String) definition code for java.rmi.server.RMIClassLoaderSpi.getClassLoader(java.lang.String) method returns the codebase loader for the specified codebase URL path. If there is a security manager, then if the calling context does not have permission to connect to all of the URLs in the codebase URL path, a SecurityException will be thrown.

The loadClass sample code for java.rmi.server.RMIClassLoaderSpi.loadClass(java.lang.String, java.lang.String, java.lang.ClassLoader) definition code for java.rmi.server.RMIClassLoaderSpi.loadClass(java.lang.String, java.lang.String, java.lang.ClassLoader) method attempts to load the class with the specified name as follows:

If the defaultLoader argument is non-null, it first attempts to load the class with the specified name using the defaultLoader, such as by evaluating
     Class.forName(name, false, defaultLoader)
 
If the class is successfully loaded from the defaultLoader, that class is returned. If an exception other than ClassNotFoundException is thrown, that exception is thrown to the caller.

Next, the loadClass method attempts to load the class with the specified name using the codebase loader for the specified codebase URL path. If there is a security manager, then the calling context must have permission to connect to all of the URLs in the codebase URL path; otherwise, the current thread's context class loader will be used instead of the codebase loader.

The loadProxyClass sample code for java.rmi.server.RMIClassLoaderSpi.loadProxyClass(java.lang.String, java.lang.String[], java.lang.ClassLoader) definition code for java.rmi.server.RMIClassLoaderSpi.loadProxyClass(java.lang.String, java.lang.String[], java.lang.ClassLoader) method attempts to return a dynamic proxy class with the named interface as follows:

If the defaultLoader argument is non-null and all of the named interfaces can be resolved through that loader, then,

  • if all of the resolved interfaces are public, then it first attempts to obtain a dynamic proxy class (using Proxy.getProxyClass sample code for java.lang.reflect.Proxy.getProxyClass(java.lang.ClassLoader, java.lang.Class...) definition code for java.lang.reflect.Proxy.getProxyClass(java.lang.ClassLoader, java.lang.Class...) ) for the resolved interfaces defined in the codebase loader; if that attempt throws an IllegalArgumentException, it then attempts to obtain a dynamic proxy class for the resolved interfaces defined in the defaultLoader. If both attempts throw <