public static Object newProxyInstance(Class<?> superclass, Class<?>[] interfaces, InvocationHandler h) throws ExportException {
        HandlerAdapter ha = new HandlerAdapter(h, superclass, interfaces);

        if (interfaces != null) {
            Class<?>[] source = interfaces;
            interfaces = new Class<?>[source.length + 1];
            System.arraycopy(source, 0, interfaces, 1, source.length);
        } else {
            interfaces = new Class<?>[1];
        }

        //Pop in the CGILibSerializableProxy interface to support serialization of the proxy:
        interfaces[0] = CGILibSerializableProxy.class;

        //Check that we have a no arg constructor:
        try {
            superclass.getDeclaredConstructor(new Class<?> [] {});
        } catch (NoSuchMethodException nsme) {
            throw new ExportException("Can't export " + superclass.getName() + " because it doesn't define a no arg constructor. Try exporting with specified service interfaces", nsme);
        }

        //        System.out.println("CGLIB CREATING PROXY for " + superclass.getName() + " with interfaces: " + Arrays.asList(interfaces));
        Enhancer e = new Enhancer();
        e.setClassLoader(JMSRemoteSystem.INSTANCE.getUserClassLoader(ha));
        e.setSuperclass(superclass);
        e.setInterfaces(interfaces);
        e.setCallback(ha);
        Object obj = e.create();
        generatedClasses.put(obj.getClass(), null);
        return obj;
    }