ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vladimir Ozerov <voze...@gridgain.com>
Subject Re: Error running nodes in .net and c++
Date Wed, 20 Apr 2016 08:31:26 GMT
Hi Murthy,

Yes, there will be more examples in further versions. Though, for now it is
impossible to plug C++ based store, and this feature is not planned for 1.6
release. So I do not expect C++ examples with stores in 1.6.
Instead, I'd better to look at Java or .NET examples with store as these
platforms support plugable store implementations.

Vladimir.

On Tue, Apr 19, 2016 at 7:34 PM, Murthy Kakarlamudi <ksatya@gmail.com>
wrote:

> Thanks Vladimir for the explanation. I am working on the workaround
> suggested by Igor. I will reach out to the group if I run into any issues.
>
> One quick question. I am using 1.5 version. I only see 1 c++ example. Are
> there more c++ examples in future versions? Especially around using stores.
>
> Regards
> Satya.
>
> On Tue, Apr 19, 2016 at 9:20 AM, Vladimir Ozerov <vozerov@gridgain.com>
> wrote:
>
>> Hi Murthy,
>>
>> Exception you observed is essentially not a bug, but rather expected
>> behavior with current Ignite architecture. Ignite support transactions.
>> When you initiate a transaction from a client node, only this node has the
>> full set of updated keys, and hence only this node is able to propagate
>> updates to underlying database within a single database transaction. For
>> this reason, Ignite creates and initializes store on every node, even if
>> this node is client.
>>
>> As Igor suggested, the best workaround for now is to rely on Java store
>> because every node (Java, C++, .NET) has a Java inside and hence is able to
>> work with Java-based store. On the other hand, I clearly understand that
>> this architecture doesn't fit well in your use case and is not very
>> convenient from user perspective. We will think about possible ways to
>> resolve it.
>>
>> One very simple solution - do not initialize store if we know for sure
>> that the client will not use it. For example, this is so in case of ATOMIC
>> cache or asynchronous (write-behind) store.
>>
>> Vladimir.
>>
>>
>>
>> On Tue, Apr 19, 2016 at 2:31 PM, Murthy Kakarlamudi <ksatya@gmail.com>
>> wrote:
>>
>>> OK Igor. Let me try from Java.
>>>
>>> From a high level, we have a backend application implemented in c++ and
>>> the front end is asp.net mvc. Data store is SQL Server.
>>>
>>> Use case is, I need to load data from SQL Server into Ignite Cache upon
>>> start up. .Net and C++ acting as clients need to access the cache and
>>> update it. Those updates should be written to the underlying SQL Server in
>>> an asynchronous way so as not to impact the cache performance.  The updates
>>> that gets written from .Net client need to be accessed by C++ client. We
>>> have a need to use SQL Queries to access cache from either of the clients.
>>>
>>> I can start the cache from Java server node. However, as .net and c++
>>> are being used in our application, we prefer sticking to those 2 and not
>>> introduce Java.
>>>
>>> Thanks,
>>> Satya.
>>>
>>> On Tue, Apr 19, 2016 at 6:30 AM, Igor Sapego <isapego@gridgain.com>
>>> wrote:
>>>
>>>> Right now I can see the following workaround for you: you can switch
>>>> from .Net CacheStoreFactory to Java's one. This way all types of clients
>>>> will be able to instantiate your cache.
>>>>
>>>> If you are willing to you can describe your use-case so we can
>>>> try and find some other solution if this workaround is not suitable
>>>> for you.
>>>>
>>>> Best Regards,
>>>> Igor
>>>>
>>>> On Tue, Apr 19, 2016 at 1:06 PM, Murthy Kakarlamudi <ksatya@gmail.com>
>>>> wrote:
>>>>
>>>>> Thank You.
>>>>> On Apr 19, 2016 6:01 AM, "Igor Sapego" <isapego@gridgain.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> It looks like a bug for me. I've submitted an issue for it - [1].
>>>>>>
>>>>>> [1] - https://issues.apache.org/jira/browse/IGNITE-3025.
>>>>>>
>>>>>> Best Regards,
>>>>>> Igor
>>>>>>
>>>>>> On Mon, Apr 18, 2016 at 1:35 AM, Murthy Kakarlamudi <ksatya@gmail.com
>>>>>> > wrote:
>>>>>>
>>>>>>> The client node itself starts after making the change, but getting
>>>>>>> the below error trying to access the cache:
>>>>>>>
>>>>>>> [12:16:45] Topology snapshot [ver=2, servers=1, clients=1, CPUs=4,
>>>>>>> heap=1.4GB]
>>>>>>>
>>>>>>> >>> Cache node started.
>>>>>>>
>>>>>>> [12:16:45,439][SEVERE][exchange-worker-#38%null%][GridDhtPartitionsExchangeFuture]
>>>>>>> Failed to reinitialize local partitions (preloading will be stopped):
>>>>>>> GridDhtPartitionExchangeId [topVer=AffinityTopologyVersion [topVer=2,
>>>>>>> minorTopVer=1], nodeId=2bf10735, evt=DISCOVERY_CUSTOM_EVT]
>>>>>>> PlatformNoCallbackException []
>>>>>>>         at
>>>>>>> org.apache.ignite.internal.processors.platform.callback.PlatformCallbackUtils.cacheStoreCreate(Native
>>>>>>> Method)
>>>>>>>         at
>>>>>>> org.apache.ignite.internal.processors.platform.callback.PlatformCallbackGateway.cacheStoreCreate(PlatformCallbackGateway.java:63)
>>>>>>>         at
>>>>>>> org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore.initialize(PlatformDotNetCacheStore.java:338)
>>>>>>>         at
>>>>>>> org.apache.ignite.internal.processors.platform.PlatformProcessorImpl.registerStore0(PlatformProcessorImpl.java:347)
>>>>>>>         at
>>>>>>> org.apache.ignite.internal.processors.platform.PlatformProcessorImpl.registerStore(PlatformProcessorImpl.java:317)
>>>>>>>         at
>>>>>>> org.apache.ignite.internal.processors.cache.store.CacheOsStoreManager.start0(CacheOsStoreManager.java:60)
>>>>>>>         at
>>>>>>> org.apache.ignite.internal.processors.cache.GridCacheManagerAdapter.start(GridCacheManagerAdapter.java:50)
>>>>>>>         at
>>>>>>> org.apache.ignite.internal.processors.cache.GridCacheProcessor.startCache(GridCacheProcessor.java:1051)
>>>>>>>         at
>>>>>>> org.apache.ignite.internal.processors.cache.GridCacheProcessor.prepareCacheStart(GridCacheProcessor.java:1648)
>>>>>>>         at
>>>>>>> org.apache.ignite.internal.processors.cache.GridCacheProcessor.prepareCachesStart(GridCacheProcessor.java:1563)
>>>>>>>         at
>>>>>>> org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.startCaches(GridDhtPartitionsExchangeFuture.java:956)
>>>>>>>         at
>>>>>>> org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.init(GridDhtPartitionsExchangeFuture.java:523)
>>>>>>>
>>>>>>> On Sun, Apr 17, 2016 at 10:49 AM, Pavel Tupitsyn <
>>>>>>> ptupitsyn@gridgain.com> wrote:
>>>>>>>
>>>>>>>> This exception appears due to the fact that .NET store can't
be
>>>>>>>> initialized on C++ node.
>>>>>>>>
>>>>>>>> Add the following line to C++ config to run the node in client
>>>>>>>> mode, so it does not store cache data and initialize cache
store:
>>>>>>>> <property name="clientMode" value="true"/>
>>>>>>>>
>>>>>>>> Let me know if this helps.
>>>>>>>>
>>>>>>>> Pavel.
>>>>>>>>
>>>>>>>> On Sun, Apr 17, 2016 at 2:35 PM, Murthy Kakarlamudi <
>>>>>>>> ksatya@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hi Pavel...such an obvious thing that I missed. I was
always
>>>>>>>>> looking at the .net node config as the error said remote
node. Thanks for
>>>>>>>>> pointing it out. I am now getting a different error.
I do have a question.
>>>>>>>>> As I mentioned node that gets started from .net acts
as server node and
>>>>>>>>> loads the database into cache. So its config has all
the CacheStore
>>>>>>>>> relation information. In my c++ node, acting as a client,
what should go in
>>>>>>>>> its config? As it does not access DB, I assumed CacheStore
related
>>>>>>>>> information is not needed in its config. So I am not
sure what should go
>>>>>>>>> into my c++ config. If I do have to have the CacheStore
info in the c++
>>>>>>>>> client node, Is there a c++ cachestore implementation
example?
>>>>>>>>>
>>>>>>>>> Below is the error I am getting:
>>>>>>>>> [07:18:03,292][SEVERE][main][IgniteKernal] Got exception
while
>>>>>>>>> starting (will rollback startup routine).
>>>>>>>>> PlatformNoCallbackException []
>>>>>>>>>         at
>>>>>>>>> org.apache.ignite.internal.processors.platform.callback.PlatformCallbackUtils.cacheStoreCreate(Native
>>>>>>>>> Method)
>>>>>>>>>         at
>>>>>>>>> org.apache.ignite.internal.processors.platform.callback.PlatformCallbackGateway.cacheStoreCreate(PlatformCallbackGateway.java:63)
>>>>>>>>>         at
>>>>>>>>> org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore.initialize(PlatformDotNetCacheStore.java:338)
>>>>>>>>>         at
>>>>>>>>> org.apache.ignite.internal.processors.platform.PlatformProcessorImpl.registerStore0(PlatformProcessorImpl.java:347)
>>>>>>>>>         at
>>>>>>>>> org.apache.ignite.internal.processors.platform.PlatformProcessorImpl.registerStore(PlatformProcessorImpl.java:317)
>>>>>>>>>         at
>>>>>>>>> org.apache.ignite.internal.processors.cache.store.CacheOsStoreManager.start0(CacheOsStoreManager.java:60)
>>>>>>>>>         at
>>>>>>>>> org.apache.ignite.internal.processors.cache.GridCacheManagerAdapter.start(GridCacheManagerAdapter.java:50)
>>>>>>>>>         at
>>>>>>>>> org.apache.ignite.internal.processors.cache.GridCacheProcessor.startCache(GridCacheProcessor.java:1051)
>>>>>>>>>         at
>>>>>>>>> org.apache.ignite.internal.processors.cache.GridCacheProcessor.onKernalStart(GridCacheProcessor.java:787)
>>>>>>>>>         at
>>>>>>>>> org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:946)
>>>>>>>>>         at
>>>>>>>>> org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:1688)
>>>>>>>>>         at
>>>>>>>>> org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1547)
>>>>>>>>>         at
>>>>>>>>> org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1003)
>>>>>>>>>         at
>>>>>>>>> org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:534)
>>>>>>>>>         at
>>>>>>>>> org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:515)
>>>>>>>>>         at org.apache.ignite.Ignition.start(Ignition.java:322)
>>>>>>>>>         at
>>>>>>>>> org.apache.ignite.internal.processors.platform.PlatformAbstractBootstrap.start(PlatformAbstractBootstrap.java:36)
>>>>>>>>>         at
>>>>>>>>> org.apache.ignite.internal.processors.platform.PlatformIgnition.start(PlatformIgnition.java:72)
>>>>>>>>> [07:18:03] Ignite node stopped OK [uptime=00:00:08:267]
>>>>>>>>> An error occurred: Callback handler is not set in native
platform.
>>>>>>>>>
>>>>>>>>> On Sun, Apr 17, 2016 at 4:15 AM, Pavel Tupitsyn <
>>>>>>>>> ptupitsyn@gridgain.com> wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> > Remote node has peer class loading enabled flag
different from
>>>>>>>>>> local
>>>>>>>>>> As the error message says, peerClassLoading flag
has to be the
>>>>>>>>>> same on all nodes.
>>>>>>>>>>
>>>>>>>>>> Please remove the following line from your C++ config:
>>>>>>>>>> <property name="peerClassLoadingEnabled" value="true"/>
>>>>>>>>>>
>>>>>>>>>> Pavel.
>>>>>>>>>>
>>>>>>>>>> On Sun, Apr 17, 2016 at 2:29 AM, Murthy Kakarlamudi
<
>>>>>>>>>> ksatya@gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>    In my use case, I am starting a node from
.net which loads
>>>>>>>>>>> data from SQL Server table into cache upon start
up. I have to read those
>>>>>>>>>>> entries from cache from a c++ node that acts
as a client. I am getting the
>>>>>>>>>>> below error trying to start the node from c++.
>>>>>>>>>>>
>>>>>>>>>>> [19:08:57] Security status [authentication=off,
tls/ssl=off]
>>>>>>>>>>> [19:08:58,163][SEVERE][main][IgniteKernal] Failed
to start
>>>>>>>>>>> manager: GridManagerAdapter [enabled=true,
>>>>>>>>>>> name=o.a.i.i.managers.discovery.GridDiscoveryManager]
>>>>>>>>>>> class org.apache.ignite.IgniteCheckedException:
Remote node has
>>>>>>>>>>> peer class loading enabled flag different from
local [locId8=f02445af,
>>>>>>>>>>> locPeerClassLoading=true, rmtId8=8e52f9c9, rmtPeerClassLoading=false,
>>>>>>>>>>> rmtAddrs=[LAPTOP-QIT4AVOG/0:0:0:0:0:0:0:1, LAPTOP-QIT4AVOG/
>>>>>>>>>>> 127.0.0.1, LAPTOP-QIT4AVOG/192.168.0.5,
>>>>>>>>>>> LAPTOP-QIT4AVOG/2001:0:9d38:90d7:145b:5bf:bb9b:11d9,
>>>>>>>>>>> LAPTOP-QIT4AVOG/2600:8806:0:8d00:0:0:0:1,
>>>>>>>>>>> /2600:8806:0:8d00:3ccf:1e94:1ab4:83a9,
>>>>>>>>>>> /2600:8806:0:8d00:f114:bf30:2068:352d]]
>>>>>>>>>>>         at
>>>>>>>>>>> org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.checkAttributes(GridDiscoveryManager.java:1027)
>>>>>>>>>>>         at
>>>>>>>>>>> org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.start(GridDiscoveryManager.java:680)
>>>>>>>>>>>         at
>>>>>>>>>>> org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1505)
>>>>>>>>>>>         at
>>>>>>>>>>> org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:917)
>>>>>>>>>>>         at
>>>>>>>>>>> org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:1688)
>>>>>>>>>>>         at
>>>>>>>>>>> org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1547)
>>>>>>>>>>>         at
>>>>>>>>>>> org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1003)
>>>>>>>>>>>         at
>>>>>>>>>>> org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:534)
>>>>>>>>>>>         at
>>>>>>>>>>> org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:515)
>>>>>>>>>>>         at org.apache.ignite.Ignition.start(Ignition.java:322)
>>>>>>>>>>>         at
>>>>>>>>>>> org.apache.ignite.internal.processors.platform.PlatformAbstractBootstrap.start(PlatformAbstractBootstrap.java
>>>>>>>>>>>
>>>>>>>>>>> Below if my config for .net node:
>>>>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>>>>>
>>>>>>>>>>> <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 id="ignite.cfg"
>>>>>>>>>>> class="org.apache.ignite.configuration.IgniteConfiguration">
>>>>>>>>>>>     <property name="connectorConfiguration">
>>>>>>>>>>>       <bean
>>>>>>>>>>> class="org.apache.ignite.configuration.ConnectorConfiguration">
>>>>>>>>>>>         <property name="idleTimeout" value="20000"/>
>>>>>>>>>>>       </bean>
>>>>>>>>>>>     </property>
>>>>>>>>>>>
>>>>>>>>>>>     <property name="cacheConfiguration">
>>>>>>>>>>>       <list>
>>>>>>>>>>>         <bean
>>>>>>>>>>> class="org.apache.ignite.configuration.CacheConfiguration">
>>>>>>>>>>>           <property name="name" value="BU"/>
>>>>>>>>>>>           <property name="writeThrough" value="true"/>
>>>>>>>>>>>           <property name="readThrough" value="true"/>
>>>>>>>>>>>           <property name="writeBehindEnabled"
value="true"/>
>>>>>>>>>>>           <property name="writeBehindFlushFrequency"
>>>>>>>>>>> value="120000"/>
>>>>>>>>>>>           <property name="cacheStoreFactory">
>>>>>>>>>>>             <bean
>>>>>>>>>>> class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
>>>>>>>>>>>               <property name="typeName"
>>>>>>>>>>> value="TestIgniteDAL.SQLServerStore, TestIgniteDAL"/>
>>>>>>>>>>>             </bean>
>>>>>>>>>>>           </property>
>>>>>>>>>>>           <property name ="typeMetadata">
>>>>>>>>>>>             <list>
>>>>>>>>>>>               <bean
>>>>>>>>>>> class="org.apache.ignite.cache.CacheTypeMetadata">
>>>>>>>>>>>                 <!-- Type to query. -->
>>>>>>>>>>>                 <property name="valueType"
value="BusinessUnit"/>
>>>>>>>>>>>                 <!-- Fields to be queried.
-->
>>>>>>>>>>>                 <property name="queryFields">
>>>>>>>>>>>                   <map>
>>>>>>>>>>>                     <entry key="BUID" value="java.lang.Integer"/>
>>>>>>>>>>>                     <entry key="BUName"
>>>>>>>>>>> value="java.lang.String"/>
>>>>>>>>>>>                     <entry key="CreatedByID"
>>>>>>>>>>> value="java.lang.Integer"/>
>>>>>>>>>>>                     <entry key="CreatedDate"
>>>>>>>>>>> value="java.util.Date"/>
>>>>>>>>>>>                     <entry key="ModifiedByID"
>>>>>>>>>>> value="java.lang.Integer"/>
>>>>>>>>>>>                     <entry key="ModifiedDate"
>>>>>>>>>>> value="java.util.Date"/>
>>>>>>>>>>>                   </map>
>>>>>>>>>>>                 </property>
>>>>>>>>>>>                 <!-- Fields to index in ascending
order. -->
>>>>>>>>>>>                 <property name="ascendingFields">
>>>>>>>>>>>                   <map>
>>>>>>>>>>>                     <entry key="BUID" value="java.lang.Integer"/>
>>>>>>>>>>>                   </map>
>>>>>>>>>>>                 </property>
>>>>>>>>>>>               </bean>
>>>>>>>>>>>             </list>
>>>>>>>>>>>           </property>
>>>>>>>>>>>         </bean>
>>>>>>>>>>>       </list>
>>>>>>>>>>>     </property>
>>>>>>>>>>>
>>>>>>>>>>>     <property name="communicationSpi">
>>>>>>>>>>>       <bean
>>>>>>>>>>> class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi">
>>>>>>>>>>>         <property name="sharedMemoryPort"
value="-1"/>
>>>>>>>>>>>       </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.vm.TcpDiscoveryVmIpFinder">
>>>>>>>>>>>             <property name="addresses">
>>>>>>>>>>>               <list>
>>>>>>>>>>>                 <value>127.0.0.1:47500..47509</value>
>>>>>>>>>>>               </list>
>>>>>>>>>>>             </property>
>>>>>>>>>>>           </bean>
>>>>>>>>>>>         </property>
>>>>>>>>>>>       </bean>
>>>>>>>>>>>     </property>
>>>>>>>>>>>   </bean>
>>>>>>>>>>> </beans>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Below is my config for node from c++:
>>>>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>>>>>
>>>>>>>>>>> <!--
>>>>>>>>>>>   Licensed to the Apache Software Foundation
(ASF) under one or
>>>>>>>>>>> more
>>>>>>>>>>>   contributor license agreements.  See the NOTICE
file
>>>>>>>>>>> distributed with
>>>>>>>>>>>   this work for additional information regarding
copyright
>>>>>>>>>>> ownership.
>>>>>>>>>>>   The ASF licenses this file to You under the
Apache License,
>>>>>>>>>>> Version 2.0
>>>>>>>>>>>   (the "License"); you may not use this file
except in
>>>>>>>>>>> compliance with
>>>>>>>>>>>   the License.  You may obtain a copy of the
License at
>>>>>>>>>>>
>>>>>>>>>>>        http://www.apache.org/licenses/LICENSE-2.0
>>>>>>>>>>>
>>>>>>>>>>>   Unless required by applicable law or agreed
to in writing,
>>>>>>>>>>> software
>>>>>>>>>>>   distributed under the License is distributed
on an "AS IS"
>>>>>>>>>>> BASIS,
>>>>>>>>>>>   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express
>>>>>>>>>>> or implied.
>>>>>>>>>>>   See the License for the specific language governing
>>>>>>>>>>> permissions and
>>>>>>>>>>>   limitations under the License.
>>>>>>>>>>> -->
>>>>>>>>>>>
>>>>>>>>>>> <beans xmlns="http://www.springframework.org/schema/beans"
>>>>>>>>>>>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>>>>>>>        xmlns:util="http://www.springframework.org/schema/util"
>>>>>>>>>>>        xsi:schemaLocation="
>>>>>>>>>>>         http://www.springframework.org/schema/beans
>>>>>>>>>>>
>>>>>>>>>>> http://www.springframework.org/schema/beans/spring-beans.xsd
>>>>>>>>>>>         http://www.springframework.org/schema/util
>>>>>>>>>>>
>>>>>>>>>>> http://www.springframework.org/schema/util/spring-util.xsd">
>>>>>>>>>>>     <bean id="grid.cfg"
>>>>>>>>>>> class="org.apache.ignite.configuration.IgniteConfiguration">
>>>>>>>>>>>         <!-- Set to true to enable distributed
class loading for
>>>>>>>>>>> examples, default is false. -->
>>>>>>>>>>>         <property name="peerClassLoadingEnabled"
value="true"/>
>>>>>>>>>>>
>>>>>>>>>>>         <property name="cacheConfiguration">
>>>>>>>>>>>             <list>
>>>>>>>>>>>                 <!--
>>>>>>>>>>>                     Partitioned cache example
configuration with
>>>>>>>>>>> binary objects enabled.
>>>>>>>>>>>                     Used in .NET example that
is available only
>>>>>>>>>>> in enterprise edition.
>>>>>>>>>>>                 -->
>>>>>>>>>>>                 <bean
>>>>>>>>>>> class="org.apache.ignite.configuration.CacheConfiguration">
>>>>>>>>>>> <property name="atomicityMode" value="ATOMIC"/>
>>>>>>>>>>>                     <property name="backups"
value="1"/>
>>>>>>>>>>>                 </bean>
>>>>>>>>>>>
>>>>>>>>>>>                 <!--
>>>>>>>>>>>                     Partitioned cache example
configuration.
>>>>>>>>>>>                     Used in .NET cache store
example that is
>>>>>>>>>>> available only in enterprise edition.
>>>>>>>>>>>                 -->
>>>>>>>>>>>                 <bean
>>>>>>>>>>> class="org.apache.ignite.configuration.CacheConfiguration">
>>>>>>>>>>>                     <property name="name"
value="tx"/>
>>>>>>>>>>>                     <property name="atomicityMode"
>>>>>>>>>>> value="TRANSACTIONAL"/>
>>>>>>>>>>>                     <property name="backups"
value="1"/>
>>>>>>>>>>>                 </bean>
>>>>>>>>>>>             </list>
>>>>>>>>>>>         </property>
>>>>>>>>>>>
>>>>>>>>>>>         <!-- Explicitly configure TCP discovery
SPI to provide
>>>>>>>>>>> list of initial nodes. -->
>>>>>>>>>>>         <property name="discoverySpi">
>>>>>>>>>>>             <bean
>>>>>>>>>>> class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
>>>>>>>>>>>                 <property name="ipFinder">
>>>>>>>>>>>                     <!--
>>>>>>>>>>>                         Ignite provides several
options for
>>>>>>>>>>> automatic discovery that can be used
>>>>>>>>>>>                         instead os static IP
based discovery.
>>>>>>>>>>>                     -->
>>>>>>>>>>>                     <!-- Uncomment static
IP finder to enable
>>>>>>>>>>> static-based discovery of initial nodes. -->
>>>>>>>>>>>                     <bean
>>>>>>>>>>> class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
>>>>>>>>>>>                     <!-- <bean
>>>>>>>>>>> class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
>>>>>>>>>>> -->
>>>>>>>>>>>                         <property name="addresses">
>>>>>>>>>>>                             <list>
>>>>>>>>>>>                                 <!-- In distributed
environment,
>>>>>>>>>>> replace with actual host IP address. -->
>>>>>>>>>>>                                 <value>127.0.0.1:47500
>>>>>>>>>>> ..47501</value>
>>>>>>>>>>>                             </list>
>>>>>>>>>>>                         </property>
>>>>>>>>>>>                     </bean>
>>>>>>>>>>>                 </property>
>>>>>>>>>>>             </bean>
>>>>>>>>>>>         </property>
>>>>>>>>>>>     </bean>
>>>>>>>>>>> </beans>
>>>>>>>>>>>
>>>>>>>>>>> Below c++ code is trying to access the cache:
>>>>>>>>>>> int main()
>>>>>>>>>>> {
>>>>>>>>>>> IgniteConfiguration cfg;
>>>>>>>>>>>
>>>>>>>>>>> cfg.jvmInitMem = 512;
>>>>>>>>>>> cfg.jvmMaxMem = 512;
>>>>>>>>>>>
>>>>>>>>>>> //cfg.springCfgPath =
>>>>>>>>>>> "platforms/cpp/examples/config/example-cache.xml";
>>>>>>>>>>> cfg.springCfgPath = "config/example-cache.xml";
>>>>>>>>>>> try
>>>>>>>>>>> {
>>>>>>>>>>> // Start a node.
>>>>>>>>>>> Ignite grid = Ignition::Start(cfg);
>>>>>>>>>>> std::cout << std::endl;
>>>>>>>>>>> std::cout << ">>> Cache node started."
<< std::endl;
>>>>>>>>>>> std::cout << std::endl;
>>>>>>>>>>>
>>>>>>>>>>> //string key
>>>>>>>>>>> Cache<std::string, CBusinessObject> cache
=
>>>>>>>>>>> grid.GetCache<std::string, CBusinessObject>("BU");
>>>>>>>>>>> cache.Clear();
>>>>>>>>>>> CBusinessObject obj("MSFT", 45.23);
>>>>>>>>>>> //save in cache
>>>>>>>>>>> cache.Put("MSFT", obj);
>>>>>>>>>>>
>>>>>>>>>>> //retreive from cache
>>>>>>>>>>> CBusinessObject result = cache.Get("MSFT");
>>>>>>>>>>>
>>>>>>>>>>> std::cout << result.ToString();
>>>>>>>>>>>
>>>>>>>>>>> // Stop node.
>>>>>>>>>>> Ignition::StopAll(false);
>>>>>>>>>>> }
>>>>>>>>>>> catch (IgniteError& err)
>>>>>>>>>>> {
>>>>>>>>>>> std::cout << "An error occurred: " <<
err.GetText() << std::endl;
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> std::cout << std::endl;
>>>>>>>>>>> std::cout << ">>> Execution finished,
press any key to exit ..."
>>>>>>>>>>> << std::endl;
>>>>>>>>>>> std::cout << std::endl;
>>>>>>>>>>>
>>>>>>>>>>> std::cin.get();
>>>>>>>>>>>
>>>>>>>>>>>     return 0;
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> Thanks for any help.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>
>>>
>>
>

Mime
View raw message