Use public static URL getResource(Class<?> contextClass, String resourceName) to make sure the function is executed using the correct classloader. 

getResource(TestConstants.class, ...)