Hi,

In order to start clint node you should just execute code like this:

Ignition.setClientMode(true);
Ignition.start();

In this case client node with default configuration will be started. Of
course you can provide own IgniteConfiguration programatically:

IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setClientMode(true);
// ... other settings
Ignition.start(cfg);

or using Spring configuration files:

<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="clientMode" value="true"/>

        <!-- 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. For
information on all options refer
                        to our documentation:
http://apacheignite.readme.io/docs/cluster-config
                    -->
                    <!-- 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..47509</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>

</beans>


If you want use JDBC drievr for connection to Ignite cluster there is no
need to create any client nodes.


On Thu, May 5, 2016 at 5:33 AM, minisoft_rm <minisoft...@hotmail.com> wrote:

> Dear all,
>  i searched a number of topics here. but still don't know how to start and
> use ignite (in client mode) from Tomcat.... you know, I launched the
> standalone ignite as server node.
>
> my code in tomcat web app like this:"
>
> this.ignite =
> Ignition.start(ClientConfigurationFactory.createConfiguration());
>
>
> Class.forName("org.apache.ignite.IgniteJdbcDriver");
>                         this.conn = DriverManager
>
> .getConnection("jdbc:ignite:cfg://cache=b2c_accCache
> @file:///Users/i306576/Documents/ignite/apache-ignite-fabric-1.5.0.final-bin/examples/config/ignite-jdbc.xml");
>                         this.cartCacher = new CartCacher();
>                         this.ic = ignite.cache("b2c_accCache");
>
> "
>
> the console log show some error mes I don't understand..."
> Caused by: class org.apache.ignite.IgniteCheckedException: Ignite instance
> with this name has already been started: b2c_acc
> "
>
> :-(  the thing is.... this kind of client mode is ok without Tomcat...
>
> please help~~
>
>
>
>
> --
> View this message in context:
> http://apache-ignite-users.70518.x6.nabble.com/How-to-start-and-use-ignite-in-Tomcat-tp4776.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Andrey Gura
GridGain Systems, Inc.
www.gridgain.com

Reply via email to