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:
@Bean
public IgniteSpringBean igniteInstance() {
    IgniteSpringBean ignite = new IgniteSpringBean();

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

    ignite.setConfiguration(getIgniteConfiguration());

    return ignite;
}

One possible workaround is using Ignite LifecycleBeans [1] 

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

    @Override public void onLifecycleEvent(LifecycleEventType evt) {
        if (evt == LifecycleEventType.AFTER_NODE_START) {
            ignite.active(true);
        }
    }
}

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

[1]
https://apacheignite.readme.io/docs/ignite-life-cycle#section-lifecyclebean

Thanks!



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

Reply via email to