Hi Ranbir,
The exception you get should be caused by the fact that the bean factory
is serialized/deserialized unintentionally.
This can happen in different cases:
- bean factory instance is a non transient field of some object that is
serialized according to your logic;
- serialization of an anonymous or inner class happens. This will
trigger serialization of enclosing/outer class and if the bean factory
is a non transient field of such a class it will be serialized as well.
Please make check the point above on your side.
Is the issue reproduced locally? If my suggestions don't help please
share an example that can be launched on my side.
BTW, just to let you know, you can use SpringApplicationContextResource
annotation for cases when you need to get an instance of some Spring
bean on a remote node.
--
Denis
On 11/29/2015 5:08 PM, Ranbir Chawla wrote:
Here is the config passed to the ‘server’ nodes
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean
class="org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinder">
<property name="awsCredentials" ref="aws.creds"/>
<property name="clientConfiguration" ref="aws.conf"/>
<property name="bucketName" value="asci-ignite-dev"/>
</bean>
</property>
<property name="localAddress" value="LOCALIP"/>
</bean>
</property>
<property name="peerClassLoadingEnabled" value="false"/>
</bean>
<bean id="aws.conf" class="com.amazonaws.ClientConfiguration">
<property name="proxyHost" value="dc1-utility01.dc01.revsci.net"/>
<property name="proxyPort" value="3128"/>
</bean>
<!-- AWS credentials. Provide your access key ID and secret access key. -->
<bean id="aws.creds" class="com.amazonaws.auth.BasicAWSCredentials">
<constructor-arg value=“obfuscated-key-val" />
<constructor-arg value="/9RMACVMY7PDNliPxLqpbEJfRO/KyVIlqRHerYZZ" />
</bean>
</beans>
Here are the classes used to perform the Java based config within the client
// uses this proxy mode because the CacheStore needs to be serializable
@Bean
@Scope(proxyMode = ScopedProxyMode.TARGET_CLASS)
IgniteCacheStore igniteCacheStore() {
return new IgniteCacheStore();
}
@Bean
public TSDBCacheConfiguration tsdbCacheConfiguration() {
return new TSDBCacheConfiguration(igniteCacheStore());
}
@Bean
IgniteCache<String, String> igniteCache() {
ClientConfiguration clientConfiguration = new ClientConfiguration();
clientConfiguration.setProxyHost("dc1-utility01.dc01.revsci.net");
clientConfiguration.setProxyPort(3128);
com.amazonaws.auth.BasicAWSCredentials awsCredentials = new
com.amazonaws.auth.BasicAWSCredentials(“obfuscated-key-val","/9RMACVMY7PDNliPxLqpbEJfRO/KyVIlqRHerYZZ”);
org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinder
ipFinder = new
org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinder();
ipFinder.setAwsCredentials(awsCredentials);
ipFinder.setBucketName("asci-ignite-dev");
ipFinder.setClientConfiguration(clientConfiguration);
org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi tcpDiscoverySpi = new
org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi();
tcpDiscoverySpi.setIpFinder(ipFinder);
TSDBCacheConfiguration tsdbCacheConfiguration = tsdbCacheConfiguration();
IgniteConfiguration igniteConfiguration =
tsdbCacheConfiguration.getIgniteConfiguration();
igniteConfiguration.setClientMode(true);
igniteConfiguration.setDiscoverySpi(tcpDiscoverySpi);
CacheConfiguration cfg = tsdbCacheConfiguration.getCfg();
cfg.setName("myCache");
Ignite ignite = Ignition.start(igniteConfiguration);
Ignition.setClientMode(true);
// Create cache with given name, if it does not exist.
IgniteCache<String, String> cache = ignite.getOrCreateCache(cfg);
return cache;
}
The TSDBCacheConfiguration is used in the core library to allow us to test the
IgniteCacheStore so we reused it in the above config
public class TSDBCacheConfiguration {
private CacheConfiguration cfg;
//must be set the consuming application
// @Autowired
// TcpDiscoverySpi tcpDiscoverySpi;
private IgniteConfiguration igniteConfiguration;
public TSDBCacheConfiguration(IgniteCacheStore igniteCacheStore) {
cfg = new org.apache.ignite.configuration.CacheConfiguration();
cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
cfg.setBackups(1);
cfg.setCacheStoreFactory(new
FactoryBuilder.SingletonFactory<>(igniteCacheStore));
cfg.setReadThrough(true);
cfg.setWriteThrough(true);
igniteConfiguration = new IgniteConfiguration();
igniteConfiguration.setCacheConfiguration(cfg);
}
/**
* without write behind persistence store
*/
public TSDBCacheConfiguration() {
cfg = new org.apache.ignite.configuration.CacheConfiguration();
cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
cfg.setBackups(1);
igniteConfiguration = new IgniteConfiguration();
igniteConfiguration.setCacheConfiguration(cfg);
}
public IgniteConfiguration getIgniteConfiguration() {
return igniteConfiguration;
}
public void setIgniteConfiguration(IgniteConfiguration
igniteConfiguration) {
this.igniteConfiguration = igniteConfiguration;
}
public CacheConfiguration getCfg() {
return cfg;
}
public void setCfg(CacheConfiguration cfg) {
this.cfg = cfg;
}
}
Ranbir Chawla | V.P. Engineering
C: (303) 868-7797
F: (425) 328-1221
[email protected] <mailto:[email protected]>
www.AudienceScience.com <http://www.audiencescience.com/>
1120 112th Avenue NE, Suite 400
Bellevue, WA 98004
<http://twitter.com/@audiencescience> <http://www.facebook.com/AudienceScience>
<http://www.linkedin.com/companies/236049>
<http://www.linkedin.com/companies/236049>
On 11/29/15, 1:08 AM, "vkulichenko" <[email protected]> wrote:
Hi,
Can you please attach your cache configuration? It will be easier to tell
the reason of the error if we have it.
-Val
--
View this message in context:
http://apache-ignite-users.70518.x6.nabble.com/Cannot-connect-client-to-new-Data-Grid-newbie-question-tp2080p2083.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
--
Regards,
Denis Magda
Lead Professional Services Engineer, GridGain Systems
http://www.gridgain.com/