ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dharam Thacker (JIRA)" <j...@apache.org>
Subject [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
Date Sat, 18 Jun 2016 12:50:05 GMT

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

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

Hi,

Same error for me using programmatic configuration with 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);
		
		EmployeeLoader loader = new EmployeeLoader(jdbcTemplate);
		cacheCfg.setCacheStoreFactory(FactoryBuilder.factoryOf(loader));


        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> implements
Serializable{

          private JdbcTemplate jdbcTemplate;
....
}

Thanks & Regards,
Dharam Thacker

> 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)

Mime
View raw message