[jboss-jira] [JBoss JIRA] Created: (JBCACHE-1281) EvictionConfig.getEvictionRegionConfigs() causes ConfigurationException

Brian Stansberry (JIRA) jira-events at lists.jboss.org
Fri Feb 1 16:16:04 EST 2008


EvictionConfig.getEvictionRegionConfigs() causes ConfigurationException
-----------------------------------------------------------------------

                 Key: JBCACHE-1281
                 URL: http://jira.jboss.com/jira/browse/JBCACHE-1281
             Project: JBoss Cache
          Issue Type: Bug
      Security Level: Public (Everyone can see)
    Affects Versions: 2.1.0.CR3
            Reporter: Brian Stansberry
         Assigned To: Manik Surtani
             Fix For: 2.1.0.CR4


Problem is the method impl tries to guess what a default configuration would be:

      if (evictionRegionConfigs == null && defaultEvictionPolicyClass != null)
      {
         // TODO this needs to be refactored obviously ...
         try
         {
            Class<?> cpolicy = Class.forName(defaultEvictionPolicyClass);
            EvictionPolicy policy = (EvictionPolicy) cpolicy.newInstance();
            EvictionRegionConfig erc = new EvictionRegionConfig();
            EvictionPolicyConfig epc = policy.getEvictionConfigurationClass().newInstance();
            // epc.set
            erc.setEvictionPolicyConfig(epc);
            erc.setRegionFqn(RegionManager.DEFAULT_REGION);
            return Collections.singletonList(erc);
         }
         catch (Exception e)
         {
            throw new ConfigurationException(e);
         }
      }

Problem is many EvictionPolicyConfig impls (e.g. LRUConfiguration) will throw a ConfigurationException from their validate() method is left in their default initialized state.  And the call to erc.setEvictionPolicyConfig(epc) will result in a call to epc.validate().

This is leading to WARN logging in JBoss AS as the microcontainer seems to call EvictionConfig.getEvictionRegionConfigs() before trying to inject the configs specified in the -beans.xml:

2008-02-01 11:27:47,467 WARN  [org.jboss.beans.metadata.plugins.AbstractListMetaData] Exception in preinstantiated lookup for: EJB3EntityEvictionConfig.evictionRegionConfigs, org.jboss.cache.config.ConfigurationException: org.jboss.cache.config.ConfigurationException: timeToLiveSeconds must be configured to a value greater than or equal to 0

That WARN logging is no good, but the MC swallows the exception so the condition is otherwise harmless.  Probably wouldn't be so harmless for other callers who stumble onto it.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list