Buggy code:
@ Component ( immediate = true , metatype = true ) @ Service ( CacheManagerService . class ) public class CacheManagerServiceImpl implements CacheManagerService { public static final String DEFAULT_CACHE_CONFIG = "sling//ehcacheConfig.xml" ; public static final String DEFAULT_BIND_ADDRESS = "127.0.0.1" ; public static final String DEFAULT_CACHE_STORE = "sling//ehcacheStore" ; @ Property ( CacheManagerServiceImpl . DEFAULT_CACHE_CONFIG ) public static final String CACHE_CONFIG = "cache-config" ; @ Property ( CacheManagerServiceImpl . DEFAULT_BIND_ADDRESS ) public static final String BIND_ADDRESS = "bind-address" ; @ Property ( CacheManagerServiceImpl . DEFAULT_CACHE_STORE ) public static final String CACHE_STORE = "cache-store" ; @ Property ( "The<seq2seq4repair_space>Sakai<seq2seq4repair_space>Foundation" ) static final String SERVICE_VENDOR = "service.vendor" ; @ Property ( "Cache<seq2seq4repair_space>Manager<seq2seq4repair_space>Service<seq2seq4repair_space>Implementation" ) static final String SERVICE_DESCRIPTION = "service.description" ; private static final String CONFIG_PATH = "res:////org//sakaiproject//nakamura//memory//ehcacheConfig.xml" ; private static final Logger LOGGER = LoggerFactory . getLogger ( CacheManagerServiceImpl . class ) ; private CacheManager cacheManager ; private Map < String , Cache < ? > > caches = new HashMap < String , Cache < ? > > ( ) ; private ThreadLocalCacheMap requestCacheMapHolder = new ThreadLocalCacheMap ( ) ; private ThreadLocalCacheMap threadCacheMapHolder = new ThreadLocalCacheMap ( ) ; public CacheManagerServiceImpl ( ) throws IOException { } private void create ( ) throws IOException { } @ Activate protected void activate ( Map < String , Object > properties ) throws FileNotFoundException , IOException { String config = PropertiesUtil . toString ( properties . get ( CacheManagerServiceImpl . CACHE_CONFIG ) , CacheManagerServiceImpl . DEFAULT_CACHE_CONFIG ) ; File configFile = new File ( config ) ; ClassLoader cl = Thread . currentThread ( ) . getContextClassLoader ( ) ; try { Thread . currentThread ( ) . setContextClassLoader ( this . getClass ( ) . getClassLoader ( ) ) ; CacheManagerServiceImpl . LOGGER . info ( "Context<seq2seq4repair_space>Classloader<seq2seq4repair_space>was<seq2seq4repair_space>{}<seq2seq4repair_space>now<seq2seq4repair_space>{}<seq2seq4repair_space>" , cl , this . getClass ( ) . getClassLoader ( ) ) ; if ( configFile . exists ( ) ) { CacheManagerServiceImpl . LOGGER . info ( "Configuring<seq2seq4repair_space>Cache<seq2seq4repair_space>from<seq2seq4repair_space>{}<seq2seq4repair_space>" , configFile . getAbsolutePath ( ) ) ; InputStream in = null ; try { in = processConfig ( new FileInputStream ( configFile ) , properties ) ; cacheManager = new CacheManager ( in ) ; } finally { if ( in != null ) { in . close ( ) ; } } } else { CacheManagerServiceImpl . LOGGER . info ( "Configuring<seq2seq4repair_space>Cache<seq2seq4repair_space>from<seq2seq4repair_space>Classpath<seq2seq4repair_space>Default<seq2seq4repair_space>{}<seq2seq4repair_space>" , CacheManagerServiceImpl . CONFIG_PATH ) ; <START_BUG> InputStream in = processConfig ( this . getClass ( ) . getClassLoader ( ) . getResourceAsStream ( CacheManagerServiceImpl . CONFIG_PATH ) , properties ) ; <END_BUG> if ( in == null ) { throw new IOException ( ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>open<seq2seq4repair_space>config<seq2seq4repair_space>at<seq2seq4repair_space>classpath<seq2seq4repair_space>location<seq2seq4repair_space>" + ( CacheManagerServiceImpl . CONFIG_PATH ) ) ) ; } cacheManager = new CacheManager ( in ) ; in . close ( ) ; } } finally { Thread . currentThread ( ) . setContextClassLoader ( cl ) ; CacheManagerServiceImpl . LOGGER . info ( "Context<seq2seq4repair_space>Classloader<seq2seq4repair_space>reset<seq2seq4repair_space>was<seq2seq4repair_space>{}<seq2seq4repair_space>now<seq2seq4repair_space>{}<seq2seq4repair_space>" , this . getClass ( ) . getClassLoader ( ) , cl ) ; } } protected InputStream processConfig ( InputStream configFile , Map < String , Object > properties ) { } public static void main ( String [ ] args ) throws Exception { } public void stop ( ) { } public < V > Cache < V > getCache ( String name , CacheScope scope ) { } @ SuppressWarnings ( "unchecked" ) private < V > Cache < V > getThreadCache ( String name ) { } @ SuppressWarnings ( "unchecked" ) private < V > Cache < V > getRequestCache ( String name ) { } @ SuppressWarnings ( "unchecked" ) private < V > Cache < V > getInstanceCache ( String name , CacheScope scope ) { } public void unbind ( CacheScope scope ) { } private void unbindThread ( ) { } private void unbindRequest ( ) { } }

Fix:
InputStream in = processConfig ( ResourceLoader . openResource ( CacheManagerServiceImpl . CONFIG_PATH , this . getClass ( ) . getClassLoader ( ) ) , properties ) ;