"无法反序列化对象"在点火缓存中插入对象时发生错误

时间:2017-09-06 11:20:01

标签: java apache ignite

在字符串键上插入pojoClass对象时发生以下错误。我在Ignite配置中包含了所有事件类型。

我已尝试if pathname.startswith('/usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/'): paths = pathname.split('/') return 'C:\\Python36\\Lib\\site-packages\\numpy\\core\include\\numpy\\'+paths[-1] 并尝试了setStoreKeepBinary(true),但错误并未解决。

我使用的是Apache Ignite 2.1版。

错误日志:

igniteConfiguration.setPeerClassLoadingEnabled(true)

缓存配置:

[2017-09-06 16:22:08,043][ERROR][tcp-client-disco-msg-worker-#4%null%]     [TcpDiscoverySpi] Failed to unmarshal discovery data for component: 0
class org.apache.ignite.IgniteCheckedException: Failed to deserialize object with given class loader: sun.misc.Launcher$AppClassLoader@75b84c92
    at org.apache.ignite.marshaller.jdk.JdkMarshaller.unmarshal0(JdkMarshaller.java:129)
    at org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.unmarshal(AbstractNodeNameAwareMarshaller.java:94)
    at org.apache.ignite.marshaller.jdk.JdkMarshaller.unmarshal0(JdkMarshaller.java:143)
    at org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.unmarshal(AbstractNodeNameAwareMarshaller.java:82)
    at org.apache.ignite.spi.discovery.tcp.internal.DiscoveryDataPacket.unmarshalData(DiscoveryDataPacket.java:274)
    at org.apache.ignite.spi.discovery.tcp.internal.DiscoveryDataPacket.unmarshalGridData(DiscoveryDataPacket.java:131)
    at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.onExchange(TcpDiscoverySpi.java:1820)
    at org.apache.ignite.spi.discovery.tcp.ClientImpl$MessageWorker.processNodeAddFinishedMessage(ClientImpl.java:1985)
    at org.apache.ignite.spi.discovery.tcp.ClientImpl$MessageWorker.processDiscoveryMessage(ClientImpl.java:1864)
    at org.apache.ignite.spi.discovery.tcp.ClientImpl$MessageWorker.body(ClientImpl.java:1758)
    at org.apache.ignite.spi.IgniteSpiThread.run(IgniteSpiThread.java:62)
Caused by: java.io.InvalidObjectException: Failed to find cache for name: CACHE
    at org.apache.ignite.internal.processors.cache.GridCacheContext.readResolve(GridCacheContext.java:2139)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1148)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2036)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxy.readExternal(IgniteCacheProxy.java:2782)
    at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:2076)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2025)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2245)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2125)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2027)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2245)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2125)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2027)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
    at org.apache.ignite.internal.GridEventConsumeHandler.readExternal(GridEventConsumeHandler.java:452)
    at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:2076)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2025)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
    at org.apache.ignite.internal.processors.continuous.GridContinuousProcessor$DiscoveryDataItem.readExternal(GridContinuousProcessor.java:1812)
    at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:2076)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2025)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
    at org.apache.ignite.internal.util.IgniteUtils.readList(IgniteUtils.java:5299)
    at org.apache.ignite.internal.util.IgniteUtils.readCollection(IgniteUtils.java:1739)
    at org.apache.ignite.internal.processors.continuous.GridContinuousProcessor$DiscoveryData.readExternal(GridContinuousProcessor.java:1727)
    at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:2076)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2025)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
    at org.apache.ignite.marshaller.jdk.JdkMarshaller.unmarshal0(JdkMarshaller.java:121)
    ... 10 more
Caused by: java.lang.IllegalStateException: Failed to find cache for name: CACHE
    at org.apache.ignite.internal.processors.cache.GridCacheContext.readResolve(GridCacheContext.java:2134)
    ... 49 more

代码插入pojoClass对象时:

  CacheConfiguration<String, pojoClass> cacheConfig = new CacheConfiguration<>();
            cacheConfig.setName("CACHE");
            cacheConfig.setBackups(2);
            cacheConfig.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
            cacheConfig.setIndexedTypes(String.class, pojoClass.class);
        //  cacheConfig.setStoreKeepBinary(true);
            IgniteCache<String, pojoClass> Cache = ignite.getOrCreateCache(cacheConfig);

这里PojoClass是:

PojoClass pojoObj = new PojoClass(key, name,jsonObject);
Cache.put(key, pojoObj);    

1 个答案:

答案 0 :(得分:1)

在创建缓存和执行事件功能时使用相同的Ignite实例后出现错误我正在使用上面出现的不同Ignite实例。