I tried to debug the ignite code, GridResourceProcessor.inject is not being
executed for injecting resources into CacheStoreSessionListenerFactories.
It is being called for CachestoreFactories.

Can you please advise?

Thanks,
Prasad

On Thu, Jul 5, 2018 at 8:14 PM Prasad Bhalerao <prasadbhalerao1...@gmail.com>
wrote:

> 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 but now it is creating the problem which is described in
> this mail chain.
>
> On Thu, Jul 5, 2018 at 8:11 PM Prasad Bhalerao <
> prasadbhalerao1...@gmail.com> wrote:
>
>> 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 Вячеслав Коптилин <
>> slava.kopti...@gmail.com> wrote:
>>
>>> It seems that you need to use @
>>>
>>> SpringApplicationContextResource
>>>
>>> instead of @Autowired.
>>> Could you please check that?
>>>
>>> Thanks.
>>>
>>> чт, 5 июл. 2018 г. в 17:01, Prasad Bhalerao <
>>> prasadbhalerao1...@gmail.com>:
>>>
>>>>
>>>>
>>>> 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 <slava.kopti...@gmail.com>
>>>> 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