Search in sources :

Example 1 with SkeletonNotFoundException

use of java.rmi.server.SkeletonNotFoundException in project jdk8u_jdk by JetBrains.

the class Util method createSkeleton.

/**
     * Locate and return the Skeleton for the specified remote object
     */
static Skeleton createSkeleton(Remote object) throws SkeletonNotFoundException {
    Class<?> cl;
    try {
        cl = getRemoteClass(object.getClass());
    } catch (ClassNotFoundException ex) {
        throw new SkeletonNotFoundException("object does not implement a remote interface: " + object.getClass().getName());
    }
    // now try to load the skeleton based ont he name of the class
    String skelname = cl.getName() + "_Skel";
    try {
        Class<?> skelcl = Class.forName(skelname, false, cl.getClassLoader());
        return (Skeleton) skelcl.newInstance();
    } catch (ClassNotFoundException ex) {
        throw new SkeletonNotFoundException("Skeleton class not found: " + skelname, ex);
    } catch (InstantiationException ex) {
        throw new SkeletonNotFoundException("Can't create skeleton: " + skelname, ex);
    } catch (IllegalAccessException ex) {
        throw new SkeletonNotFoundException("No public constructor: " + skelname, ex);
    } catch (ClassCastException ex) {
        throw new SkeletonNotFoundException("Skeleton not of correct class: " + skelname, ex);
    }
}
Also used : SkeletonNotFoundException(java.rmi.server.SkeletonNotFoundException) Skeleton(java.rmi.server.Skeleton)

Aggregations

Skeleton (java.rmi.server.Skeleton)1 SkeletonNotFoundException (java.rmi.server.SkeletonNotFoundException)1