데이터베이스에 asyn 데이터를 쓰도록 CacheStore를 구현 중입니다. 응용 프로그램 내부에서 Ignite를 "서버"로 실행하면서 데이터가 데이터베이스에 저장되는 동안 코드가 올바르게 작동합니다.서버 측에서 CacheStore 구현이 ClassNotFoundException을 발생 시킴
문제가있는 시나리오 : 원격 노드를 "클라이언트"로 서버 및 응용 프로그램으로 실행 중일 때 클라이언트 노드가 이미 시작된 동안 서버 노드가 ClassNotFoundException을 throw합니다.
서버
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="metricsLogFrequency" value="0"/>
<property name="peerClassLoadingEnabled" value="true"/>
<property name="marshaller">
<bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller">
<!-- Set to false to allow non-serializable objects in examples, default is true. -->
<property name="requireSerializable" value="false"/>
</bean>
</property>
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.zk.TcpDiscoveryZookeeperIpFinder">
<property name="zkConnectionString" value="localhost:2181"/>
</bean>
</property>
</bean>
</property>
</bean>
클라이언트 : : 이제
CacheConfiguration cacheConfiguration = new CacheConfiguration();
cacheConfiguration.setName(name);
cacheConfiguration.setBackups(backup);
cacheConfiguration.setRebalanceMode(CacheRebalanceMode.SYNC);
cacheConfiguration.setCacheMode(CacheMode.PARTITIONED);
LruEvictionPolicy evictionPolicy = new LruEvictionPolicy();
evictionPolicy.setMaxSize(maxEntries);
cacheConfiguration.setEvictionPolicy(evictionPolicy);
cacheConfiguration.setEvictSynchronized(true);
cacheConfiguration.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(duration));
cacheConfiguration.setStartSize(100*1024*1024);
cacheConfiguration.setReadThrough(true);
cacheConfiguration.setWriteThrough(true);
cacheConfiguration.setWriteBehindEnabled(true);
cacheConfiguration.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
cacheConfiguration.setCacheStoreFactory(new FactoryBuilder.SingletonFactory<CacheStore>(cacheStore));
IgniteConfiguration igniteConfiguration = new IgniteConfiguration();
igniteConfiguration.setPeerClassLoadingEnabled(true);
TcpDiscoverySpi tcpDiscoverySpi = new TcpDiscoverySpi();
TcpDiscoveryZookeeperIpFinder ipFinder = new TcpDiscoveryZookeeperIpFinder();
ipFinder.setZkConnectionString(zookeeperConString);
tcpDiscoverySpi.setIpFinder(ipFinder);
OptimizedMarshaller marshaller = new OptimizedMarshaller();
marshaller.setRequireSerializable(false);
igniteConfiguration.
setCacheConfiguration(cacheConfiguration).
setClientMode(isClient);
igniteConfiguration.setDiscoverySpi(tcpDiscoverySpi);
igniteConfiguration.setMarshaller(marshaller).
setGridName(gridName).
setMetricsLogFrequency(0);
SpringCacheManager springCacheManager = new SpringCacheManager();
springCacheManager.setConfiguration(igniteConfiguration);
, 나는 내가 peerclassloading를 활성화하므로 서버 노드에 CacheStore을 배포 할 해달라고 다음
내 구성입니다. 하지만 동일한 예외가 발생하여 인터넷에서 확인하고 트랜잭션에 대한 atomicitymode를 변경하여 클라이언트의 CacheStore가 매번 사용됩니다. 하지만 여전히 같은 문제에 직면 해 있습니다.
코드에서 OptimizedMarshaller를 사용하고 있지만 BinaryMarshaller와 BinaryMarshaller도 있습니다. 서버 노드에 유형이 필요하지 않습니다. – kuaw26