public static URL getResource(String resourceName, Class<?> callingClass) {
        URL url = getContextClassLoader().getResource(resourceName);
        if (url == null && resourceName.startsWith("/")) {
            //certain classloaders need it without the leading /
            url = getContextClassLoader().getResource(resourceName.substring(1));
        }

        ClassLoader cluClassloader = ClassLoaderUtils.class.getClassLoader();
        if (cluClassloader == null) {
            cluClassloader = ClassLoader.getSystemClassLoader();
        }
        if (url == null) {
            url = cluClassloader.getResource(resourceName);
        }
        if (url == null && resourceName.startsWith("/")) {
            //certain classloaders need it without the leading /
            url = cluClassloader.getResource(resourceName.substring(1));
        }

        if (url == null) {
            ClassLoader cl = callingClass.getClassLoader();

            if (cl != null) {
                url = cl.getResource(resourceName);
            }
        }

        if (url == null) {
            url = callingClass.getResource(resourceName);
        }

        if ((url == null) && (resourceName != null) && (resourceName.charAt(0) != '/')) {
            return getResource('/' + resourceName, callingClass);
        }

        return url;
    }
public static URL getResource ( String resourceName , Class < ? > callingClass ) { URL url = getContextClassLoader ( ) . getResource ( resourceName ) ; if ( url == null && resourceName . startsWith ( "/" ) ) { url = getContextClassLoader ( ) . getResource ( resourceName . substring ( 1 ) ) ; } ClassLoader cluClassloader = ClassLoaderUtils . class . getClassLoader ( ) ; if ( cluClassloader == null ) { cluClassloader = ClassLoader . getSystemClassLoader ( ) ; } if ( url == null ) { url = cluClassloader . getResource ( resourceName ) ; } if ( url == null && resourceName . startsWith ( "/" ) ) { url = cluClassloader . getResource ( resourceName . substring ( 1 ) ) ; } if ( url == null ) { ClassLoader cl = callingClass . getClassLoader ( ) ; if ( cl != null ) { url = cl . getResource ( resourceName ) ; } } if ( url == null ) { url = callingClass . getResource ( resourceName ) ; } if ( ( url == null ) && ( resourceName != null ) && ( resourceName . charAt ( 0 ) != '/' ) ) { return getResource ( '/' + resourceName , callingClass ) ; } return url ; }
Load a given resource. <p/> This method will try to load the resource
using the following methods (in order):
<ul>
<li>From Thread.currentThread().getContextClassLoader()
<li>From ClassLoaderUtil.class.getClassLoader()
<li>callingClass.getClassLoader()
</ul>

@param resourceName The name of the resource to load
@param callingClass The Class object of the calling object