title: java.io.NotSerializableException while writing to Oracle Coherence cache
body: <p>I have 2 storage enabled cache nodes that i am trying to use for pre-loading of cache. About 1 million accounts are to be loaded by these 2 storage enabled nodes. Both key and value are <code>String</code> objects which I am trying to write to cache. I am using <code>InvocationService.execute()</code> method to invoke the pre-loading tasks asynchronously:</p>
  
  <pre class="lang-java prettyprint-override"><code>for (Map.Entry&lt;Member, LoaderInvocable&gt; entry : mappedWork.entrySet()) {
      Member member = entry.getKey();
      LoaderInvocable task = entry.getValue();
      invocationService.execute(task, Collections.singleton(member), null);
  }
  </code></pre>
  
  <p><code>LoaderInvocable</code> is a class that is implementing <code>Invocable</code> and <code>Serializable</code> interfaces and its <code>run()</code> method has been overridden to performs the actual work of reading from database and writing to the cache.</p>
  
  <p><code>InvocationService</code> is defined as below in the coherence config file:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;invocation-scheme&gt;
        &lt;scheme-name&gt;
        InvocationScheme&lt;/scheme-name&gt;
        &lt;service-name&gt;
        LoaderInvocationService&lt;/service-name&gt;
        &lt;autostart system-property="tangosol.coherence.invocation.autostart"&gt;true&lt;/autostart&gt;
   &lt;/invocation-scheme&gt;   
  </code></pre>
  
  <p>Below is the exception that i am getting:</p>
  
  <pre><code>2016-02-22 17:16:24,612 [pool-1-thread-1] ERROR (support.context.SessionExecutable) Caught exception from SessionExecutable.execute()
  (Wrapped) java.io.NotSerializableException: com.oracle.common.collections.ConcurrentLinkedQueue
      at com.tangosol.util.Base.ensureRuntimeException(Base.java:289)
      at com.tangosol.util.Base.ensureRuntimeException(Base.java:270)
      at com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketPublisher.packetizeMessage(PacketPublisher.CDB:28)
      at com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketPublisher$InQueue.add(PacketPublisher.CDB:8)
      at com.tangosol.coherence.component.util.daemon.queueProcessor.packetProcessor.PacketPublisher.post(PacketPublisher.CDB:1)
      at com.tangosol.coherence.component.net.Message.dispatch(Message.CDB:77)
      at com.tangosol.coherence.component.net.Message.post(Message.CDB:1)
      at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.post(Grid.CDB:2)
      at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.send(Grid.CDB:1)
      at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.InvocationService.execute(InvocationService.CDB:33)
      at com.tangosol.coherence.component.util.safeService.SafeInvocationService.execute(SafeInvocationService.CDB:1)
  </code></pre>
  
  <p>.
  .
  .
  .
  .
  .</p>
  
  <pre><code>Caused by: java.io.NotSerializableException: com.oracle.common.collections.ConcurrentLinkedQueue
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
      at java.util.Hashtable.writeObject(Hashtable.java:988)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:975)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
      at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:438)
      at com.tangosol.coherence.Component.writeObject(Component.CDB:1)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:975)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
      at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:438)
      at com.tangosol.coherence.Component.writeObject(Component.CDB:1)
  </code></pre>
  
  <p>It seems that half of the accounts have been cached successfully. Can it be node specific issue? Both of the storage enabled cache nodes are on the same server using the same cluster configuration. From the logs it is clear that both nodes successfully joined the cluster. </p>