Index: logback-classic/src/main/java/ch/qos/logback/classic/util/ContextInitializer.java =================================================================== --- logback-classic/src/main/java/ch/qos/logback/classic/util/ContextInitializer.java (revision 2296) +++ logback-classic/src/main/java/ch/qos/logback/classic/util/ContextInitializer.java (working copy) @@ -81,6 +81,10 @@ public URL findURLOfDefaultConfigurationFile(boolean updateStatus) { ClassLoader myClassLoader = this.getClass().getClassLoader(); + if(myClassLoader == null){ + myClassLoader = ClassLoader.getSystemClassLoader(); + } + URL url = findConfigFileURLFromSystemProperties(myClassLoader, updateStatus); if (url != null) { return url; Index: logback-core/src/main/java/ch/qos/logback/core/util/Loader.java =================================================================== --- logback-core/src/main/java/ch/qos/logback/core/util/Loader.java (revision 2296) +++ logback-core/src/main/java/ch/qos/logback/core/util/Loader.java (working copy) @@ -83,7 +83,9 @@ * @return */ public static URL getResourceBySelfClassLoader(String resource) { - return getResource(resource, Loader.class.getClassLoader()); + ClassLoader cl = Loader.class.getClassLoader(); + if(cl == null) cl = ClassLoader.getSystemClassLoader(); + return getResource(resource, cl); } // private static URL getResourceByTCL(String resource) { @@ -104,6 +106,9 @@ public static Class loadClass(String clazz, Context context) throws ClassNotFoundException { ClassLoader cl = context.getClass().getClassLoader(); + if(cl == null){ + cl = ClassLoader.getSystemClassLoader(); + } return cl.loadClass(clazz); } Index: logback-core/src/main/java/ch/qos/logback/core/util/OptionHelper.java =================================================================== --- logback-core/src/main/java/ch/qos/logback/core/util/OptionHelper.java (revision 2296) +++ logback-core/src/main/java/ch/qos/logback/core/util/OptionHelper.java (working copy) @@ -24,6 +24,9 @@ public static Object instantiateByClassName(String className, Class superClass, Context context) throws IncompatibleClassException, DynamicClassLoadingException { ClassLoader classLoader = context.getClass().getClassLoader(); + if(classLoader == null){ + classLoader = ClassLoader.getSystemClassLoader(); + } return instantiateByClassName(className, superClass, classLoader); }