gridgain - Apache Ignite Compute Task - ClassNotFoundException for Peer-Class Loading - Stack Overflow

I am working with Apache Ignite (version 2.17.0) and have a setup where I create ad-hoc caches from the

I am working with Apache Ignite (version 2.17.0) and have a setup where I create ad-hoc caches from the client-side with peer class loading enabled. Additionally, I have a server-side node running in server mode.

My requirement is to execute a compute task from the client-side that extends SplitComputeTaskAdapter to run scan queries on the cache. However, when executing the compute task, I am encountering the following error:

Error Log

Caused by: java.lang.ClassNotFoundException: com.ignite.proxy.spring.jpa.pojo.Abc
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) ~[na:na]
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[na:na]
    at java.base/java.lang.Class.forName0(Native Method) ~[na:na]
    at java.base/java.lang.Class.forName(Class.java:398) ~[na:na]
    at .apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:9348) ~[ignite-core-2.17.0.jar:2.17.0]
    at .apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:9286) ~[ignite-core-2.17.0.jar:2.17.0]
    at .apache.ignite.internal.MarshallerContextImpl.getClass(MarshallerContextImpl.java:397) ~[ignite-core-2.17.0.jar:2.17.0]
    at .apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:717) ~[ignite-core-2.17.0.jar:2.17.0]
    ... 28 common frames omitted

My Configuration Peer-Class Loading:

  • peerClassLoadingEnabled = true is set on both the client-side and server-side.

Binary Configuration (Server-Side):

BinaryConfiguration binCfg = new BinaryConfiguration();
binCfg.setNameMapper(new BinaryBasicNameMapper().setSimpleName(true));
binCfg.setIdMapper(new BinaryBasicIdMapper());

Binary Configuration (Client-Side):

BinaryConfiguration binCfg = new BinaryConfiguration();
binCfg.setNameMapper(new BinaryBasicNameMapper().setSimpleName(true));
binCfg.setIdMapper(new BinaryBasicIdMapper());

What I've Tried:

  • Verified that peer-class loading is enabled on both client and Server.
  • Ensured that the compute task is deployed on the client-side.
  • Checked if the class exists in the client project and is accessible.
  • Confirmed that binary marshalling configuration is consistent between the server and client.

Question: Why am I encountering ClassNotFoundException even though peer-class loading is enabled? How can I ensure that the compute task and related classes are properly loaded when executing the task on the server?

Any insights or solutions would be greatly appreciated. Thanks!

I am working with Apache Ignite (version 2.17.0) and have a setup where I create ad-hoc caches from the client-side with peer class loading enabled. Additionally, I have a server-side node running in server mode.

My requirement is to execute a compute task from the client-side that extends SplitComputeTaskAdapter to run scan queries on the cache. However, when executing the compute task, I am encountering the following error:

Error Log

Caused by: java.lang.ClassNotFoundException: com.ignite.proxy.spring.jpa.pojo.Abc
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) ~[na:na]
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[na:na]
    at java.base/java.lang.Class.forName0(Native Method) ~[na:na]
    at java.base/java.lang.Class.forName(Class.java:398) ~[na:na]
    at .apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:9348) ~[ignite-core-2.17.0.jar:2.17.0]
    at .apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:9286) ~[ignite-core-2.17.0.jar:2.17.0]
    at .apache.ignite.internal.MarshallerContextImpl.getClass(MarshallerContextImpl.java:397) ~[ignite-core-2.17.0.jar:2.17.0]
    at .apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:717) ~[ignite-core-2.17.0.jar:2.17.0]
    ... 28 common frames omitted

My Configuration Peer-Class Loading:

  • peerClassLoadingEnabled = true is set on both the client-side and server-side.

Binary Configuration (Server-Side):

BinaryConfiguration binCfg = new BinaryConfiguration();
binCfg.setNameMapper(new BinaryBasicNameMapper().setSimpleName(true));
binCfg.setIdMapper(new BinaryBasicIdMapper());

Binary Configuration (Client-Side):

BinaryConfiguration binCfg = new BinaryConfiguration();
binCfg.setNameMapper(new BinaryBasicNameMapper().setSimpleName(true));
binCfg.setIdMapper(new BinaryBasicIdMapper());

What I've Tried:

  • Verified that peer-class loading is enabled on both client and Server.
  • Ensured that the compute task is deployed on the client-side.
  • Checked if the class exists in the client project and is accessible.
  • Confirmed that binary marshalling configuration is consistent between the server and client.

Question: Why am I encountering ClassNotFoundException even though peer-class loading is enabled? How can I ensure that the compute task and related classes are properly loaded when executing the task on the server?

Any insights or solutions would be greatly appreciated. Thanks!

Share Improve this question asked Mar 21 at 13:16 prashant notaniprashant notani 11 bronze badge 2
  • Is Abc a POJO used to define the content of one of your tables? – Stephen Darlington Commented Mar 21 at 13:42
  • yes ,we have loaded the database tables in Ignite we query them and form the structured result and then set in the Abc pojo like a cache aside with the key but when we access that cache in the scan query to filter inside compute task on client side it gives error – prashant notani Commented Mar 21 at 13:45
Add a comment  | 

1 Answer 1

Reset to default 0

While you can use peer class loading for classes used for compute, it's not possible to use it to deploy "model" classes.

You can manually copy the JAR file containing your model classes to the server nodes, use URI deployment, or managed deployment if you're using GridGain's Control Center.

You can continue to use peer class loading for the rest of the code.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744350804a4569963.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信