ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prasad Bhalerao <prasadbhalerao1...@gmail.com>
Subject Re: Getting Invalid state exception when Persistance is enabled.
Date Wed, 21 Feb 2018 01:14:43 GMT
Hi Slava,
Thank you for solution.

Can you please help me with following question.

I am loading the cache from oracle table using loadCache method. If the
persistence is enabled and if the data is already persisted, I want to make
sure that the cache is loaded from persisted data instead of loading it
from oracle table using loadCache. Can someone please advise how this can
be achieved?


On Feb 20, 2018 11:49 PM, "slava.koptilin" <slava.koptilin@gmail.com> wrote:

Hi Prasad,

The root cause of IllegalStateException you observed is that the Ignite
instance is created within IgniteSpringBean#afterSingletonsInstantiated()
method which is triggered by the Spring Framework.
So, you should not call ignite.active(true) method here:
public IgniteSpringBean igniteInstance() {
    IgniteSpringBean ignite = new IgniteSpringBean();

    // Please do not call active() method here
    // Ignite instance is not initialized yet.


    return ignite;

One possible workaround is using Ignite LifecycleBeans [1]

// Lifecycle bean that activates the cluster.
public class MyLifecycleBean implements LifecycleBean {
    private Ignite ignite;

    @Override public void onLifecycleEvent(LifecycleEventType evt) {
        if (evt == LifecycleEventType.AFTER_NODE_START) {

// Provide lifecycle bean to the configuration.
private IgniteConfiguration getIgniteConfiguration() {
    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setLifecycleBeans(new MyLifecycleBean());
    return cfg;



Sent from: http://apache-ignite-users.70518.x6.nabble.com/

View raw message