I had used SpringApplicationContextResource  annotation. But it did not
inject the application context in it. So I decided to use spring managed
bean and it worked.

Thanks,
Prasad

On Thu, Jul 5, 2018 at 7:49 PM Вячеслав Коптилин <[email protected]>
wrote:

> It seems that you need to use @
>
> SpringApplicationContextResource
>
> instead of @Autowired.
> Could you please check that?
>
> Thanks.
>
> чт, 5 июл. 2018 г. в 17:01, Prasad Bhalerao <[email protected]
> >:
>
>>
>>
>> import java.io.Serializable;
>> import javax.cache.configuration.Factory;
>> import javax.sql.DataSource;
>> import org.apache.ignite.IgniteException;
>> import org.apache.ignite.cache.store.CacheStoreSessionListener;
>> import org.apache.ignite.cache.store.jdbc.CacheJdbcStoreSessionListener;
>> import org.springframework.beans.factory.annotation.Autowired;
>> import org.springframework.context.ApplicationContext;
>>
>> public class CacheStoreSessionListenerFactory implements 
>> Factory<CacheStoreSessionListener>, Serializable {
>>
>>   private static final long serialVersionUID = 6142932447545510244L;
>>
>>   private String className;
>>
>>   @Autowired
>>   private transient ApplicationContext appCtx;
>>
>>
>>   public CacheStoreSessionListenerFactory(Class<CacheStoreSessionListener> 
>> clazz) {
>>     this.className = clazz.getName();
>>   }
>>
>>   @Override
>>   public CacheStoreSessionListener create() {
>>
>>     if (appCtx == null) {
>>       throw new IgniteException("Spring application context resource is not 
>> injected.");
>>     }
>>     CacheJdbcStoreSessionListener lsnr = new CacheJdbcStoreSessionListener();
>>     lsnr.setDataSource((DataSource) appCtx.getBean("dataSource"));
>>     return lsnr;
>>
>>   }
>>
>> }
>>
>>
>>
>> On Thu, Jul 5, 2018 at 7:24 PM slava.koptilin <[email protected]>
>> wrote:
>>
>>> Well, the exception is thrown by your class:
>>> org.apache.ignite.IgniteException: Spring application context resource is
>>> not injected.
>>>  at
>>>
>>> *com.qualys.agms.grid.cache.loader.factory.CacheStoreSessionListenerFactory*.create(CacheStoreSessionListenerFactory.java:30)
>>>  at
>>>
>>> com.qualys.agms.grid.cache.loader.factory.CacheStoreSessionListenerFactory.create(CacheStoreSessionListenerFactory.java:12)
>>>
>>> Is it possible to share this class as well?
>>>
>>>
>>>
>>> --
>>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>>
>>

Reply via email to