Skip to content

Commit 1054764

Browse files
author
Igor Polevoy
committed
#445 Upgrade to EHCache version 3
1 parent a26df7e commit 1054764

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

activejdbc/src/main/java/org/javalite/activejdbc/Configuration.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ protected Configuration(){
9595
try{
9696
Class cmc = Class.forName(cacheManagerClass);
9797
cacheManager = (CacheManager)cmc.newInstance();
98+
}catch(InitException e){
99+
throw e;
98100
}catch(Exception e){
99101
throw new InitException("failed to initialize a CacheManager. Please, ensure that the property " +
100102
"'cache.manager' points to correct class which extends 'org.javalite.activejdbc.cache.CacheManager' class and provides a default constructor.", e);

activejdbc/src/main/java/org/javalite/activejdbc/cache/EHCache3Manager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ public EHCache3Manager() throws ClassNotFoundException, SAXException, Instantiat
5151
XmlConfiguration xmlConfiguration = new XmlConfiguration(url);
5252

5353
cacheTemplate = xmlConfiguration.newCacheConfigurationBuilderFromTemplate("activejdbc", String.class, Object.class);
54+
55+
if(cacheTemplate == null){
56+
throw new InitException("Please, provide a <cache-template name=\"activejdbc\"> element in activejdbc-ehcache.xml file");
57+
}
5458
cacheManager = CacheManagerBuilder.newCacheManager(xmlConfiguration);
5559
cacheManager.init();
5660
}

0 commit comments

Comments
 (0)