• Bug
  • Status: New
  • 2 Major
  • Resolution:
  • ehcache-core
  • drb
  • Reporter: kwdelong
  • December 22, 2014
  • 0
  • Watchers: 1
  • December 22, 2014

Description

When using: EhCache 2.4.3 Hibernate 4.3.7.Final Spring 4.1.2.RELEASE Spring Data JPA 1.7.1.RELEASE

When using XML bean definitions like so: hibernate.generate_statistics = true hibernate.cache.use_second_level_cache = true hibernate.cache.region.factory_class = org.hibernate.cache.ehcache.EhCacheRegionFactory hibernate.cache.use_query_cache = true net.sf.ehcache.configurationResourceName = META-INF/ehcache/ehcache.xml

If there are trailing spaces in the XML file after the configurationResourceName (“META-INF/ehcache/ehcache.xml “), we get a NullPointerException in ConfigurationFactory, line 100: public static Configuration parseConfiguration(final URL url) throws CacheException { LOG.debug(“Configuring ehcache from URL: {}”, url); Configuration configuration; InputStream input = null; try { input = url.openStream(); **** BUG: “url” is null ******* configuration = parseConfiguration(input); } catch (Exception e) { throw new CacheException(“Error configuring from “ + url + “. Initial cause was “ + e.getMessage(), e);

If you trace up the stack trace, and if I remember correctly, the error is in EhCacheRegionFactory, line 90, where the string should be trimmed: final URL url = loadResource( configurationResourceName ); ********** BUG: trim() the configurationResourceName to remove trailing spaces!!!! ******************* final Configuration configuration = HibernateEhcacheUtils.loadAndCorrectConfiguration( url );

Comments