Hey,
They are deployed already. What itbis complaining about is the lambda
inside stream.map(). If I remove it, it works fine.

Question is how can we work around stream operations which always take
lambda function.

On Sun, 3 Apr 2022, 00:15 Ilya Shishkov, <shishkovi...@gmail.com> wrote:

> Hi Surinder,
>
> Your tasks and nested classes should be in the class path of the
> server node. You can deploy them manually or automatically by means of
> peer-class loading [1].
>
> 1.
> https://ignite.apache.org/docs/latest/code-deployment/peer-class-loading
>
> пт, 1 апр. 2022 г. в 15:12, Surinder Mehra <redni...@gmail.com>:
>
>> Hi, I am trying to return the result stream from ignite compute task.
>> When compute task has a map() on stream it fails with below error . Can
>> someone please explain.
>>
>> "Exception in thread "main" class
>> org.apache.ignite.binary.BinaryObjectException: Failed to deserialize
>> object [typeName=java.util.stream.ReferencePipeline$3]"
>>
>> Setup: One default ignite node
>> Compute task
>> client node to submit compute task and collect the stream results.
>>
>> public class StreamTask implements IgniteCallable<Stream<Department>> {
>>     @Override
>>     public Stream<Department> call() throws Exception {
>>
>>         Function<Integer, Department> integerDepartmentFunction = i -> new 
>> MyFunction().apply(i);
>>         return IntStream.of(1, 2, 3).boxed().map(integerDepartmentFunction);
>>     }
>> }
>>
>> class MyFunction implements Function<Integer, Department> {
>>     @Override
>>     public Department apply(Integer integer) {
>>         return new Department(integer, "sdf"+ integer);
>>     }
>> }
>>
>>
>> IgniteConfiguration cfg = new IgniteConfiguration();
>> cfg.setClientMode(true);
>> try (Ignite ignite = Ignition.start(cfg)) {
>>
>>     ClusterGroup serversGrp = ignite.cluster().forServers();
>>
>>     Stream<Department> stream = ignite.compute(serversGrp).call(new 
>> StreamTask());
>>     System.out.println("Stream : "+ stream.collect(Collectors.toList()));
>>
>> }
>>
>> Error:
>>
>> Exception in thread "main" class 
>> org.apache.ignite.binary.BinaryObjectException: Failed to deserialize object 
>> [typeName=java.util.stream.ReferencePipeline$3]
>>      at 
>> org.apache.ignite.internal.binary.BinaryClassDescriptor.read(BinaryClassDescriptor.java:971)
>>      at 
>> org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1769)
>>      at 
>> org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1721)
>>      at 
>> org.apache.ignite.internal.binary.GridBinaryMarshaller.deserialize(GridBinaryMarshaller.java:319)
>>      at 
>> org.apache.ignite.internal.binary.GridBinaryMarshaller.deserialize(GridBinaryMarshaller.java:304)
>>      at 
>> org.apache.ignite.internal.binary.BinaryMarshaller.unmarshal0(BinaryMarshaller.java:101)
>>      at 
>> org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.unmarshal(AbstractNodeNameAwareMarshaller.java:80)
>>      at 
>> org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:10540)
>>
>> Caused by: java.lang.ClassNotFoundException: 
>> training.ignite.compute.StreamTask$$Lambda$894/0x0000000800670840
>>      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)
>>
>>

Reply via email to