You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by ol...@reseguiden.se on 2019/03/29 14:42:52 UTC
Classloading problem prevents joining nodes started in Karaf into cluster
Hello
I'm running Ignite node (v. 2.7.0) inside Karaf 4.2.0 as part of my
application.
The problem that I discovered that I'm unable to join multiple such nodes
into a cluster.
When a new node is joining an existing node it sends its node data which is
supposed to be unmarshalled and validated in
org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor.vali
dateNode(). The thing is that existing node cannot unmarshal the data and
therefore rejects join request from new node. Error is:
Error on unmarshalling discovery data from node
10.0.2.15,127.0.0.1,172.17.0.1:47501: Failed to find class with given class
loader for unmarshalling (make sure same versions of all classes are
available on all nodes or enable peer-class-loading)
[clsLdr=jdk.internal.loader.ClassLoaders$AppClassLoader@5c0369c4,
cls=org.apache.ignite.internal.processors.cluster.DiscoveryDataClusterState]
; node is not allowed to join
This is the code that does unmarshalling:
joiningNodeState = marsh.unmarshal((byte[]) discoData.joiningNodeData(),
Thread.currentThread().getContextClassLoader());
(link to line
https://github.com/apache/ignite/blob/924139d0a8929e46634f91c5be87c9b9dc2cbb
11/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/
GridClusterStateProcessor.java#L967)
Apparently jdk.internal.loader.ClassLoaders$AppClassLoader@ is returned from
Thread.currentThread().getContextClassLoader().
But this won't work for OSGI because classes of ignite-osgi are only
available in bundle classloader and none of them are available in any other
classloader!
There's special classloader created for Ignite in ignite-osgi module in
IgniteAbstractOsgiContextActivator.start() and propagated to
IgniteConfiguration object ( line
https://github.com/apache/ignite/blob/924139d0a8929e46634f91c5be87c9b9dc2cbb
11/modules/osgi/src/main/java/org/apache/ignite/osgi/IgniteAbstractOsgiConte
xtActivator.java#L102)
Question is what this special classloader is used for and why it doesn't
appear in output from Thread.currentThread().getContextClassLoader()in
GridClusterStateProcessor.validateNode().
Just in case, here is link to my project on GitHub:
https://github.com/leshkm/karaf-ignite-test
Best regards,
Oleksii
Re: Classloading problem prevents joining nodes started in Karaf into cluster
Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!
I doubt we have expertise on karaf/OSGi here. I'm afraid you will have to
file ticket and propose a solution.
Can you also determine when did it break?
Regards,
--
Ilya Kasnacheev
пт, 29 мар. 2019 г. в 17:42, <ol...@reseguiden.se>:
> Hello
>
>
>
> I’m running Ignite node (v. 2.7.0) inside Karaf 4.2.0 as part of my
> application.
>
>
>
> The problem that I discovered that I’m unable to join multiple such nodes
> into a cluster.
>
>
>
> When a new node is joining an existing node it sends its node data which
> is supposed to be unmarshalled and validated in
> org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor.validateNode().
> The thing is that existing node cannot unmarshal the data and therefore
> rejects join request from new node. Error is:
>
>
>
> Error on unmarshalling discovery data from node 10.0.2.15,127.0.0.1,
> 172.17.0.1:47501: Failed to find class with given class loader for
> unmarshalling (make sure same versions of all classes are available on all
> nodes or enable peer-class-loading)
> [clsLdr=jdk.internal.loader.ClassLoaders$AppClassLoader@5c0369c4,
> cls=org.apache.ignite.internal.processors.cluster.DiscoveryDataClusterState];
> node is not allowed to join
>
>
>
> This is the code that does unmarshalling:
>
>
>
> joiningNodeState = marsh.unmarshal((byte[]) discoData.joiningNodeData(),
> Thread.currentThread().getContextClassLoader());
>
>
>
> (link to line
> https://github.com/apache/ignite/blob/924139d0a8929e46634f91c5be87c9b9dc2cbb11/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java#L967
> )
>
>
>
> Apparently jdk.internal.loader.ClassLoaders$AppClassLoader@ is returned
> from Thread.currentThread().getContextClassLoader().
>
>
>
> But *this won’t work for OSGI* because classes of ignite-osgi are only
> available in bundle classloader and none of them are available in any other
> classloader!
>
>
>
> There’s special classloader created for Ignite in ignite-osgi module in
> IgniteAbstractOsgiContextActivator.start() and propagated to
> IgniteConfiguration object ( line
> https://github.com/apache/ignite/blob/924139d0a8929e46634f91c5be87c9b9dc2cbb11/modules/osgi/src/main/java/org/apache/ignite/osgi/IgniteAbstractOsgiContextActivator.java#L102
> )
>
>
>
> Question is what this special classloader is used for and why it doesn’t
> appear in output from Thread.currentThread().getContextClassLoader()in
> GridClusterStateProcessor.validateNode().
>
>
>
> Just in case, here is link to my project on GitHub:
> https://github.com/leshkm/karaf-ignite-test
>
>
>
> Best regards,
>
> Oleksii
>