title: ClassNotFoundException when running IBM code example
body: <p>I'll eventually have write some custom data in my notes documents. But before that I wanted to see how it works, so I've copied/pasted the example from IBM Knowledge Center about replace/getItemValueCustomData in two seperated agent. </p>
  
  <p>Problem is that when I try to read the custom data, the Read Agent throw that exception : </p>
  
  <pre><code>java.lang.ClassNotFoundException: customData.IntIntString
      at java.lang.Class.forName(Class.java:291)
      at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:619)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1609)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1514)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1768)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:364)
      at lotus.domino.local.Document.getItemValueCustomData(Unknown Source)
      at JavaAgent.NotesMain(JavaAgent.java:14)
      at lotus.domino.AgentBase.runNotes(Unknown Source)
      at lotus.domino.NotesThread.run(Unknown Source)
  </code></pre>
  
  <p>Here is the code : </p>
  
  <p>Write agent : </p>
  
  <pre><code>import customData.IntIntString;
  import lotus.domino.*;
  
  public class JavaAgent extends AgentBase {
  
      public void NotesMain() {
  
          try {
              Session session = getSession();
              AgentContext agentContext = session.getAgentContext();
  
              IntIntString iis = new IntIntString();
              iis.setData(1, 2, "String1");
  
              Document doc = agentContext.getDocumentContext();
              doc.replaceItemValueCustomData("IntIntStringItem", "IntIntStringType", iis);
              doc.save();
  
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  </code></pre>
  
  <p>Read agent :</p>
  
  <pre><code>import intIntString.IntIntString;
  import lotus.domino.*;
  
  public class JavaAgent extends AgentBase {
  
      public void NotesMain() {
  
          try {
              Session session = getSession();
              AgentContext agentContext = session.getAgentContext();
  
              Document doc = agentContext.getDocumentContext();
              if (doc.hasItem("IntIntStringItem")) {
                  IntIntString iis = (IntIntString) doc.getItemValueCustomData("IntIntStringItem", "IntIntStringType");
                  iis.show();
              } else {
                  System.out.println("No item IntIntStringItem in document");
              }
  
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>IntIntString class :</p>
  
  <pre><code>package customData;
  
  import java.io.Serializable;
  
  public class IntIntString implements Serializable {
  
      private static final long serialVersionUID = 6875473472063311349L;
  
      private int int1;
      private int int2;
      private String string1;
  
      public void setData(int i1, int i2, String s1) {
          int1 = i1;
          int2 = i2;
          string1 = s1;
      }
  
      public void show() {
          System.out.println("Int1 = " + int1);
          System.out.println("Int2 = " + int2);
          System.out.println("String1 = " + string1);
      }
  }
  </code></pre>
  
  <p>Bytes wrotes by the Agent : </p>
  
  <pre><code>.  I  n  t  I  n  t  S  t  r  i  n  g  T  y  p  e  .  .  .
  10 49 6E 74 49 6E 74 53 74 72 69 6E 67 54 79 70 65 AC ED 00 
  .  s  r  .  .  c  u  s  t  o  m  D  a  t  a  .  I  n  t  I
  05 73 72 00 17 63 75 73 74 6F 6D 44 61 74 61 2E 49 6E 74 49 
  n  t  S  t  r  i  n  g  _  j  .  .  .  .  .  .  .  .  .  I
  6E 74 53 74 72 69 6E 67 5F 6A 96 B1 EC F4 8D F5 02 00 03 49 
  .  .  i  n  t  1  I  .  .  i  n  t  2  L  .  .  s  t  r  i
  00 04 69 6E 74 31 49 00 04 69 6E 74 32 4C 00 07 73 74 72 69 
  n  g  1  t  .  .  L  j  a  v  a  /  l  a  n  g  /  S  t  r
  6E 67 31 74 00 12 4C 6A 61 76 61 2F 6C 61 6E 67 2F 53 74 72
  i  n  g  ;  x  p  .  .  .  .  .  .  .  .  t  .  .  S  t  r
  69 6E 67 3B 78 70 00 00 00 01 00 00 00 02 74 00 07 53 74 72 
  i  n  g  1
  69 6E 67 31    
  </code></pre>
  
  <p>Do I miss something or is IBM drunk?</p>
  
  <p>Link to the examples : <a href="https://www.ibm.com/support/knowledgecenter/SSVRGU_9.0.1/com.ibm.designer.domino.main.doc/H_EXAMPLES_REPLACEITEMVALUECUSTOMDATA_METHOD_DOC_JAVA.html" rel="nofollow">replaceItemValueCustomData method</a>, <a href="https://www.ibm.com/support/knowledgecenter/SSVRGU_9.0.1/com.ibm.designer.domino.main.doc/H_EXAMPLES_GETITEMVALUECUSTOMDATA_METHOD_JAVA.html" rel="nofollow">getItemValueCustomData method</a>.</p>
  
  <hr>
  
  <p>Edit : Tried to define the "IntIntString" class in the "Agent" class, but that did not work, nor put the class in a .jar and import it.</p>
  
  <hr>
  
  <p>Edit 2 : As suggested in comments, I tried to declare the class public in the agent. For some reason when I tried that I had to implements Serializable in the agent, which I did. Still got the same exception. </p>
  
  <p>Then I tried to declare it public in a separate file (because public classes need their own file) in the "customData" package, but that didn't work either. </p>
  
  <p>Also tried to read the field when the document is open in read mode. I got that exception and the field erased (saw that from document property) : </p>
  
  <pre><code>NotesException: Supplied Data type name does not match stored CustomData type
      at lotus.domino.local.Document.NgetItemValueCustomData(Native Method)
      at lotus.domino.local.Document.getItemValueCustomData(Unknown Source)
      at JavaAgent.NotesMain(JavaAgent.java:14)
      at lotus.domino.AgentBase.runNotes(Unknown Source)
      at lotus.domino.NotesThread.run(Unknown Source)
  </code></pre>
  
  <p>Seams that the field is not read/write correctly, Data type should match.</p>
  
  <p>Code updated. </p>