[
https://issues.apache.org/jira/browse/IGNITE-1246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14695627#comment-14695627
]
kcheng.mvp edited comment on IGNITE-1246 at 8/13/15 5:36 PM:
-------------------------------------------------------------
>From this thread
http://apache-ignite-users.70518.x6.nabble.com/How-to-use-class-CacheJdbcPojoStoreFactory-doing-persistent-store-td594.html
I know there is class
{code:java}
org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory
{code}
Then I change the configuration to below
{code:xml}
<property name="cacheConfiguration">
<list>
<bean id="cache.cfg"
class="org.apache.ignite.configuration.CacheConfiguration">
<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="cacheStoreFactory">
<bean
class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory">
<property
name="dataSource" ref="dataSource"/>
</bean>
</property>
</bean>
</list>
</property>
{code}
I can start the node successfully, but when I try to create a cache and load
data from db I got below exception
{code:java}
cache.loadCache(null, null);
{code}
{code}
class org.apache.ignite.IgniteCheckedException: Failed to start component:
class org.apache.ignite.IgniteException: Failed to initialize cache store (data
source is not provided).
at
org.apache.ignite.internal.util.IgniteUtils.startLifecycleAware(IgniteUtils.java:8124)
at
org.apache.ignite.internal.processors.cache.GridCacheProcessor.createCache(GridCacheProcessor.java:1138)
at
org.apache.ignite.internal.processors.cache.GridCacheProcessor.prepareCacheStart(GridCacheProcessor.java:1505)
at
org.apache.ignite.internal.processors.cache.GridCacheProcessor.prepareCachesStart(GridCacheProcessor.java:1435)
at
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.startCaches(GridDhtPartitionsExchangeFuture.java:902)
at
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.init(GridDhtPartitionsExchangeFuture.java:480)
at
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:1017)
at
org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:108)
at java.lang.Thread.run(Thread.java:745)
Caused by: class org.apache.ignite.IgniteException: Failed to initialize cache
store (data source is not provided).
at
org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore.start(CacheAbstractJdbcStore.java:234)
at
org.apache.ignite.internal.util.IgniteUtils.startLifecycleAware(IgniteUtils.java:8120)
... 8 more
{code}
from the configuration, I clearly set the datasource, not sure why it throws
such exception.
was (Author: kcheng.mvp):
>From this thread
http://apache-ignite-users.70518.x6.nabble.com/How-to-use-class-CacheJdbcPojoStoreFactory-doing-persistent-store-td594.html
I know there is class
{code:java}
org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory
{code}
Then I change the configuration to below
{code:xml}
<property name="cacheConfiguration">
<list>
<bean id="cache.cfg"
class="org.apache.ignite.configuration.CacheConfiguration">
<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="cacheStoreFactory">
<bean
class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory">
<property
name="dataSource" ref="dataSource"/>
</bean>
</property>
</bean>
</list>
</property>
{code}
I can start the node successfully, but when I try to create a cache I got below
exception
{code}
class org.apache.ignite.IgniteCheckedException: Failed to start component:
class org.apache.ignite.IgniteException: Failed to initialize cache store (data
source is not provided).
at
org.apache.ignite.internal.util.IgniteUtils.startLifecycleAware(IgniteUtils.java:8124)
at
org.apache.ignite.internal.processors.cache.GridCacheProcessor.createCache(GridCacheProcessor.java:1138)
at
org.apache.ignite.internal.processors.cache.GridCacheProcessor.prepareCacheStart(GridCacheProcessor.java:1505)
at
org.apache.ignite.internal.processors.cache.GridCacheProcessor.prepareCachesStart(GridCacheProcessor.java:1435)
at
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.startCaches(GridDhtPartitionsExchangeFuture.java:902)
at
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.init(GridDhtPartitionsExchangeFuture.java:480)
at
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:1017)
at
org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:108)
at java.lang.Thread.run(Thread.java:745)
Caused by: class org.apache.ignite.IgniteException: Failed to initialize cache
store (data source is not provided).
at
org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore.start(CacheAbstractJdbcStore.java:234)
at
org.apache.ignite.internal.util.IgniteUtils.startLifecycleAware(IgniteUtils.java:8120)
... 8 more
{code}
from the configuration, I clearly set the datasource, not sure why it throws
such exception.
> 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: Valentin Kulichenko
>
> 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)