title: WSO2 ESB - java.lang.ClassNotFoundException: org.apache.synapse.core.axis2.Axis2MessageContext
body: <p>I am having a mediator that receives a message, which is generated by VFS poller. I am trying to figure out the file name so that act on it differently. The code that pulls the fileName works, but sometimes I am getting ClassNotFoundException (see below). I gave to restart WSO2 one or more times in order for the class to be loaded successfully. I am running WSO2 ESB 4.8.0 on Ubuntu 12.04 with 8GB RAM and 4GB max Java Heap.
  Thanks,
  Krassimir</p>
  
  <pre><code>public boolean mediate(MessageContext context) {
  ...
  String fileName = ((Map) ((Axis2MessageContext) context).getAxis2MessageContext()
          .getProperty("TRANSPORT_HEADERS")).get("FILE_NAME").toString();
  ...
  </code></pre>
  
  <p>Caused by: java.lang.ClassNotFoundException: org.apache.synapse.core.axis2.Axis2MessageContext
          at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
          at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
          at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
          at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
          ... 17 more</p>