You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Dharam Thacker (JIRA)" <ji...@apache.org> on 2016/06/18 12:22:05 UTC

[jira] [Commented] (IGNITE-1246) Exception in thread "main" javax.cache.CacheException: class org.apache.ignite.IgniteCheckedException: Failed to validate cache configuration. Cache store factory is not serializable. Cache name: XXXXXXX

    [ https://issues.apache.org/jira/browse/IGNITE-1246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15337804#comment-15337804 ] 

Dharam Thacker commented on IGNITE-1246:
----------------------------------------

Hi,

Same issue for me as well using programmatic configuration on ignite 1.6.0.

                IgniteConfiguration cfg = new IgniteConfiguration();
		Ignite ignite = Ignition.start(cfg);
		
		CacheConfiguration<Integer,Employees> cacheCfg = new CacheConfiguration<Integer, Employees>("EmoloyeeCache");
		cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
		
		cacheCfg.setCacheStoreFactory(FactoryBuilder.factoryOf(EmployeeLoader.class));
	
		cacheCfg.setCacheStoreSessionListenerFactories(new Factory<CacheStoreSessionListener>() {

            @Override public CacheStoreSessionListener create() {
                CacheSpringStoreSessionListener lsnr = new CacheSpringStoreSessionListener();

                lsnr.setDataSource(jdbcTemplate.getDataSource());

                return lsnr;
            }
        });

        cacheCfg.setReadThrough(true);
        cacheCfg.setWriteThrough(false);
        
        
        // Auto-close cache at the end of the example.
        try (IgniteCache<Integer, Employees> cache = ignite.getOrCreateCache(cacheCfg)) {
            loadCache(cache);    
        } catch(Exception e) {
        	e.printStackTrace();
        }
        finally {

        }
	}
	
	private static void loadCache(IgniteCache<Integer, Employees> cache) {
        long start = System.currentTimeMillis();

        // Start loading cache from persistent store on all caching nodes.
        cache.loadCache(null, null);

        long end = System.currentTimeMillis();

        System.out.println(">>> Loaded " + cache.size() + " keys with backups in " + (end - start) + "ms.");
    }

public class EmployeeLoader extends CacheStoreAdapter<Integer, Employees>{
....
}

How is this working for you?
https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java

Thanks,
Dharam

> Exception in thread "main" javax.cache.CacheException: class org.apache.ignite.IgniteCheckedException: Failed to validate cache configuration. Cache store factory is not serializable. Cache name: XXXXXXX
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: IGNITE-1246
>                 URL: https://issues.apache.org/jira/browse/IGNITE-1246
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: kcheng.mvp
>            Assignee: kcheng.mvp
>              Labels: user-request
>         Attachments: ignite-01.png, ignite-02.png
>
>
> Here is my configuration
> {code:xml}
> <bean id="dataSource"
> 		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
> 		<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
> 		<property name="url"
> 			value="jdbc:oracle:thin:@//192.168.2.39:1521/db" />
> 		<property name="username" value="abc" />
> 		<property name="password" value="abc" />
> 	</bean>
> <bean id="cache.cfg" class="org.apache.ignite.configuration.CacheConfiguration" scope="prototype">
> 		<property name="memoryMode" value="OFFHEAP_TIERED" />
> 		<property name="offHeapMaxMemory" value="#{4 * 1024L * 1024L * 1024L}" />
> 		<property name="atomicityMode" value="ATOMIC" />
> 		<property name="backups" value="1" />
> 		<!-- 
> 		<property name="interceptor">
> 			<bean class="com.fangcang.cache.core.interceptor.IncrInterceptor" />
> 		</property>
> 		 -->
> 		<property name="cacheStoreFactory">
> 			<bean class="javax.cache.configuration.FactoryBuilder$SingletonFactory">
> 				<constructor-arg>
> 					<bean class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore">
> 						<property name="dataSource" ref="dataSource"/>
> 					</bean>
> 				</constructor-arg>
> 			</bean>
> 		</property>
> 	</bean>
> {code}
> When I try to load data to the cache I got the exception.
> here is he stack from client node
> {code}
> Exception in thread "main" javax.cache.CacheException: class org.apache.ignite.IgniteCheckedException: Failed to validate cache configuration. Cache store factory is not serializable. Cache name: T_HTLPRO_PRICEPLAN
> 	at org.apache.ignite.internal.processors.cache.GridCacheUtils.convertToCacheException(GridCacheUtils.java:1581)
> 	at org.apache.ignite.internal.IgniteKernal.getOrCreateCache(IgniteKernal.java:2311)
> 	at org.apache.ignite.IgniteSpringBean.getOrCreateCache(IgniteSpringBean.java:246)
> 	at com.fangcang.cache.client.Grid.getCacheByCfg(Grid.java:30)
> 	at com.fangcang.cache.client.InitLoader.main(InitLoader.java:16)
> Caused by: class org.apache.ignite.IgniteCheckedException: Failed to validate cache configuration. Cache store factory is not serializable. Cache name: T_HTLPRO_PRICEPLAN
> 	at org.apache.ignite.internal.processors.cache.GridCacheProcessor.checkSerializable(GridCacheProcessor.java:3038)
> 	at org.apache.ignite.internal.processors.cache.GridCacheProcessor.dynamicStartCache(GridCacheProcessor.java:1958)
> 	at org.apache.ignite.internal.processors.cache.GridCacheProcessor.dynamicStartCache(GridCacheProcessor.java:1927)
> 	at org.apache.ignite.internal.IgniteKernal.getOrCreateCache(IgniteKernal.java:2306)
> 	... 3 more
> Caused by: class org.apache.ignite.IgniteCheckedException: Failed to serialize object: javax.cache.configuration.FactoryBuilder$SingletonFactory@55dfebeb
> 	at org.apache.ignite.marshaller.jdk.JdkMarshaller.marshal(JdkMarshaller.java:78)
> 	at org.apache.ignite.marshaller.AbstractMarshaller.marshal(AbstractMarshaller.java:51)
> 	at org.apache.ignite.internal.processors.cache.GridCacheProcessor.checkSerializable(GridCacheProcessor.java:3034)
> 	... 6 more
> Caused by: java.io.NotSerializableException: org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore
> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
> 	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
> 	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
> 	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
> 	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
> 	at org.apache.ignite.marshaller.jdk.JdkMarshaller.marshal(JdkMarshaller.java:73)
> 	... 8 more
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)