[ 
https://issues.apache.org/jira/browse/IGNITE-26530?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vadim Pakhnushev updated IGNITE-26530:
--------------------------------------
    Description: 
{{ByteArrayMarshaller.create}} creates an instance of the marshaller that uses 
the class loader of the created instance to resolve the class for creating 
object to unmarshal.
The class loader of {{ByteArrayMarshaller}} is an application class loader 
because the class matches the system classes pattern (its name starts with 
{{org.apache.ignite}}).
So when we try to infer the class loader to load the class to unmarshal, we use 
application class loader but we should use job class loader.
To reproduce this, deploy a job with a custom argument class and overridden 
{{inputMarshaller}} that returns {{ByteArrayMarshaller.create()}}.
Then submit this job using the 
{{argumentMarshaller(ByteArrayMarshaller.create())}} in the {{JobDescriptor}}.
The result is the following exception:

{noformat}
Caused by: java.lang.ClassNotFoundException: 
org.apache.ignite.example.compute.ComputeWithCustomArgumentMarshallerExample$CustomArgument
        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:526)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:398)
        at 
java.base/java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:763)
        at 
org.apache.ignite.marshalling.ByteArrayMarshaller$2.resolveClass(ByteArrayMarshaller.java:84)
{noformat}


  was:
{{ByteArrayMarshaller.create}} creates an instance of the marshaller that uses 
the class loader of the created instance to resolve the class for creating 
object to unmarshal.
The class loader of {{ByteArrayMarshaller}} is an application class loader 
because the class matches the system classes pattern (its name starts with 
{{org.apache.ignite}}).
So when we try to infer the class loader to load the class to unmarshal, we use 
application class loader but we should use job class loader.
To reproduce this, deploy a job with a custom argument class and overridden 
{{inputMarshaller}} that returns {{ByteArrayMarshaller.create()}}.
Then submit this job using the 
{{argumentMarshaller(ByteArrayMarshaller.create())}} in the {{JobDescriptor}}.
The result is the following exception:

{noformat}
Caused by: java.lang.ClassNotFoundException: 
org.apache.ignite.internal.network.compatibilitytests.jobs.DeserializeJobParams
        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:526)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:398)
        at 
java.base/java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:763)
        at 
org.apache.ignite.marshalling.ByteArrayMarshaller$2.resolveClass(ByteArrayMarshaller.java:84)
{noformat}



> ByteArrayMarshaller.create doesn't work
> ---------------------------------------
>
>                 Key: IGNITE-26530
>                 URL: https://issues.apache.org/jira/browse/IGNITE-26530
>             Project: Ignite
>          Issue Type: Bug
>          Components: compute ai3
>            Reporter: Vadim Pakhnushev
>            Assignee: Vadim Pakhnushev
>            Priority: Major
>              Labels: ignite-3
>         Attachments: ComputeWithCustomArgumentMarshallerExample.java
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {{ByteArrayMarshaller.create}} creates an instance of the marshaller that 
> uses the class loader of the created instance to resolve the class for 
> creating object to unmarshal.
> The class loader of {{ByteArrayMarshaller}} is an application class loader 
> because the class matches the system classes pattern (its name starts with 
> {{org.apache.ignite}}).
> So when we try to infer the class loader to load the class to unmarshal, we 
> use application class loader but we should use job class loader.
> To reproduce this, deploy a job with a custom argument class and overridden 
> {{inputMarshaller}} that returns {{ByteArrayMarshaller.create()}}.
> Then submit this job using the 
> {{argumentMarshaller(ByteArrayMarshaller.create())}} in the {{JobDescriptor}}.
> The result is the following exception:
> {noformat}
> Caused by: java.lang.ClassNotFoundException: 
> org.apache.ignite.example.compute.ComputeWithCustomArgumentMarshallerExample$CustomArgument
>       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:526)
>       at java.base/java.lang.Class.forName0(Native Method)
>       at java.base/java.lang.Class.forName(Class.java:398)
>       at 
> java.base/java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:763)
>       at 
> org.apache.ignite.marshalling.ByteArrayMarshaller$2.resolveClass(ByteArrayMarshaller.java:84)
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to