Re: How to start and use ignite in Tomcat

2016-05-06 Thread Denis Magda
Hi, 

Yes, you can start an Ignite client node inside of your application container 
and communicate with the cluster through it.

> however, the exception is about "class org.apache.ignite.IgniteException:
> Ignite instance with this name has already been started: b2c_acc"…

This exception happens in cases when you are starting several Ignite nodes with 
the same name inside of a single JVM process. 
If you need to have several Ignite instances inside of a single JVM process 
then you have to set a unique name for every node using 
IgniteConfiguration.setGridName. If it’s not your case then you should look 
through your code finding a place that start the node instance one more time.

—
Denis

> On May 6, 2016, at 2:04 PM, minisoft_rm  wrote:
> 
> Hello experts~~~
>  my goal is to use ignite(in standalone server style) from tomcat webapp.
>  And I am trying to start ignite client in web app owned logic(programming
> it, not by ServletContextListenerStartup), does it work?  
> 
> in my project, I want to hide one table (table in mysql DB) by putting
> ignite layer on above of it.
> 
> indeed, ignite doesn't support insert/update/delete so far. So I did some
> coding to translate them to put operations
> 
> however, the exception is about "class org.apache.ignite.IgniteException:
> Ignite instance with this name has already been started: b2c_acc"...   what
> is the root cause of it? might it be only one ignite instance there per
> jvm? and where/who start ignite several times?
> 
> 
> 
> --
> View this message in context: 
> http://apache-ignite-users.70518.x6.nabble.com/How-to-start-and-use-ignite-in-Tomcat-tp4776p4822.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.



Re: How to start and use ignite in Tomcat

2016-05-06 Thread minisoft_rm
Hello experts~~~
  my goal is to use ignite(in standalone server style) from tomcat webapp.
  And I am trying to start ignite client in web app owned logic(programming
it, not by ServletContextListenerStartup), does it work?  

in my project, I want to hide one table (table in mysql DB) by putting
ignite layer on above of it.

indeed, ignite doesn't support insert/update/delete so far. So I did some
coding to translate them to put operations

 however, the exception is about "class org.apache.ignite.IgniteException:
Ignite instance with this name has already been started: b2c_acc"...   what
is the root cause of it? might it be only one ignite instance there per
jvm? and where/who start ignite several times?



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/How-to-start-and-use-ignite-in-Tomcat-tp4776p4822.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: How to start and use ignite in Tomcat

2016-05-05 Thread Alexei Scherbakov
Hi,

Please clarify what are you trying to achieve?
>From logs I see the Ignite grid instance tries to start several times.
Please check the ServletContextListenerStartup class
for example how to correctly start Ignite in the servlet environment:

https://github.com/apache/ignite/blob/master/modules/web/src/main/java/org/apache/ignite/startup/servlet/ServletContextListenerStartup.java




2016-05-05 17:24 GMT+03:00 Andrey Gura :

> 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:
>
> 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";>
>
>  class="org.apache.ignite.configuration.IgniteConfiguration">
>
> 
>
> 
> 
>  class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
> 
> 
> 
> 
>  class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
> 
> 
> 
> 127.0.0.1:47500..47509
> 
> 
> 
> 
> 
> 
> 
>
> 
>
>
> 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 
> 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
>



-- 

Best regards,
Alexei Scherbakov


Re: How to start and use ignite in Tomcat

2016-05-05 Thread Andrey Gura
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:

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";>
















127.0.0.1:47500..47509











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  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


How to start and use ignite in Tomcat

2016-05-04 Thread minisoft_rm
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.