Hi,
I saw other questions related org.apache.ignite.IgniteCheckedException:
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) exception,but not find my answer.

I have one remote server node,and from local client node I discover that
server node.
Now from client node I want to create cache-
p.s. <property name="peerClassLoadingEnabled" value="true"/> added for 2
configurations
my code is following 

private final CacheConfiguration<EntityIdLoader.EntityIdCacheKey,
List&lt;Integer>> cacheConfiguration =
SpringContextHolder.applicationContext
                        .getBean("cacheConfigurationTemplate", 
CacheConfiguration.class);

ignite.createCache((CacheConfiguration<EntityIdLoader.EntityIdCacheKey,
List&lt;Integer>>)new
CacheConfiguration<>(cacheConfiguration).setName(CACHE_NAME)
                                                .setReadThrough(true)
                                                .setCacheLoaderFactory(new 
EntityIdLoaderFactory())
                                                
.setExpiryPolicyFactory(EternalExpiryPolicy.factoryOf())))



public  class EntityIdLoaderFactory
                implements Factory<EntityIdLoader> {

        private static final long serialVersionUID = 7512841233166239706L;

        @Override
        public EntityIdLoader create() {
                return new EntityIdLoader(
                                () ->
SpringContextHolder.applicationContext.getBean("persistenceService",
PersistenceService.class),
                                () -> 
SpringContextHolder.applicationContext.getBean("kbEngine",
KbEngine.class));
        }

}




public class EntityIdLoader implements
CacheLoader<EntityIdLoader.EntityIdCacheKey, List&lt;Integer>> {

    @Nonnull
    private final Supplier<PersistenceService> persistenceService;
    @Nonnull
    private final Supplier<KbEngine> kbEngine;

    public EntityIdLoader(@Nonnull Supplier<PersistenceService>
persistenceService, @Nonnull Supplier<KbEngine> kbEngine) {
        this.kbEngine = Preconditions.checkNotNull(kbEngine);
        this.persistenceService =
Preconditions.checkNotNull(persistenceService);
    }

....................................
}


during  creating cache ,on remote node brings exception

class org.apache.ignite.IgniteCheckedException: 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):
java.net.URLClassLoader@738defde       at
org.apache.ignite.marshaller.jdk.JdkMarshaller.unmarshal(JdkMarshaller.java:108)
        at
org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryCustomEventMessage.message(TcpDiscoveryCustomEventMessage.java:80)
        at
org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.notifyDiscoveryListener(ServerImpl.java:4894)
      
at
org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.processCustomMessage(ServerImpl.java:4750)
        at
org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.processMessage(ServerImpl.java:2121)
        at
org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.body(ServerImpl.java:2208)07)
        at
org.apache.ignite.spi.IgniteSpiThread.run(IgniteSpiThread.java:62)
Caused by: java.lang.ClassNotFoundException:
com.synisys.idm.apollo.internal.service.caching.loaders.EntityIdLoaderFactory   
  
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425):354)
        at java.lang.Class.forName0(Native Method)ader.java:358)
        at
org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:8250)
        at
org.apache.ignite.marshaller.jdk.JdkMarshallerObjectInputStream.resolveClass(JdkMarshallerObjectInputStream.java:54)
        at
java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1517)12)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)a:1771)
        at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1915)90)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)a:1798)
        at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1915)90)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)a:1798)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
        at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)
        at
java.lang.reflect.Method.invoke(Method.java:606)DelegatingMethodAccessorImpl.java:43)
        at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1893)7)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)a:1798)
        at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1915)90)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)a:1798)
        at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1915)90)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)a:1798)
        at
org.apache.ignite.marshaller.jdk.JdkMarshaller.unmarshal(JdkMarshaller.java:102)
        ... 9 more

Jun 27, 2016 11:18:37 AM org.apache.ignite.logger.java.JavaLogger error
SEVERE: Failed to unmarshal discovery custom message.
class org.apache.ignite.IgniteCheckedException: 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):
java.net.URLClassLoader@738defde
        at
org.apache.ignite.marshaller.AbstractMarshaller.unmarshal(AbstractMarshaller.java:78)
        at
org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryCustomEventMessage.message(TcpDiscoveryCustomEventMessage.jaat
org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.processCustomMessage(ServerImpl.java:4768)
        at
org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.processMessage(ServerImpl.java:2121)
        at
org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.body(ServerImpl.java:2208)07)
        at
org.apache.ignite.spi.IgniteSpiThread.run(IgniteSpiThread.java:62)
Caused by: java.lang.ClassNotFoundException:
com.synisys.idm.apollo.internal.service.caching.loaders.EntityIdLoaderFactory   
  
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425):354)
        at java.lang.Class.forName0(Native Method)ader.java:358)
        at
org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:8250)
        at
org.apache.ignite.marshaller.jdk.JdkMarshallerObjectInputStream.resolveClass(JdkMarshallerObjectInputStream.java:54)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1612)
        at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
        at
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1990)
        at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798)
        at
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1990)
        at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798)
        at
java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)0)
        at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)
        at
java.lang.reflect.Method.invoke(Method.java:606)DelegatingMethodAccessorImpl.java:43)
        at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1893)7)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)a:1798)
        at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1915)90)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)a:1798)
        at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1915)90)
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)a:1798)
        at
org.apache.ignite.marshaller.jdk.JdkMarshaller.unmarshal(JdkMarshaller.java:102)
        ... 8 more



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Creating-cache-with-CacheLoaderFactory-on-client-node-brings-exception-org-apache-ignite-IgniteCheck-tp5915.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to