Hi Mauricio,

You encounter this exception because SingletonFactory actually stores a
reference to the factory instance which is later is serialized. Instead of
SingletonFactory, you can
use org.apache.ignite.configuration.IgniteReflectionFactory which does not
store this reference and can be successfully serialized. Please refer to
the IgniteReflectionFactory javadoc.

Hope this helps,
AG

2017-02-21 22:36 GMT+03:00 Mauricio Arroqui <mauriarro...@gmail.com>:

> Hi,
>
> I have the same problem mentioned in the post below, but I use mongoDb
> instead of CacheJdbcBlobStore.
> http://apache-ignite-users.70518.x6.nabble.com/How-to-
> use-CacheJdbcBlobStore-Getting-NotSerializableException-td431.html
>
> Here is an example with Mongo, but it use Embedded MongoDB which it's main
> goal is for unit testing:
> https://github.com/gridgain/gridgain-advanced-examples/
> blob/master/src/main/java/org/gridgain/examples/datagrid/
> store/CacheMongoStore.java
>
> I read you solve the issue for CacheJdbcBlobStore
> https://issues.apache.org/jira/browse/IGNITE-960
>
> Are you planning to do the same with mongo? I'm losing something?
>
> Thanks in advance.
> Mauricio
>
> Here's a my bean configuration:
>  <bean class="org.apache.ignite.configuration.CacheConfiguration">
>                     <property name="name" value="local_simulation"/>
>                     <property name="cacheMode" value="LOCAL"/>
>                     <property name="atomicityMode" value="ATOMIC"/>
>                     <property name="copyOnRead" value="true"/>
>                      <property name="cacheStoreFactory">
>                       <bean
> class="javax.cache.configuration.FactoryBuilder$SingletonFactory">
>                         <constructor-arg>
>                           <bean
> class="uniagro.simugant.db.grid.mongodb.SimulationCacheMongoStore">
>                           </bean>
>                         </constructor-arg>
>                       </bean>
>                   </property>
>                   <property name="writeThrough" value="true"/>
>                   <property name="writeBehindEnabled" value="true"/>
>                 </bean>
>
> Abstract Cache store (SimulationCacheMongoStore extends this on):
> public abstract class CacheMongoStore<K, V> extends CacheStoreAdapter<K, V>
> implements Serializable, LifecycleAware {
>
>     /**
>      * MongoDB port.
>      */
>     private static final int MONGOD_PORT = 27017;
>
>     /**
>      * MongoDB executable for embedded MongoDB store.
>      */
>     private MongoClient mongoClient;
>
>     /**
>      * Mongo data store.
>      */
>     protected Datastore morphia;
>
>     @Override
>     public void start() throws IgniteException {
>
>         mongoClient = new MongoClient();
>         morphia = new Morphia().createDatastore(mongoClient, "test");
>     }
>
>     @Override
>     public void stop() throws IgniteException {
>         if (mongoClient != null) {
>             mongoClient.close();
>
>         }
>     }
>
> }
>
>
>
>
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/How-to-configure-MongoDB-Client-I-m-getting-
> NotSerializableException-tp10767.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Reply via email to