Re: ClassCastException while using ignite service proxy

2022-09-04 Thread Hitesh Nandwana
Unsubscribe

On Thu, Sep 1, 2022, 1:24 PM Stephen Darlington <
stephen.darling...@gridgain.com> wrote:

> If I move the deployment to the server side, the exact same code works in
> my environment. Same if I deploy in XML rather than code.
>
> Where are you getting the exception? If you’re seeing that on the client
> side, something very weird is happening. The client shouldn’t have any need
> for the implementation. What does your node filter do? Does it work if you
> disable it?
>
> On 1 Sep 2022, at 06:34, Surinder Mehra  wrote:
>
> Hi Stephen,
> I see you are deploying service from the same client node where proxy is
> obtained.
> In my setup, I have deployed service through ignite config on server start
> and try to create a client later and hence the proxy. It works when I try
> to obtain a proxy on the server node. But when I start a client node and
> try to obtain service instance through proxy, it throws this exception
> mentioned above
>
> On Wed, Aug 31, 2022 at 6:13 PM Stephen Darlington <
> stephen.darling...@gridgain.com> wrote:
>
>> You’ll need to share more of your code and configuration. As far as I can
>> tell, it works. This is my entire code/configuration, using Ignite 2.11.1
>> and Java 11.0.16.1+1.
>>
>> var igniteConfiguration = new IgniteConfiguration()
>> .setPeerClassLoadingEnabled(true)
>> .setClientMode(true);
>> try (var ignite = Ignition.start(igniteConfiguration)) {
>> var cfg = new ServiceConfiguration()
>> .setName("MyService")
>> .setTotalCount(1)
>> .setMaxPerNodeCount(1)
>> .setNodeFilter(x -> !x.isClient())
>> .setService(new MyServiceImpl());
>> ignite.services().deploy(cfg);
>>
>>   var s = ignite.services().serviceProxy("MyService", MyService.class, 
>> false);
>> s.sayHello();
>> }
>>
>> public interface MyService {
>> public void sayHello();
>> }
>>
>> public class MyServiceImpl implements MyService, Service {
>> @Override
>> public void cancel(ServiceContext serviceContext) {
>>
>> }
>>
>> @Override
>> public void init(ServiceContext serviceContext) throws Exception {
>>
>> }
>>
>> @Override
>> public void execute(ServiceContext serviceContext) throws Exception {
>>
>> }
>>
>> @Override
>> public void sayHello() {
>> System.out.println("Hello, world.");
>> }
>> }
>>
>> On 31 Aug 2022, at 04:17, Surinder Mehra  wrote:
>>
>> Please find below
>> ignite version: apache-ignite-2.11.1
>> VM information: OpenJDK Runtime Environment 11.0.15+9-LTS
>>
>> On Wed, Aug 31, 2022 at 12:12 AM Stephen Darlington <
>> stephen.darling...@gridgain.com> wrote:
>>
>>> Which version of Ignite? Which version of Java?
>>>
>>> On 30 Aug 2022, at 13:40, Surinder Mehra  wrote:
>>>
>>>
>>> 
>>> Hi Stephen ,
>>>  yes that is implemented correctly and it's running on server nodes as
>>> well. Somehow it doesn't work when accessed through proxy
>>>
>>> On Tue, Aug 30, 2022 at 5:45 PM Stephen Darlington <
>>> stephen.darling...@gridgain.com> wrote:
>>>
 Your service needs to implement org.apache.ignite.services.Service.

 > On 30 Aug 2022, at 12:40, Surinder Mehra  wrote:
 >
 > Hi,
 > can you help me find out the reason for this exception in thick
 client while getting instance of ignite service:
 >
 > getIgnite()
 > .services()
 > .serviceProxy("sampleService", SampleService.class, false)
 >
 > java.lang.ClassCastException: class com.sun.proxy.$Proxy148 cannot be
 cast to class com.test.ignite.stuff.services.SampleServiceImpl
 (com.sun.proxy.$Proxy148 and
 com.test.ignite.stuff.services.SampleServiceImpl are in unnamed module of
 loader 'app')
 >
 > interface SampleService{
 >
 > }
 >
 > class SampleServiceImpl implements SampleService{
 >
 > }
 >
 > ignite config:
 >
 > 
 >   
 > 
 >   
 >   
 >   
 >   
 > >>> class="com.test.ignite.stuff.services.SampleServiceImpl"/>
 >   
 >   
 > >>> class="com.test.ignite.stuff.node.filter.ServerNodeFilter"/>
 >   
 > 
 >   
 > 
 >
 >
 >


>>
>


Re: ClassCastException while using ignite service proxy

2022-09-01 Thread Stephen Darlington
If I move the deployment to the server side, the exact same code works in my 
environment. Same if I deploy in XML rather than code.

Where are you getting the exception? If you’re seeing that on the client side, 
something very weird is happening. The client shouldn’t have any need for the 
implementation. What does your node filter do? Does it work if you disable it?

> On 1 Sep 2022, at 06:34, Surinder Mehra  wrote:
> 
> Hi Stephen,
> I see you are deploying service from the same client node where proxy is 
> obtained.
> In my setup, I have deployed service through ignite config on server start 
> and try to create a client later and hence the proxy. It works when I try to 
> obtain a proxy on the server node. But when I start a client node and try to 
> obtain service instance through proxy, it throws this exception mentioned 
> above
> 
> On Wed, Aug 31, 2022 at 6:13 PM Stephen Darlington 
> mailto:stephen.darling...@gridgain.com>> 
> wrote:
> You’ll need to share more of your code and configuration. As far as I can 
> tell, it works. This is my entire code/configuration, using Ignite 2.11.1 and 
> Java 11.0.16.1+1.
> 
> var igniteConfiguration = new IgniteConfiguration()
> .setPeerClassLoadingEnabled(true)
> .setClientMode(true);
> try (var ignite = Ignition.start(igniteConfiguration)) {
> var cfg = new ServiceConfiguration()
> .setName("MyService")
> .setTotalCount(1)
> .setMaxPerNodeCount(1)
> .setNodeFilter(x -> !x.isClient())
> .setService(new MyServiceImpl());
> ignite.services().deploy(cfg);
> var s = ignite.services().serviceProxy("MyService", 
> MyService.class, false);
> s.sayHello();
> }
> 
> public interface MyService {
> public void sayHello();
> }
> 
> public class MyServiceImpl implements MyService, Service {
> @Override
> public void cancel(ServiceContext serviceContext) {
> 
> }
> 
> @Override
> public void init(ServiceContext serviceContext) throws Exception {
> 
> }
> 
> @Override
> public void execute(ServiceContext serviceContext) throws Exception {
> 
> }
> 
> @Override
> public void sayHello() {
> System.out.println("Hello, world.");
> }
> }
> 
>> On 31 Aug 2022, at 04:17, Surinder Mehra > > wrote:
>> 
>> Please find below
>> ignite version: apache-ignite-2.11.1
>> VM information: OpenJDK Runtime Environment 11.0.15+9-LTS
>> 
>> On Wed, Aug 31, 2022 at 12:12 AM Stephen Darlington 
>> mailto:stephen.darling...@gridgain.com>> 
>> wrote:
>> Which version of Ignite? Which version of Java?
>> 
>> On 30 Aug 2022, at 13:40, Surinder Mehra > > wrote:
>>> 
>>> 
>>> Hi Stephen ,
>>>  yes that is implemented correctly and it's running on server nodes as 
>>> well. Somehow it doesn't work when accessed through proxy
>>> 
>>> On Tue, Aug 30, 2022 at 5:45 PM Stephen Darlington 
>>> mailto:stephen.darling...@gridgain.com>> 
>>> wrote:
>>> Your service needs to implement org.apache.ignite.services.Service.
>>> 
>>> > On 30 Aug 2022, at 12:40, Surinder Mehra >> > > wrote:
>>> > 
>>> > Hi,
>>> > can you help me find out the reason for this exception in thick client 
>>> > while getting instance of ignite service: 
>>> > 
>>> > getIgnite()
>>> > .services()
>>> > .serviceProxy("sampleService", SampleService.class, false) 
>>> > 
>>> > java.lang.ClassCastException: class com.sun.proxy.$Proxy148 cannot be 
>>> > cast to class com.test.ignite.stuff.services.SampleServiceImpl 
>>> > (com.sun.proxy.$Proxy148 and 
>>> > com.test.ignite.stuff.services.SampleServiceImpl are in unnamed module of 
>>> > loader 'app')
>>> > 
>>> > interface SampleService{
>>> > 
>>> > }
>>> > 
>>> > class SampleServiceImpl implements SampleService{
>>> > 
>>> > }
>>> > 
>>> > ignite config:
>>> > 
>>> > 
>>> >   
>>> > 
>>> >   
>>> >   
>>> >   
>>> >   
>>> > >> > class="com.test.ignite.stuff.services.SampleServiceImpl"/>
>>> >   
>>> >   
>>> > >> > class="com.test.ignite.stuff.node.filter.ServerNodeFilter"/>
>>> >   
>>> > 
>>> >   
>>> > 
>>> > 
>>> > 
>>> > 
>>> 
> 



Re: ClassCastException while using ignite service proxy

2022-08-31 Thread Surinder Mehra
Hi Stephen,
I see you are deploying service from the same client node where proxy is
obtained.
In my setup, I have deployed service through ignite config on server start
and try to create a client later and hence the proxy. It works when I try
to obtain a proxy on the server node. But when I start a client node and
try to obtain service instance through proxy, it throws this exception
mentioned above

On Wed, Aug 31, 2022 at 6:13 PM Stephen Darlington <
stephen.darling...@gridgain.com> wrote:

> You’ll need to share more of your code and configuration. As far as I can
> tell, it works. This is my entire code/configuration, using Ignite 2.11.1
> and Java 11.0.16.1+1.
>
> var igniteConfiguration = new IgniteConfiguration()
> .setPeerClassLoadingEnabled(true)
> .setClientMode(true);
> try (var ignite = Ignition.start(igniteConfiguration)) {
> var cfg = new ServiceConfiguration()
> .setName("MyService")
> .setTotalCount(1)
> .setMaxPerNodeCount(1)
> .setNodeFilter(x -> !x.isClient())
> .setService(new MyServiceImpl());
> ignite.services().deploy(cfg);
>
>   var s = ignite.services().serviceProxy("MyService", MyService.class, false);
> s.sayHello();
> }
>
> public interface MyService {
> public void sayHello();
> }
>
> public class MyServiceImpl implements MyService, Service {
> @Override
> public void cancel(ServiceContext serviceContext) {
>
> }
>
> @Override
> public void init(ServiceContext serviceContext) throws Exception {
>
> }
>
> @Override
> public void execute(ServiceContext serviceContext) throws Exception {
>
> }
>
> @Override
> public void sayHello() {
> System.out.println("Hello, world.");
> }
> }
>
> On 31 Aug 2022, at 04:17, Surinder Mehra  wrote:
>
> Please find below
> ignite version: apache-ignite-2.11.1
> VM information: OpenJDK Runtime Environment 11.0.15+9-LTS
>
> On Wed, Aug 31, 2022 at 12:12 AM Stephen Darlington <
> stephen.darling...@gridgain.com> wrote:
>
>> Which version of Ignite? Which version of Java?
>>
>> On 30 Aug 2022, at 13:40, Surinder Mehra  wrote:
>>
>>
>> 
>> Hi Stephen ,
>>  yes that is implemented correctly and it's running on server nodes as
>> well. Somehow it doesn't work when accessed through proxy
>>
>> On Tue, Aug 30, 2022 at 5:45 PM Stephen Darlington <
>> stephen.darling...@gridgain.com> wrote:
>>
>>> Your service needs to implement org.apache.ignite.services.Service.
>>>
>>> > On 30 Aug 2022, at 12:40, Surinder Mehra  wrote:
>>> >
>>> > Hi,
>>> > can you help me find out the reason for this exception in thick client
>>> while getting instance of ignite service:
>>> >
>>> > getIgnite()
>>> > .services()
>>> > .serviceProxy("sampleService", SampleService.class, false)
>>> >
>>> > java.lang.ClassCastException: class com.sun.proxy.$Proxy148 cannot be
>>> cast to class com.test.ignite.stuff.services.SampleServiceImpl
>>> (com.sun.proxy.$Proxy148 and
>>> com.test.ignite.stuff.services.SampleServiceImpl are in unnamed module of
>>> loader 'app')
>>> >
>>> > interface SampleService{
>>> >
>>> > }
>>> >
>>> > class SampleServiceImpl implements SampleService{
>>> >
>>> > }
>>> >
>>> > ignite config:
>>> >
>>> > 
>>> >   
>>> > 
>>> >   
>>> >   
>>> >   
>>> >   
>>> > >> class="com.test.ignite.stuff.services.SampleServiceImpl"/>
>>> >   
>>> >   
>>> > >> class="com.test.ignite.stuff.node.filter.ServerNodeFilter"/>
>>> >   
>>> > 
>>> >   
>>> > 
>>> >
>>> >
>>> >
>>>
>>>
>


Re: ClassCastException while using ignite service proxy

2022-08-31 Thread Stephen Darlington
You’ll need to share more of your code and configuration. As far as I can tell, 
it works. This is my entire code/configuration, using Ignite 2.11.1 and Java 
11.0.16.1+1.

var igniteConfiguration = new IgniteConfiguration()
.setPeerClassLoadingEnabled(true)
.setClientMode(true);
try (var ignite = Ignition.start(igniteConfiguration)) {
var cfg = new ServiceConfiguration()
.setName("MyService")
.setTotalCount(1)
.setMaxPerNodeCount(1)
.setNodeFilter(x -> !x.isClient())
.setService(new MyServiceImpl());
ignite.services().deploy(cfg);
var s = ignite.services().serviceProxy("MyService", 
MyService.class, false);
s.sayHello();
}

public interface MyService {
public void sayHello();
}

public class MyServiceImpl implements MyService, Service {
@Override
public void cancel(ServiceContext serviceContext) {

}

@Override
public void init(ServiceContext serviceContext) throws Exception {

}

@Override
public void execute(ServiceContext serviceContext) throws Exception {

}

@Override
public void sayHello() {
System.out.println("Hello, world.");
}
}

> On 31 Aug 2022, at 04:17, Surinder Mehra  wrote:
> 
> Please find below
> ignite version: apache-ignite-2.11.1
> VM information: OpenJDK Runtime Environment 11.0.15+9-LTS
> 
> On Wed, Aug 31, 2022 at 12:12 AM Stephen Darlington 
> mailto:stephen.darling...@gridgain.com>> 
> wrote:
> Which version of Ignite? Which version of Java?
> 
> On 30 Aug 2022, at 13:40, Surinder Mehra  > wrote:
>> 
>> 
>> Hi Stephen ,
>>  yes that is implemented correctly and it's running on server nodes as well. 
>> Somehow it doesn't work when accessed through proxy
>> 
>> On Tue, Aug 30, 2022 at 5:45 PM Stephen Darlington 
>> mailto:stephen.darling...@gridgain.com>> 
>> wrote:
>> Your service needs to implement org.apache.ignite.services.Service.
>> 
>> > On 30 Aug 2022, at 12:40, Surinder Mehra > > > wrote:
>> > 
>> > Hi,
>> > can you help me find out the reason for this exception in thick client 
>> > while getting instance of ignite service: 
>> > 
>> > getIgnite()
>> > .services()
>> > .serviceProxy("sampleService", SampleService.class, false) 
>> > 
>> > java.lang.ClassCastException: class com.sun.proxy.$Proxy148 cannot be cast 
>> > to class com.test.ignite.stuff.services.SampleServiceImpl 
>> > (com.sun.proxy.$Proxy148 and 
>> > com.test.ignite.stuff.services.SampleServiceImpl are in unnamed module of 
>> > loader 'app')
>> > 
>> > interface SampleService{
>> > 
>> > }
>> > 
>> > class SampleServiceImpl implements SampleService{
>> > 
>> > }
>> > 
>> > ignite config:
>> > 
>> > 
>> >   
>> > 
>> >   
>> >   
>> >   
>> >   
>> > > > class="com.test.ignite.stuff.services.SampleServiceImpl"/>
>> >   
>> >   
>> > > > class="com.test.ignite.stuff.node.filter.ServerNodeFilter"/>
>> >   
>> > 
>> >   
>> > 
>> > 
>> > 
>> > 
>> 



Re: ClassCastException while using ignite service proxy

2022-08-30 Thread Surinder Mehra
Please find below
ignite version: apache-ignite-2.11.1
VM information: OpenJDK Runtime Environment 11.0.15+9-LTS

On Wed, Aug 31, 2022 at 12:12 AM Stephen Darlington <
stephen.darling...@gridgain.com> wrote:

> Which version of Ignite? Which version of Java?
>
> On 30 Aug 2022, at 13:40, Surinder Mehra  wrote:
>
>
> 
> Hi Stephen ,
>  yes that is implemented correctly and it's running on server nodes as
> well. Somehow it doesn't work when accessed through proxy
>
> On Tue, Aug 30, 2022 at 5:45 PM Stephen Darlington <
> stephen.darling...@gridgain.com> wrote:
>
>> Your service needs to implement org.apache.ignite.services.Service.
>>
>> > On 30 Aug 2022, at 12:40, Surinder Mehra  wrote:
>> >
>> > Hi,
>> > can you help me find out the reason for this exception in thick client
>> while getting instance of ignite service:
>> >
>> > getIgnite()
>> > .services()
>> > .serviceProxy("sampleService", SampleService.class, false)
>> >
>> > java.lang.ClassCastException: class com.sun.proxy.$Proxy148 cannot be
>> cast to class com.test.ignite.stuff.services.SampleServiceImpl
>> (com.sun.proxy.$Proxy148 and
>> com.test.ignite.stuff.services.SampleServiceImpl are in unnamed module of
>> loader 'app')
>> >
>> > interface SampleService{
>> >
>> > }
>> >
>> > class SampleServiceImpl implements SampleService{
>> >
>> > }
>> >
>> > ignite config:
>> >
>> > 
>> >   
>> > 
>> >   
>> >   
>> >   
>> >   
>> > > class="com.test.ignite.stuff.services.SampleServiceImpl"/>
>> >   
>> >   
>> > > class="com.test.ignite.stuff.node.filter.ServerNodeFilter"/>
>> >   
>> > 
>> >   
>> > 
>> >
>> >
>> >
>>
>>


Re: ClassCastException while using ignite service proxy

2022-08-30 Thread Stephen Darlington
Which version of Ignite? Which version of Java?

On 30 Aug 2022, at 13:40, Surinder Mehra  wrote:
> 
> 
> Hi Stephen ,
>  yes that is implemented correctly and it's running on server nodes as well. 
> Somehow it doesn't work when accessed through proxy
> 
>> On Tue, Aug 30, 2022 at 5:45 PM Stephen Darlington 
>>  wrote:
>> Your service needs to implement org.apache.ignite.services.Service.
>> 
>> > On 30 Aug 2022, at 12:40, Surinder Mehra  wrote:
>> > 
>> > Hi,
>> > can you help me find out the reason for this exception in thick client 
>> > while getting instance of ignite service: 
>> > 
>> > getIgnite()
>> > .services()
>> > .serviceProxy("sampleService", SampleService.class, false) 
>> > 
>> > java.lang.ClassCastException: class com.sun.proxy.$Proxy148 cannot be cast 
>> > to class com.test.ignite.stuff.services.SampleServiceImpl 
>> > (com.sun.proxy.$Proxy148 and 
>> > com.test.ignite.stuff.services.SampleServiceImpl are in unnamed module of 
>> > loader 'app')
>> > 
>> > interface SampleService{
>> > 
>> > }
>> > 
>> > class SampleServiceImpl implements SampleService{
>> > 
>> > }
>> > 
>> > ignite config:
>> > 
>> > 
>> >   
>> > 
>> >   
>> >   
>> >   
>> >   
>> > > > class="com.test.ignite.stuff.services.SampleServiceImpl"/>
>> >   
>> >   
>> > > > class="com.test.ignite.stuff.node.filter.ServerNodeFilter"/>
>> >   
>> > 
>> >   
>> > 
>> > 
>> > 
>> > 
>> 


Re: ClassCastException while using ignite service proxy

2022-08-30 Thread Surinder Mehra
Hi Stephen ,
 yes that is implemented correctly and it's running on server nodes as
well. Somehow it doesn't work when accessed through proxy

On Tue, Aug 30, 2022 at 5:45 PM Stephen Darlington <
stephen.darling...@gridgain.com> wrote:

> Your service needs to implement org.apache.ignite.services.Service.
>
> > On 30 Aug 2022, at 12:40, Surinder Mehra  wrote:
> >
> > Hi,
> > can you help me find out the reason for this exception in thick client
> while getting instance of ignite service:
> >
> > getIgnite()
> > .services()
> > .serviceProxy("sampleService", SampleService.class, false)
> >
> > java.lang.ClassCastException: class com.sun.proxy.$Proxy148 cannot be
> cast to class com.test.ignite.stuff.services.SampleServiceImpl
> (com.sun.proxy.$Proxy148 and
> com.test.ignite.stuff.services.SampleServiceImpl are in unnamed module of
> loader 'app')
> >
> > interface SampleService{
> >
> > }
> >
> > class SampleServiceImpl implements SampleService{
> >
> > }
> >
> > ignite config:
> >
> > 
> >   
> > 
> >   
> >   
> >   
> >   
> >  class="com.test.ignite.stuff.services.SampleServiceImpl"/>
> >   
> >   
> >  class="com.test.ignite.stuff.node.filter.ServerNodeFilter"/>
> >   
> > 
> >   
> > 
> >
> >
> >
>
>


Re: ClassCastException while using ignite service proxy

2022-08-30 Thread Stephen Darlington
Your service needs to implement org.apache.ignite.services.Service.

> On 30 Aug 2022, at 12:40, Surinder Mehra  wrote:
> 
> Hi,
> can you help me find out the reason for this exception in thick client while 
> getting instance of ignite service: 
> 
> getIgnite()
> .services()
> .serviceProxy("sampleService", SampleService.class, false) 
> 
> java.lang.ClassCastException: class com.sun.proxy.$Proxy148 cannot be cast to 
> class com.test.ignite.stuff.services.SampleServiceImpl 
> (com.sun.proxy.$Proxy148 and com.test.ignite.stuff.services.SampleServiceImpl 
> are in unnamed module of loader 'app')
> 
> interface SampleService{
> 
> }
> 
> class SampleServiceImpl implements SampleService{
> 
> }
> 
> ignite config:
> 
> 
>   
> 
>   
>   
>   
>   
> 
>   
>   
> 
>   
> 
>   
> 
> 
> 
> 



ClassCastException while using ignite service proxy

2022-08-30 Thread Surinder Mehra
Hi,
can you help me find out the reason for this exception in thick client
while getting instance of ignite service:

getIgnite()
.services()
.serviceProxy("sampleService", SampleService.class, false)

java.lang.ClassCastException: class com.sun.proxy.$Proxy148 cannot be cast
to class com.test.ignite.stuff.services.SampleServiceImpl
(com.sun.proxy.$Proxy148 and
com.test.ignite.stuff.services.SampleServiceImpl are in unnamed module of
loader 'app')

interface SampleService{

}

class SampleServiceImpl implements SampleService{

}

ignite config: