Code example for CacheException

0
 
   @Override 
   protected EmbeddedCacheManager createCacheManager(Properties properties) throws CacheException {
      String name = ConfigurationHelper.getString(CACHE_MANAGER_RESOURCE_PROP, properties, null);
      if (name == null)
         throw new CacheException("Configuration property " + CACHE_MANAGER_RESOURCE_PROP + " not set");
      return locateCacheManager(name, JndiHelper.extractJndiProperties(properties));
   } 
 
   private EmbeddedCacheManager locateCacheManager(String jndiNamespace, Properties jndiProperties) {
      Context ctx = null;
      try { 
          ctx = new InitialContext(jndiProperties);
          return (EmbeddedCacheManager) ctx.lookup(jndiNamespace);
      } catch (NamingException ne) {
          String msg = "Unable to retrieve CacheManager from JNDI [" + jndiNamespace + "]";
          log.info(msg, ne);
          throw new CacheException( msg );
      } finally { 
          if (ctx != null) {
Contextual code suggestions in your IDE  Get Codota for Java