You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by 38797715 <38...@qq.com> on 2021/12/10 08:53:02 UTC

IgniteBiPredicate in ThinClient ScanQuery:java.lang.ClassNotFoundException

An exception will be throw when the following code is executed:

The ScanQuery in the thin client does not support IgniteBiPredicate?


publicclassThinClient{
publicstaticvoidmain(String[] args) throwsClientException, Exception{
ClientConfigurationcfg= 
newClientConfiguration().setAddresses("localhost:10800");
try(IgniteClientclient= Ignition.startClient(cfg)) {
ClientCache<Integer, Person> cache2= client.getOrCreateCache("cache2");
for(inti= 1; i<= 10; i++) {
cache2.put(i, newPerson((long)i, "a", "b"));
}
ClientCache<BinaryObject, BinaryObject> cache3= 
client.getOrCreateCache("cache2").withKeepBinary();
IgniteBiPredicate<BinaryObject, BinaryObject> filter= 
newIgniteBiPredicate<BinaryObject, BinaryObject>() {
@Overridepublicbooleanapply(BinaryObjectkey, BinaryObjectperson) {
returnperson.<Long>field("id") > 6;
}
};
try(QueryCursor<Entry<BinaryObject, BinaryObject>> cur3= 
cache3.query(newScanQuery<>(filter))) {
for(Cache.Entry<BinaryObject, BinaryObject> entry:cur3) {
System.out.println(entry.getValue());
}
}
}
}
}

Re: IgniteBiPredicate in ThinClient ScanQuery:java.lang.ClassNotFoundException

Posted by Ilya Korol <ll...@gmail.com>.
PeerDeploymentClassLoading should help to work around this issue, 
shouldn't it?

10.12.2021 20:56, Pavel Tupitsyn пишет:
> Yes, the problem is that the predicate class "ThinClient$1" is not 
> deployed on the server.
>
> On Fri, Dec 10, 2021 at 1:24 PM 18624049226 <18624049226@163.com 
> <ma...@163.com>> wrote:
>
>     [16:44:49,031][SEVERE][client-connector-#72][ClientListenerNioListener]
>     Failed to process client request
>     [req=o.a.i.i.processors.platform.client.cache.ClientCach
>     eScanQueryRequest@1c37c4d2]
>     class org.apache.ignite.binary.BinaryInvalidTypeException:
>     ThinClient$1
>            at
>     org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:717)
>            at
>     org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1762)
>            at
>     org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1721)
>            at
>     org.apache.ignite.internal.binary.BinaryObjectImpl.deserializeValue(BinaryObjectImpl.java:820)
>            at
>     org.apache.ignite.internal.binary.BinaryObjectImpl.deserialize(BinaryObjectImpl.java:661)
>            at
>     org.apache.ignite.internal.processors.platform.client.cache.ClientCacheScanQueryRequest.createFilter(ClientCacheScanQueryRequest.java:117)
>            at
>     org.apache.ignite.internal.processors.platform.client.cache.ClientCacheScanQueryRequest.process(ClientCacheScanQueryRequest.java:83)
>            at
>     org.apache.ignite.internal.processors.platform.client.ClientRequestHandler.handle(ClientRequestHandler.java:94)
>            at
>     org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.onMessage(ClientListenerNioListener.java:204)
>            at
>     org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.onMessage(ClientListenerNioListener.java:55)
>            at
>     org.apache.ignite.internal.util.nio.GridNioFilterChain$TailFilter.onMessageReceived(GridNioFilterChain.java:279)
>            at
>     org.apache.ignite.internal.util.nio.GridNioFilterAdapter.proceedMessageReceived(GridNioFilterAdapter.java:109)
>            at
>     org.apache.ignite.internal.util.nio.GridNioAsyncNotifyFilter$3.body(GridNioAsyncNotifyFilter.java:97)
>            at
>     org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
>            at
>     org.apache.ignite.internal.util.worker.GridWorkerPool$1.run(GridWorkerPool.java:70)
>            at
>     java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
>            at
>     java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
>            at java.base/java.lang.Thread.run(Thread.java:829)
>     Caused by: java.lang.ClassNotFoundException: ThinClient$1
>            at
>     java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
>            at
>     java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
>            at
>     java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
>            at java.base/java.lang.Class.forName0(Native Method)
>            at java.base/java.lang.Class.forName(Class.java:398)
>            at
>     org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:9064)
>            at
>     org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:9002)
>            at
>     org.apache.ignite.internal.MarshallerContextImpl.getClass(MarshallerContextImpl.java:376)
>            at
>     org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:693)
>            ... 17 more
>
>
>
>     在 2021/12/10 17:39, Pavel Tupitsyn 写道:
>>     Thin client scan query supports any predicates.
>>     However, make sure that predicate is deployed on all server nodes
>>     so it can be executed.
>>
>>     Please share the exception details.
>>
>>     On Fri, Dec 10, 2021 at 11:53 AM 38797715 <38797715@qq.com
>>     <ma...@qq.com>> wrote:
>>
>>         An exception will be throw when the following code is executed:
>>
>>         The ScanQuery in the thin client does not support
>>         IgniteBiPredicate?
>>
>>
>>         publicclassThinClient{
>>         publicstaticvoidmain(String[] args) throwsClientException,
>>         Exception{
>>         ClientConfigurationcfg=
>>         newClientConfiguration().setAddresses("localhost:10800");
>>         try(IgniteClientclient= Ignition.startClient(cfg)) {
>>         ClientCache<Integer, Person> cache2=
>>         client.getOrCreateCache("cache2");
>>         for(inti= 1; i<= 10; i++) {
>>         cache2.put(i, newPerson((long)i, "a", "b"));
>>         }
>>         ClientCache<BinaryObject, BinaryObject> cache3=
>>         client.getOrCreateCache("cache2").withKeepBinary();
>>         IgniteBiPredicate<BinaryObject, BinaryObject> filter=
>>         newIgniteBiPredicate<BinaryObject, BinaryObject>() {
>>         @Overridepublicbooleanapply(BinaryObjectkey,
>>         BinaryObjectperson) {
>>         returnperson.<Long>field("id") > 6;
>>         }
>>         };
>>         try(QueryCursor<Entry<BinaryObject, BinaryObject>> cur3=
>>         cache3.query(newScanQuery<>(filter))) {
>>         for(Cache.Entry<BinaryObject, BinaryObject> entry:cur3) {
>>         System.out.println(entry.getValue());
>>         }
>>         }
>>         }
>>         }
>>         }
>>

Re: IgniteBiPredicate in ThinClient ScanQuery:java.lang.ClassNotFoundException

Posted by Pavel Tupitsyn <pt...@apache.org>.
Yes, the problem is that the predicate class "ThinClient$1" is not deployed
on the server.

On Fri, Dec 10, 2021 at 1:24 PM 18624049226 <18...@163.com> wrote:

> [16:44:49,031][SEVERE][client-connector-#72][ClientListenerNioListener]
> Failed to process client request
> [req=o.a.i.i.processors.platform.client.cache.ClientCach
> eScanQueryRequest@1c37c4d2]
> class org.apache.ignite.binary.BinaryInvalidTypeException: ThinClient$1
>        at
> org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:717)
>        at
> org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1762)
>        at
> org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1721)
>        at
> org.apache.ignite.internal.binary.BinaryObjectImpl.deserializeValue(BinaryObjectImpl.java:820)
>        at
> org.apache.ignite.internal.binary.BinaryObjectImpl.deserialize(BinaryObjectImpl.java:661)
>        at
> org.apache.ignite.internal.processors.platform.client.cache.ClientCacheScanQueryRequest.createFilter(ClientCacheScanQueryRequest.java:117)
>        at
> org.apache.ignite.internal.processors.platform.client.cache.ClientCacheScanQueryRequest.process(ClientCacheScanQueryRequest.java:83)
>        at
> org.apache.ignite.internal.processors.platform.client.ClientRequestHandler.handle(ClientRequestHandler.java:94)
>        at
> org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.onMessage(ClientListenerNioListener.java:204)
>        at
> org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.onMessage(ClientListenerNioListener.java:55)
>        at
> org.apache.ignite.internal.util.nio.GridNioFilterChain$TailFilter.onMessageReceived(GridNioFilterChain.java:279)
>        at
> org.apache.ignite.internal.util.nio.GridNioFilterAdapter.proceedMessageReceived(GridNioFilterAdapter.java:109)
>        at
> org.apache.ignite.internal.util.nio.GridNioAsyncNotifyFilter$3.body(GridNioAsyncNotifyFilter.java:97)
>        at
> org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
>        at
> org.apache.ignite.internal.util.worker.GridWorkerPool$1.run(GridWorkerPool.java:70)
>        at
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
>        at
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
>        at java.base/java.lang.Thread.run(Thread.java:829)
> Caused by: java.lang.ClassNotFoundException: ThinClient$1
>        at
> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
>        at
> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
>        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
>        at java.base/java.lang.Class.forName0(Native Method)
>        at java.base/java.lang.Class.forName(Class.java:398)
>        at
> org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:9064)
>        at
> org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:9002)
>        at
> org.apache.ignite.internal.MarshallerContextImpl.getClass(MarshallerContextImpl.java:376)
>        at
> org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:693)
>        ... 17 more
>
>
>
> 在 2021/12/10 17:39, Pavel Tupitsyn 写道:
>
> Thin client scan query supports any predicates.
> However, make sure that predicate is deployed on all server nodes so it
> can be executed.
>
> Please share the exception details.
>
> On Fri, Dec 10, 2021 at 11:53 AM 38797715 <38...@qq.com> wrote:
>
>> An exception will be throw when the following code is executed:
>>
>> The ScanQuery in the thin client does not support IgniteBiPredicate?
>>
>>
>> public class ThinClient {
>> public static void main(String[] args) throws ClientException, Exception
>> {
>> ClientConfiguration cfg = new ClientConfiguration().setAddresses(
>> "localhost:10800");
>> try (IgniteClient client = Ignition.startClient(cfg)) {
>> ClientCache<Integer, Person> cache2 = client.getOrCreateCache("cache2");
>> for (int i = 1; i <= 10; i++) {
>> cache2.put(i, new Person((long)i, "a", "b"));
>> }
>> ClientCache<BinaryObject, BinaryObject> cache3 = client.getOrCreateCache(
>> "cache2").withKeepBinary();
>> IgniteBiPredicate<BinaryObject, BinaryObject> filter = new
>> IgniteBiPredicate<BinaryObject, BinaryObject>() {
>> @Override public boolean apply(BinaryObject key, BinaryObject person) {
>> return person.<Long>field("id") > 6;
>> }
>> };
>> try (QueryCursor<Entry<BinaryObject, BinaryObject>> cur3 = cache3.query(
>> new ScanQuery<>(filter))) {
>> for (Cache.Entry<BinaryObject, BinaryObject> entry : cur3) {
>> System.out.println(entry.getValue());
>> }
>> }
>> }
>> }
>> }
>>
>

Re: IgniteBiPredicate in ThinClient ScanQuery:java.lang.ClassNotFoundException

Posted by 18624049226 <18...@163.com>.
[16:44:49,031][SEVERE][client-connector-#72][ClientListenerNioListener] 
Failed to process client request 
[req=o.a.i.i.processors.platform.client.cache.ClientCach
eScanQueryRequest@1c37c4d2]
class org.apache.ignite.binary.BinaryInvalidTypeException: ThinClient$1
        at 
org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:717)
        at 
org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1762)
        at 
org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1721)
        at 
org.apache.ignite.internal.binary.BinaryObjectImpl.deserializeValue(BinaryObjectImpl.java:820)
        at 
org.apache.ignite.internal.binary.BinaryObjectImpl.deserialize(BinaryObjectImpl.java:661)
        at 
org.apache.ignite.internal.processors.platform.client.cache.ClientCacheScanQueryRequest.createFilter(ClientCacheScanQueryRequest.java:117)
        at 
org.apache.ignite.internal.processors.platform.client.cache.ClientCacheScanQueryRequest.process(ClientCacheScanQueryRequest.java:83)
        at 
org.apache.ignite.internal.processors.platform.client.ClientRequestHandler.handle(ClientRequestHandler.java:94)
        at 
org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.onMessage(ClientListenerNioListener.java:204)
        at 
org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.onMessage(ClientListenerNioListener.java:55)
        at 
org.apache.ignite.internal.util.nio.GridNioFilterChain$TailFilter.onMessageReceived(GridNioFilterChain.java:279)
        at 
org.apache.ignite.internal.util.nio.GridNioFilterAdapter.proceedMessageReceived(GridNioFilterAdapter.java:109)
        at 
org.apache.ignite.internal.util.nio.GridNioAsyncNotifyFilter$3.body(GridNioAsyncNotifyFilter.java:97)
        at 
org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
        at 
org.apache.ignite.internal.util.worker.GridWorkerPool$1.run(GridWorkerPool.java:70)
        at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.ClassNotFoundException: ThinClient$1
        at 
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
        at 
java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:398)
        at 
org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:9064)
        at 
org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:9002)
        at 
org.apache.ignite.internal.MarshallerContextImpl.getClass(MarshallerContextImpl.java:376)
        at 
org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:693)
        ... 17 more



在 2021/12/10 17:39, Pavel Tupitsyn 写道:
> Thin client scan query supports any predicates.
> However, make sure that predicate is deployed on all server nodes so 
> it can be executed.
>
> Please share the exception details.
>
> On Fri, Dec 10, 2021 at 11:53 AM 38797715 <38...@qq.com> wrote:
>
>     An exception will be throw when the following code is executed:
>
>     The ScanQuery in the thin client does not support IgniteBiPredicate?
>
>
>     publicclassThinClient{
>     publicstaticvoidmain(String[] args) throwsClientException, Exception{
>     ClientConfigurationcfg=
>     newClientConfiguration().setAddresses("localhost:10800");
>     try(IgniteClientclient= Ignition.startClient(cfg)) {
>     ClientCache<Integer, Person> cache2=
>     client.getOrCreateCache("cache2");
>     for(inti= 1; i<= 10; i++) {
>     cache2.put(i, newPerson((long)i, "a", "b"));
>     }
>     ClientCache<BinaryObject, BinaryObject> cache3=
>     client.getOrCreateCache("cache2").withKeepBinary();
>     IgniteBiPredicate<BinaryObject, BinaryObject> filter=
>     newIgniteBiPredicate<BinaryObject, BinaryObject>() {
>     @Overridepublicbooleanapply(BinaryObjectkey, BinaryObjectperson) {
>     returnperson.<Long>field("id") > 6;
>     }
>     };
>     try(QueryCursor<Entry<BinaryObject, BinaryObject>> cur3=
>     cache3.query(newScanQuery<>(filter))) {
>     for(Cache.Entry<BinaryObject, BinaryObject> entry:cur3) {
>     System.out.println(entry.getValue());
>     }
>     }
>     }
>     }
>     }
>

Re: IgniteBiPredicate in ThinClient ScanQuery:java.lang.ClassNotFoundException

Posted by Pavel Tupitsyn <pt...@apache.org>.
Thin client scan query supports any predicates.
However, make sure that predicate is deployed on all server nodes so it can
be executed.

Please share the exception details.

On Fri, Dec 10, 2021 at 11:53 AM 38797715 <38...@qq.com> wrote:

> An exception will be throw when the following code is executed:
>
> The ScanQuery in the thin client does not support IgniteBiPredicate?
>
>
> public class ThinClient {
> public static void main(String[] args) throws ClientException, Exception {
> ClientConfiguration cfg = new ClientConfiguration().setAddresses(
> "localhost:10800");
> try (IgniteClient client = Ignition.startClient(cfg)) {
> ClientCache<Integer, Person> cache2 = client.getOrCreateCache("cache2");
> for (int i = 1; i <= 10; i++) {
> cache2.put(i, new Person((long)i, "a", "b"));
> }
> ClientCache<BinaryObject, BinaryObject> cache3 = client.getOrCreateCache(
> "cache2").withKeepBinary();
> IgniteBiPredicate<BinaryObject, BinaryObject> filter = new
> IgniteBiPredicate<BinaryObject, BinaryObject>() {
> @Override public boolean apply(BinaryObject key, BinaryObject person) {
> return person.<Long>field("id") > 6;
> }
> };
> try (QueryCursor<Entry<BinaryObject, BinaryObject>> cur3 = cache3.query(
> new ScanQuery<>(filter))) {
> for (Cache.Entry<BinaryObject, BinaryObject> entry : cur3) {
> System.out.println(entry.getValue());
> }
> }
> }
> }
> }
>