You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by "ranbir.chawla" <ra...@audiencescience.com> on 2015/11/29 04:34:59 UTC

Cannot connect client to new Data Grid - newbie question

I have data grid with between 1 to 4 nodes with AWS S3 discovery working as
far as I can tell (the nodes register the topology in the logs).

I have Spring Boot app that attempts to create a ignite cache client for a
simple <String, String> cache. I have the client use the same config params
as the servers, just using Java config vs. xml - pointing to the same s3
bucket.

When I startup the app hangs and I see this stack trace in the server node
logs - what am I missing. I've gone over all the code but I'm not sure why
it's trying to serialize a whole bean factory. Should I be creating the
cache client outside of the spring context as a pure Singleton somewhere?


[03:37:23] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4,
heap=1.0GB]
[03:38:59,342][ERROR][tcp-disco-msg-worker-#2%null][TcpDiscoverySpi] Runtime
error caught during grid runnable execution: IgniteSpiThread
[name=tcp-disco-msg-worker-#2%null]
java.lang.IllegalStateException: Cannot deserialize BeanFactory with id
application: no factory registered for this id
	at
org.springframework.beans.factory.support.DefaultListableBeanFactory$SerializedBeanFactoryReference.readResolve(DefaultListableBeanFactory.java:1316)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1104)
	at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1810)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)
	at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)
	at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)
	at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
	at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1707)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1345)
	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
	at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:501)
	at
org.springframework.aop.framework.AdvisedSupport.readObject(AdvisedSupport.java:557)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896)
	at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)
	at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)
	at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)
	at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)
	at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)
	at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
	at java.util.ArrayList.readObject(ArrayList.java:791)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896)
	at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)
	at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
	at
org.apache.ignite.marshaller.jdk.JdkMarshaller.unmarshal(JdkMarshaller.java:102)
	at
org.apache.ignite.marshaller.AbstractMarshaller.unmarshal(AbstractMarshaller.java:68)
	at
org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.onExchange(TcpDiscoverySpi.java:1697)
	at
org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.processNodeAddedMessage(ServerImpl.java:3310)
	at
org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.processJoinRequestMessage(ServerImpl.java:3002)
	at
org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.processMessage(ServerImpl.java:2095)
	at
org.apache.ignite.spi.discovery.tcp.ServerImpl$MessageWorkerAdapter.body(ServerImpl.java:5382)
	at org.apache.ignite.spi.IgniteSpiThread.run(IgniteSpiThread.java:62)






--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Cannot-connect-client-to-new-Data-Grid-newbie-question-tp2080.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Cannot connect client to new Data Grid - newbie question

Posted by Denis Magda <dm...@gridgain.com>.
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
> Ranbir.chawla@AudienceScience.com <ma...@AudienceScience.com>
> www.AudienceScience.com <http://www.audiencescience.com/>
>
>
> 1120 112th Avenue NE, Suite 400
> Bellevue, WA 98004
>   <ht...@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" <va...@gmail.com> 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/


Re: Cannot connect client to new Data Grid - newbie question

Posted by Ranbir Chawla <Ra...@audiencescience.com>.
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
Ranbir.chawla@AudienceScience.com <ma...@AudienceScience.com> 
www.AudienceScience.com <http://www.audiencescience.com/>


1120 112th Avenue NE, Suite 400
Bellevue, WA 98004
 <ht...@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" <va...@gmail.com> 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.

Re: Cannot connect client to new Data Grid - newbie question

Posted by vkulichenko <va...@gmail.com>.
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.