Ignite client needs explicit CacheConfiguration for first time for GetCache

classic Classic list List threaded Threaded
8 messages Options
mrinalkamboj mrinalkamboj
Reply | Threaded
Open this post in threaded view
|

Ignite client needs explicit CacheConfiguration for first time for GetCache

On Apache Ignite server, I have explicitly set up the Cache Configuration as follows:

<cacheConfiguration>
      <cacheConfiguration name="OrderCache" cacheMode="Replicated" startSize="104857600">
        <queryEntities>
          <queryEntity keyType="System.Int32" valueType="OrderEntity,ApacheIgnite" />
        </queryEntities>
      </cacheConfiguration>
    </cacheConfiguration>

Client is run with the setting -  Ignition.ClientMode = true;

Following call on client - var orderCache = ignite.GetCache<int, OrderEntity>("OrderCache");

fails with following exception - System.ArgumentException: Cache doesn't exist: OrderCache

To make it successful, I have to add the similar configuration to the client configuration for the first time and second time onward it can be removed and the client runs without an issue.
If server is switched off, then again client will fail until and unless the same process (mentioned above) is repeated. is this a bug or there's any workaround available.
vdpyatkov vdpyatkov
Reply | Threaded
Open this post in threaded view
|

Re: Ignite client needs explicit CacheConfiguration for first time for GetCache

Hello,

You set Spring attribute name (in this name="OrderCache"), it not relativ to bean property. The attribute name using in Spring xml for bean reference creation.

You need set property like this:
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="OrderCache"/><property name="cacheMode" value="PARTITIONED"/>
   <property name="cacheMode" value="PARTITIONED"/>

On Tue, Jun 21, 2016 at 10:08 AM, mrinalkamboj <[hidden email]> wrote:
On Apache Ignite server, I have explicitly set up the Cache Configuration as
follows:

<cacheConfiguration>
      <cacheConfiguration name="OrderCache" cacheMode="Replicated"
startSize="104857600">
        <queryEntities>
          <queryEntity keyType="System.Int32"
valueType="OrderEntity,ApacheIgnite" />
        </queryEntities>
      </cacheConfiguration>
    </cacheConfiguration>

Client is run with the setting -  Ignition.ClientMode = true;

Following call on client - *var orderCache = ignite.GetCache<int,
OrderEntity>("OrderCache");*

fails with following exception - *System.ArgumentException: Cache doesn't
exist: OrderCache*

To make it successful, I have to add the similar configuration to the client
configuration for the first time and second time onward it can be removed
and the client runs without an issue.
If server is switched off, then again client will fail until and unless the
same process (mentioned above) is repeated. is this a bug or there's any
workaround available.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Ignite-client-needs-explicit-CacheConfiguration-for-first-time-for-GetCache-tp5768.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.



--
Vladislav Pyatkov
mrinalkamboj mrinalkamboj
Reply | Threaded
Open this post in threaded view
|

Re: Ignite client needs explicit CacheConfiguration for first time for GetCache

Hello,

This is .Net code not Java, so the configuration is different, that's why you are not seeing those details.
This configuration is correct it has no issue

thanks,

Mrinal
Pavel Tupitsyn Pavel Tupitsyn
Reply | Threaded
Open this post in threaded view
|

Re: Ignite client needs explicit CacheConfiguration for first time for GetCache

Hi, 

Can you please attach a solution which reproduces the issue?
I have tried your scenario, starting client and server nodes in different order, and GetCache always works.

Pavel.

On Tue, Jun 21, 2016 at 2:18 PM, mrinalkamboj <[hidden email]> wrote:
Hello,

This is .Net code not Java, so the configuration is different, that's why
you are not seeing those details.
This configuration is correct it has no issue

thanks,

Mrinal



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Ignite-client-needs-explicit-CacheConfiguration-for-first-time-for-GetCache-tp5768p5772.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

mrinalkamboj mrinalkamboj
Reply | Threaded
Open this post in threaded view
|

Re: Ignite client needs explicit CacheConfiguration for first time for GetCache

This post was updated on .
Program.cs
App.config
OrderEntity.cs
OrderHelper.cs
Apache.config

I am adding set of files for reproducing the issue.

Here the "Apache.Ignite.exe.config" is the server config file, rest all the files belong to client, so need to be added to the Visual Studio solution.

Reproduction steps:

1. Start server from dotnet\bin folder
2. Start client from visual studio and it should reproduce the exception

To avoid exception enable the CacheConfiguration setting in the app.config and once client has started, stop it, comment out the CacheConfiguration setting and restart, it will always be successful.

Please let me know if any more detail is required.
Pavel Tupitsyn Pavel Tupitsyn
Reply | Threaded
Open this post in threaded view
|

Re: Ignite client needs explicit CacheConfiguration for first time for GetCache

Looks like you run Apache.Ignite.exe and expect IgniteConfigurationSection to be picked up by default.
Currently, this is not the case. We are going to support this in the next version.
In 1.6.0, IgniteConfigurationSection can only be used from Ignition.StartFromApplicationConfiguration method.

For now, your options are:
1) Compile the server yourself. This would be a one-line program:
Ignition.StartFromApplicationConfiguration();

2) Use Spring XML with Apache.Ignite.exe -springConfigUrl
I've translated your Apache.Ignite.exe.config to the Spring XML format, see attachment.

Pavel.

On Tue, Jun 21, 2016 at 2:58 PM, mrinalkamboj <[hidden email]> wrote:
Program.cs
<http://apache-ignite-users.70518.x6.nabble.com/file/n5774/Program.cs>
App.config
<http://apache-ignite-users.70518.x6.nabble.com/file/n5774/App.config>
OrderEntity.cs
<http://apache-ignite-users.70518.x6.nabble.com/file/n5774/OrderEntity.cs>
OrderHelper.cs
<http://apache-ignite-users.70518.x6.nabble.com/file/n5774/OrderHelper.cs>
Apache.config
<http://apache-ignite-users.70518.x6.nabble.com/file/n5774/Apache.config>

I am adding set of files for reproducing the issue.

Here the "Apache.Ignite.exe.config" is the server config file, rest all the
files belong to client, so need to be added to the Visual Studio solution.

Reproduction steps:

1. Start server from dotnet\bin folder
2. Start client from visual studio and it should reproduce the exception

To avoid exception enable the CacheConfiguration setting in the app.config
and once client has started, stop it, comment out the CacheConfiguration
setting and restart, it will always be successful.

Please let me know if any more detail is required.




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Ignite-client-needs-explicit-CacheConfiguration-for-first-time-for-GetCache-tp5768p5774.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


spring.xml (5K) Download Attachment
mrinalkamboj mrinalkamboj
Reply | Threaded
Open this post in threaded view
|

Re: Ignite client needs explicit CacheConfiguration for first time for GetCache

Hello Pavel,

Thanks for the options provided.

For the first one - "Compile the server yourself. This would be a one-line program", shall I just add that to an exe and then block using Console.Read()

For the second one - Is there a tool to convert  dotnet exe config to Sprint XML or does that need to be done manually

thanks,

Mrinal
Pavel Tupitsyn Pavel Tupitsyn
Reply | Threaded
Open this post in threaded view
|

Re: Ignite client needs explicit CacheConfiguration for first time for GetCache

> shall I just add that to an exe and then block using Console.Read()
Yes, this should work

 Is there a tool to convert dotnet exe config to Sprint XML or does that need to be done manually
There is no such tool. However, you can try console.gridgain.com, which provides a web UI to generate Spring XML.

Pavel.

On Tue, Jun 21, 2016 at 4:32 PM, mrinalkamboj <[hidden email]> wrote:
Hello Pavel,

Thanks for the options provided.

For the first one - "Compile the server yourself. This would be a one-line
program", shall I just add that to an exe and then block using
Console.Read()

For the second one - Is there a tool to convert  dotnet exe config to Sprint
XML or does that need to be done manually

thanks,

Mrinal



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Ignite-client-needs-explicit-CacheConfiguration-for-first-time-for-GetCache-tp5768p5776.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.