You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Jeff Jiao <je...@gmail.com> on 2017/11/01 01:52:17 UTC

Re: when client node connect to server node, server node throws NotSerializableException

Hi Andrew,

Thanks a lot for all the replies.

yes BoConverter implements Serializable, or Ignite will throw
NotSerializableException.
The "Class" here is actually for hibernate to get data from DB:
org.hibernate.Session.get(Class clazz, Serializable id).
After getting the data, BoConverter converts the data to a BinaryObject and
then put into Ignite.


What do you mean by "is the class present on all nodes"?
if I have a server node which has config like below, then I want to have a
client node to connect to it, do i need to add cacheStore config to client
node config too? can you show me what a suggested client node config should
look like under this situation? Thanks~

<bean id="igniteConfig"
class="org.apache.ignite.configuration.IgniteConfiguration">
	<property name="peerClassLoadingEnabled" value="false" />
	<property name="clientMode" value="false" />
	<property name="gridLogger">
		<bean class="org.apache.ignite.logger.slf4j.Slf4jLogger" />
	</property>
	<property name="cacheConfiguration">
		<list>
			<ref bean="cache1" />
		</list>
	</property>
</bean>

<bean id="cache1"
class="org.apache.ignite.configuration.CacheConfiguration">
	<property name="name" value="igniteTestCache" />
	<property name="cacheMode" value="PARTITIONED" />
	<property name="backups" value="0" />
	<property name="atomicityMode" value="ATOMIC" />
	<property name="statisticsEnabled" value="true" />
	<property name="managementEnabled" value="true" />
	<property name="readThrough" value="true" />
	<property name="writeThrough" value="true" />
	<property name="storeKeepBinary" value="true" />
	<property name="cacheStoreFactory">
		<bean class="com.pingan.pilot.cache.impl.ignite.PIgniteCacheStoreFactory">
			<property name="converter" ref="boConverter" />
			<property name="valueClass">
				<bean class="java.lang.Class" factory-method="forName">
					<constructor-arg
						value="com.pingan.pilot.ignite.test.bo.otw.IgniteTestBO_OTW" />
				</bean>
			</property>
		</bean>
	</property>
	<property name="queryEntities">
		<list>
			<bean class="org.apache.ignite.cache.QueryEntity">
				<property name="keyType" value="java.lang.String" />
				<property name="valueType" value="IPIgniteTestBOImmutable" />
				<property name="fields">
					<map>
						<entry key="intf" value="java.lang.Integer" />
						<entry key="longf" value="java.lang.Long" />
						<entry key="doublef" value="java.lang.Double" />
						<entry key="stringf" value="java.lang.String" />
						<entry key="floatf" value="java.lang.Float" />
						<entry key="bo" value="java.util.Array" />
					</map>
				</property>
				<property name="indexes">
					<list>
						<bean class="org.apache.ignite.cache.QueryIndex">
							<constructor-arg value="intf" />
						</bean>
						<bean class="org.apache.ignite.cache.QueryIndex">
							<constructor-arg value="longf" />
						</bean>
						<bean class="org.apache.ignite.cache.QueryIndex">
							<constructor-arg value="doublef" />
						</bean>
						<bean class="org.apache.ignite.cache.QueryIndex">
							<constructor-arg value="stringf" />
						</bean>
						<bean class="org.apache.ignite.cache.QueryIndex">
							<constructor-arg value="floatf" />
						</bean>
					</list>
				</property>
			</bean>
		</list>
	</property>
</bean>




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: when client node connect to server node, server node throws NotSerializableException

Posted by Andrey Mashenkov <an...@gmail.com>.
Hi Jeff,

CacheStore class should be in classpath on all nodes including clients.


1 нояб. 2017 г. 4:52 пользователь "Jeff Jiao" <je...@gmail.com>
написал:

> Hi Andrew,
>
> Thanks a lot for all the replies.
>
> yes BoConverter implements Serializable, or Ignite will throw
> NotSerializableException.
> The "Class" here is actually for hibernate to get data from DB:
> org.hibernate.Session.get(Class clazz, Serializable id).
> After getting the data, BoConverter converts the data to a BinaryObject and
> then put into Ignite.
>
>
> What do you mean by "is the class present on all nodes"?
> if I have a server node which has config like below, then I want to have a
> client node to connect to it, do i need to add cacheStore config to client
> node config too? can you show me what a suggested client node config should
> look like under this situation? Thanks~
>
> <bean id="igniteConfig"
> class="org.apache.ignite.configuration.IgniteConfiguration">
>         <property name="peerClassLoadingEnabled" value="false" />
>         <property name="clientMode" value="false" />
>         <property name="gridLogger">
>                 <bean class="org.apache.ignite.logger.slf4j.Slf4jLogger"
> />
>         </property>
>         <property name="cacheConfiguration">
>                 <list>
>                         <ref bean="cache1" />
>                 </list>
>         </property>
> </bean>
>
> <bean id="cache1"
> class="org.apache.ignite.configuration.CacheConfiguration">
>         <property name="name" value="igniteTestCache" />
>         <property name="cacheMode" value="PARTITIONED" />
>         <property name="backups" value="0" />
>         <property name="atomicityMode" value="ATOMIC" />
>         <property name="statisticsEnabled" value="true" />
>         <property name="managementEnabled" value="true" />
>         <property name="readThrough" value="true" />
>         <property name="writeThrough" value="true" />
>         <property name="storeKeepBinary" value="true" />
>         <property name="cacheStoreFactory">
>                 <bean class="com.pingan.pilot.cache.impl.ignite.
> PIgniteCacheStoreFactory">
>                         <property name="converter" ref="boConverter" />
>                         <property name="valueClass">
>                                 <bean class="java.lang.Class"
> factory-method="forName">
>                                         <constructor-arg
>                                                 value="com.pingan.pilot.
> ignite.test.bo.otw.IgniteTestBO_OTW" />
>                                 </bean>
>                         </property>
>                 </bean>
>         </property>
>         <property name="queryEntities">
>                 <list>
>                         <bean class="org.apache.ignite.cache.QueryEntity">
>                                 <property name="keyType"
> value="java.lang.String" />
>                                 <property name="valueType" value="IPIgniteTestBOImmutable"
> />
>                                 <property name="fields">
>                                         <map>
>                                                 <entry key="intf"
> value="java.lang.Integer" />
>                                                 <entry key="longf"
> value="java.lang.Long" />
>                                                 <entry key="doublef"
> value="java.lang.Double" />
>                                                 <entry key="stringf"
> value="java.lang.String" />
>                                                 <entry key="floatf"
> value="java.lang.Float" />
>                                                 <entry key="bo"
> value="java.util.Array" />
>                                         </map>
>                                 </property>
>                                 <property name="indexes">
>                                         <list>
>                                                 <bean
> class="org.apache.ignite.cache.QueryIndex">
>                                                         <constructor-arg
> value="intf" />
>                                                 </bean>
>                                                 <bean
> class="org.apache.ignite.cache.QueryIndex">
>                                                         <constructor-arg
> value="longf" />
>                                                 </bean>
>                                                 <bean
> class="org.apache.ignite.cache.QueryIndex">
>                                                         <constructor-arg
> value="doublef" />
>                                                 </bean>
>                                                 <bean
> class="org.apache.ignite.cache.QueryIndex">
>                                                         <constructor-arg
> value="stringf" />
>                                                 </bean>
>                                                 <bean
> class="org.apache.ignite.cache.QueryIndex">
>                                                         <constructor-arg
> value="floatf" />
>                                                 </bean>
>                                         </list>
>                                 </property>
>                         </bean>
>                 </list>
>         </property>
> </bean>
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>