Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8227349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:06:03+00:00 2026-06-07T16:06:03+00:00

I am using ehcache in Spring framework. I am using ehcache.xml to initialize ehcache.

  • 0

I am using ehcache in Spring framework. I am using ehcache.xml to initialize ehcache. However I want to add certain properties such as terracottaconfig at runtime. For this purpose I overridden the class EhCacheManagerFactoryBean. Currently I am overriding method getObject() of this class (I don’t know whether this is a correct one to override as other method setResource() and afterPropertiesSet() are called before class is initialized with ehcache.xml file.)

This is my spring configuration file

<bean id="cacheManager"
class="com.dexknows.util.CustomEhCacheManagerFactoryBean">
<property name="configLocation">
   <value>file:///${vp_data_dir}/ehcache.xml</value>
</property>     
<property name="terracottaConfigUrl" value="#{dexProperties['terracottaConfig.Url']}"/>
</bean>

and this is the class method that I overridden

public class CustomEhCacheManagerFactoryBean extends EhCacheManagerFactoryBean {

    private String terracottaConfigUrl;
    private Resource resourceConfiguration;

    @Override
    public void setConfigLocation(Resource configLocation) {            
        super.setConfigLocation(configLocation);
    }

    @Override
    public void afterPropertiesSet() throws IOException, CacheException {

        super.afterPropertiesSet();
    }


    @Override
    public CacheManager getObject() {

        CacheManager manager = super.getObject();

        TerracottaClientConfiguration terracottaClientConfiguration = new TerracottaClientConfiguration();
        terracottaClientConfiguration.setRejoin(true);
        terracottaClientConfiguration.setUrl(terracottaConfigUrl);



        manager.getConfiguration().setDynamicConfig(true);
        manager.getConfiguration().terracotta(terracottaClientConfiguration);

Configuration().terracotta(terracottaClientConfiguration)));
    return manager;

    }

    public String getTerracottaConfigUrl() {
        return terracottaConfigUrl;
    }

    public void setTerracottaConfigUrl(String terracottaConfigUrl) {
        this.terracottaConfigUrl = terracottaConfigUrl;
    }

}

I am getting following exception:

Error creating bean with name ‘cacheManager’: FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: net.sf.ehcache.config.Configuration.dynamicConfig can’t be changed dynamically

I have set dynamicConfig=”true”

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="ehcache.xsd"
         updateCheck="false"
         monitoring="autodetect"
         dynamicConfig="true"
         name="xyz">
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:06:04+00:00Added an answer on June 7, 2026 at 4:06 pm

    After analyzing the source code of EhCacheManagerFactoryBean class, I found that ‘terracottaConfigConfiguration’ can’t be changed dynamically. Only properties mentioned in enum DynamicProperty can be changed dynamically. Still, If some one find the documentation, mentioning the same, it will be helpful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using ehcache-spring-annotations to cache the List returned from a service method: @Cacheable(cacheName
I configured Second Level Cache using Ehcache in hibernate.cfg.xml ,ehcache.xml.And setting the cache-usage property
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
I am using Spring 3.1 Cache using EhCache currently to implement method caching. Consider
I'm using Spring 3.1 and I want to use the new cache features. Then,
we are using web-ehcache's net.sf.ehcache.constructs.web.filter.SimplePageCachingFilter, that configured by xml, to cache page where is
I keep getting this error while setting up ehcache in Spring MVC. org.springframework.beans.factory.BeanCreationException: Error
I can't find this anywhere in the Ehcache docs. Right now I'm using this
I want to distribute my EhCache via a JMS Topic. This is documented here
BAckground: I'm using ehcache as a cache implementation in a Spring 3.1 application. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.