Failed to start SPI using custom class loader

classic Classic list List threaded Threaded
3 messages Options
Paolo Di Tommaso Paolo Di Tommaso
Reply | Threaded
Open this post in threaded view
|

Failed to start SPI using custom class loader

Hello, 

I'm experiencing a weird error while launching Ignite with a custom classloader. 

It fails to join the cluster with the error reported below. 

It reports that cannot load the class  `DiscoveryDataClusterState` using the classloader `sun.misc.Launcher$AppClassLoader@27716f4`. 

I think this is the problem because it should use the classloader that I've specified via the IgniteConfiguration.setClassLoader method, however, it seems that it still tries to use the default one. 


Caused by: org.apache.ignite.IgniteCheckedException: Failed to start SPI: TcpDiscoverySpi [addrRslvr=null, sockTimeout=5000, ackTimeout=5000, marsh=JdkMarshaller [clsFilter=org.apache.ignite.internal.IgniteKernal$5@5c059a68], reconCnt=10, reconDelay=2000, maxAckTimeout=600000, forceSrvMode=false, clientReconnectDisabled=false]
at org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:300)
at org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.start(GridDiscoveryManager.java:892)
at org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1669)
... 57 common frames omitted
Caused by: org.apache.ignite.spi.IgniteSpiException: Error on unmarshalling discovery data from node 0:0:0:0:0:0:0:1%lo0,127.0.0.1,192.168.1.129: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=sun.misc.Launcher$AppClassLoader@27716f4, cls=org.apache.ignite.internal.processors.cluster.DiscoveryDataClusterState]; node is not allowed to join
at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.checkFailedError(TcpDiscoverySpi.java:1856)
at org.apache.ignite.spi.discovery.tcp.ServerImpl.joinTopology(ServerImpl.java:932)
at org.apache.ignite.spi.discovery.tcp.ServerImpl.spiStart(ServerImpl.java:364)
at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.spiStart(TcpDiscoverySpi.java:1930)
at org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:297)
... 59 common frames omitted


Any clue what's wrong? 


Paolo


ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Failed to start SPI using custom class loader

Hello!

Do you have a reproducer for this issue for us to try?

Regards,
--
Ilya Kasnacheev


сб, 7 нояб. 2020 г. в 21:27, Paolo Di Tommaso <[hidden email]>:
Hello, 

I'm experiencing a weird error while launching Ignite with a custom classloader. 

It fails to join the cluster with the error reported below. 

It reports that cannot load the class  `DiscoveryDataClusterState` using the classloader `sun.misc.Launcher$AppClassLoader@27716f4`. 

I think this is the problem because it should use the classloader that I've specified via the IgniteConfiguration.setClassLoader method, however, it seems that it still tries to use the default one. 


Caused by: org.apache.ignite.IgniteCheckedException: Failed to start SPI: TcpDiscoverySpi [addrRslvr=null, sockTimeout=5000, ackTimeout=5000, marsh=JdkMarshaller [clsFilter=org.apache.ignite.internal.IgniteKernal$5@5c059a68], reconCnt=10, reconDelay=2000, maxAckTimeout=600000, forceSrvMode=false, clientReconnectDisabled=false]
at org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:300)
at org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.start(GridDiscoveryManager.java:892)
at org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1669)
... 57 common frames omitted
Caused by: org.apache.ignite.spi.IgniteSpiException: Error on unmarshalling discovery data from node 0:0:0:0:0:0:0:1%lo0,127.0.0.1,192.168.1.129: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=sun.misc.Launcher$AppClassLoader@27716f4, cls=org.apache.ignite.internal.processors.cluster.DiscoveryDataClusterState]; node is not allowed to join
at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.checkFailedError(TcpDiscoverySpi.java:1856)
at org.apache.ignite.spi.discovery.tcp.ServerImpl.joinTopology(ServerImpl.java:932)
at org.apache.ignite.spi.discovery.tcp.ServerImpl.spiStart(ServerImpl.java:364)
at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.spiStart(TcpDiscoverySpi.java:1930)
at org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:297)
... 59 common frames omitted


Any clue what's wrong? 


Paolo


Paolo Di Tommaso Paolo Di Tommaso
Reply | Threaded
Open this post in threaded view
|

Re: Failed to start SPI using custom class loader

Not easily. However, I've managed to solve this issue by setting the current thread context class loader with the expected one. 

        final old = Thread.currentThread().getContextClassLoader()
        try {
            final loader = IgnitePlugin.class.getClassLoader()
            Thread.currentThread().setContextClassLoader(loader)
            Ignition.start( config() )
        }
        finally {
            Thread.currentThread().setContextClassLoader(old)
        } 


p

On Mon, Nov 9, 2020 at 11:54 AM Ilya Kasnacheev <[hidden email]> wrote:
Hello!

Do you have a reproducer for this issue for us to try?

Regards,
--
Ilya Kasnacheev


сб, 7 нояб. 2020 г. в 21:27, Paolo Di Tommaso <[hidden email]>:
Hello, 

I'm experiencing a weird error while launching Ignite with a custom classloader. 

It fails to join the cluster with the error reported below. 

It reports that cannot load the class  `DiscoveryDataClusterState` using the classloader `sun.misc.Launcher$AppClassLoader@27716f4`. 

I think this is the problem because it should use the classloader that I've specified via the IgniteConfiguration.setClassLoader method, however, it seems that it still tries to use the default one. 


Caused by: org.apache.ignite.IgniteCheckedException: Failed to start SPI: TcpDiscoverySpi [addrRslvr=null, sockTimeout=5000, ackTimeout=5000, marsh=JdkMarshaller [clsFilter=org.apache.ignite.internal.IgniteKernal$5@5c059a68], reconCnt=10, reconDelay=2000, maxAckTimeout=600000, forceSrvMode=false, clientReconnectDisabled=false]
at org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:300)
at org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.start(GridDiscoveryManager.java:892)
at org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1669)
... 57 common frames omitted
Caused by: org.apache.ignite.spi.IgniteSpiException: Error on unmarshalling discovery data from node 0:0:0:0:0:0:0:1%lo0,127.0.0.1,192.168.1.129: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=sun.misc.Launcher$AppClassLoader@27716f4, cls=org.apache.ignite.internal.processors.cluster.DiscoveryDataClusterState]; node is not allowed to join
at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.checkFailedError(TcpDiscoverySpi.java:1856)
at org.apache.ignite.spi.discovery.tcp.ServerImpl.joinTopology(ServerImpl.java:932)
at org.apache.ignite.spi.discovery.tcp.ServerImpl.spiStart(ServerImpl.java:364)
at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.spiStart(TcpDiscoverySpi.java:1930)
at org.apache.ignite.internal.managers.GridManagerAdapter.startSpi(GridManagerAdapter.java:297)
... 59 common frames omitted


Any clue what's wrong? 


Paolo