if(loader == null){ loader = ClassLoader.getSystemClassLoader(); }
        Protocol createLayer(ProtocolStack prot_stack) throws Exception {            Protocol retval=null;            if(protocol_name == null)                return null;            // SL: we use the context classloader to be able to work correctly in            // complex classloaders environments            // FH: The context class loader doesn't work in Tomcat            ClassLoader loader=Thread.currentThread().getContextClassLoader();            try {                String defaultProtocolName=protocol_prefix + '.' + protocol_name;                Class clazz=null;                // first try to load the class in the default package                //                try {                    clazz=loader.loadClass(defaultProtocolName);                }                catch(ClassNotFoundException cnfe) {                    //try using another class loader                    try {                        loader=this.getClass().getClassLoader();                        clazz=loader.loadClass(defaultProtocolName);                    }                    catch(Exception ignore) {                    }                    // unable to find it in the default package... guess                    // it is an absolute package name                    // try two class loaders, first the same one that                    // loaded this class, then try the                    try {                        loader=this.getClass().getClassLoader();                        if(clazz == null) clazz=loader.loadClass(protocol_name);                    }                    catch(Exception ignore) {                    }                    //                    try {                        loader=Thread.currentThread().getContextClassLoader();                        if(clazz == null) clazz=loader.loadClass(protocol_name);                    }                    catch(ClassNotFoundException cnfe2) {                        throw new Exception("Configurator.ProtocolConfiguration.createLayer(): " +                                            "unable to load class for protocol " + protocol_name +                                            " (either as an absolute - " + protocol_name +                                            " - or relative - " + defaultProtocolName +                                            " - package name)!");                    }                }                retval=(Protocol)clazz.newInstance();                if(retval == null)                    throw new Exception("Configurator.ProtocolConfiguration.createLayer(): " +                                        "creation of instance for protocol " + protocol_name + "failed !");                retval.setProtocolStack(prot_stack);                if(properties != null)                    if(!retval.setPropertiesInternal(properties))                        return null;                retval.init();            }            catch(InstantiationException inst_ex) {                log.error("an instance of " + protocol_name + " could not be created. Please check that it implements" +                        " interface Protocol and that is has a public empty constructor !");                throw inst_ex;            }            return retval;        }