You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by mark_balmer <ma...@moodinternational.com> on 2017/01/06 13:52:55 UTC

Java Service Deployment

I'm having problems getting an example Java service to be deployed on my
Ignite cluster as part of a product evaluation. I've followed the example as
specified on the url http://apacheignite.gridgain.org/docs/service-example ,
however I've also noticed that on the main service information page it
states:

Make sure that a node filter's class is located in the classpath of every
Ignite node regardless of the fact whether an Ignite Service is going to be
deployed there or not. Otherwise you'll get a ClassNotFoundException.

I'm trying the deploy an example service to a cluster which is running on 2
windows servers. The ClassNotFoundException is the error that I'm getting
when running the example deploy code. So far i've added a specific folder to
the CLASSPATH environment variable on both servers, and have copied the
package folders and .class files for the service and its interface to the
folder as specified in the CLASSPATH.

Can anyone give me some guidance on what I'm doing wrong? I assume its
simply an environment setup problem...



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Java-Service-Deployment-tp9933.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Java Service Deployment

Posted by vkulichenko <va...@gmail.com>.
Hi,

What timestamps are you referring to? If you want to measure the latency of
a particular call, surround it with timestamps and print out the duration.

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Java-Service-Deployment-tp9933p10011.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Java Service Deployment

Posted by mark_balmer <ma...@moodinternational.com>.
Ok, i've managed to get the service deployed to the cluster now, and I can
call the method on it. However, the code that calls the service seems slow
to get the response. See below output and the timestamps:

[15:14:05] Security status [authentication=off, tls/ssl=off]
[15:14:16] New version is available at ignite.apache.org: 1.8.0
[15:14:27] To start Console Management & Monitoring run
ignitevisorcmd.{sh|bat}
[15:14:27] 
[15:14:27] Ignite node started OK (id=de5c9009)
[15:14:27] Topology snapshot [ver=129, servers=1, clients=1, CPUs=10,
heap=4.5GB]
Cache hit: 11
[15:14:27] Ignite node stopped OK [uptime=00:00:00:122]

If however, I run some code which connects to a cache and gets some data
back its immediate. In measuring the reponse perfomance of the service, do I
look at the time from the topology snapshot?



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Java-Service-Deployment-tp9933p9937.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Java Service Deployment

Posted by Nikolai Tikhonov <nt...@apache.org>.
In your case you just need enable peer class loading. For java
configuration to use IgniteConfiguration#setPeerClassLoadingEnabled or for
xml:

<bean id="ignite.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"/>
    ...
</bean>

If after it you will get the exception, please share it here and attach
your ignite configuration.

On Fri, Jan 6, 2017 at 5:28 PM, mark_balmer <
mark.balmer@moodinternational.com> wrote:

> So i'm trying to follow the service example at
> http://apacheignite.gridgain.org/docs/service-example which is a
> MyCounterServiceImpl service, not the NodeFilter one.
>
> Under the section Service Deployment, it shows some code for deploying it:
> // Cluster group which includes all caching nodes.
> ClusterGroup cacheGrp = ignite.cluster().forCache("myCounterService");
>
> // Get an instance of IgniteServices for the cluster group.
> IgniteServices svcs = ignite.services(cacheGrp);
>
> // Deploy per-node singleton. An instance of the service
> // will be deployed on every node within the cluster group.
> svcs.deployNodeSingleton("myCounterService", new MyCounterServiceImpl());
>
> Do I put this code in another class under main() ? If so, is this
> deployment
> class meant to be part of the jar? I apologise in advance if this doesnt
> make sense, I'm fairly new to java!
>
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Java-Service-Deployment-tp9933p9935.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Java Service Deployment

Posted by mark_balmer <ma...@moodinternational.com>.
So i'm trying to follow the service example at
http://apacheignite.gridgain.org/docs/service-example which is a
MyCounterServiceImpl service, not the NodeFilter one. 

Under the section Service Deployment, it shows some code for deploying it:
// Cluster group which includes all caching nodes.
ClusterGroup cacheGrp = ignite.cluster().forCache("myCounterService");

// Get an instance of IgniteServices for the cluster group.
IgniteServices svcs = ignite.services(cacheGrp);
 
// Deploy per-node singleton. An instance of the service
// will be deployed on every node within the cluster group.
svcs.deployNodeSingleton("myCounterService", new MyCounterServiceImpl());

Do I put this code in another class under main() ? If so, is this deployment
class meant to be part of the jar? I apologise in advance if this doesnt
make sense, I'm fairly new to java!





--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Java-Service-Deployment-tp9933p9935.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Java Service Deployment

Posted by Nikolai Tikhonov <nt...@apache.org>.
Hi!

You should copy jar with node filter to libs folder. It will be enough.

On Fri, Jan 6, 2017 at 4:52 PM, mark_balmer <
mark.balmer@moodinternational.com> wrote:

> I'm having problems getting an example Java service to be deployed on my
> Ignite cluster as part of a product evaluation. I've followed the example
> as
> specified on the url http://apacheignite.gridgain.org/docs/service-example
> ,
> however I've also noticed that on the main service information page it
> states:
>
> Make sure that a node filter's class is located in the classpath of every
> Ignite node regardless of the fact whether an Ignite Service is going to be
> deployed there or not. Otherwise you'll get a ClassNotFoundException.
>
> I'm trying the deploy an example service to a cluster which is running on 2
> windows servers. The ClassNotFoundException is the error that I'm getting
> when running the example deploy code. So far i've added a specific folder
> to
> the CLASSPATH environment variable on both servers, and have copied the
> package folders and .class files for the service and its interface to the
> folder as specified in the CLASSPATH.
>
> Can anyone give me some guidance on what I'm doing wrong? I assume its
> simply an environment setup problem...
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Java-Service-Deployment-tp9933.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>