title: Conflict library when deploy custom mediator in WSO2 ESB
body: <p>I used WSO2 EI 6.4.0. 
  I need to write a custom mediator used an external jar, called JAVA_SDK_VXP-2.0.3.jar (com.vpcp.services package).</p>
  
  <pre><code>package com.quangnam.example;
  
  import org.apache.synapse.MessageContext; 
  import org.apache.synapse.mediators.AbstractMediator;
  
  import com.vpcp.services.AgencyServiceImp;
  import com.vpcp.services.model.GetAgenciesResult;
  
  public class AgenciesListMediator extends AbstractMediator { 
  
      public boolean mediate(MessageContext context) { 
          getAgenciesList(context);
          return true;
      }
  
      private void getAgenciesList(MessageContext context) {
          AgencyServiceImp agencyService = new AgencyServiceImp();
          String jsonHeader = "{}";
          GetAgenciesResult getAgenciesResult = agencyService.getAgenciesList(jsonHeader);        
          context.setProperty("agenciesResult", getAgenciesResult.getAgencies());
      }
  }
  </code></pre>
  
  <p>The JAVA_SDK_VXP-2.0.3.jar needs to call httpclient-4.5.6.jar. I have a jar as httpclient_4.3.6.wso2v2.jar in {EI-HOME}/wso2/components/plugins. This jar comes with WSO2 EI. </p>
  
  <p>I deployed custom mediator and copy httpclient-4.5.6.jar, JAVA_SDK_VXP-2.0.3.jar to {EI-HOME}/lib folder.
  Everything is OK, but when I called the API used the custom mediator, there is an exception:</p>
  
  <pre><code>java.lang.NoSuchMethodError: org.apache.http.impl.conn.PoolingHttpClientConnectionManager.setValidateAfterInactivity(I)V
      at com.vpcp.services.HttpClientFactory.getHttpsClient(HttpClientFactory.java:180)
      at com.vpcp.services.HttpConnection.sendPost(HttpConnection.java:91)
      at com.vpcp.services.HttpConnection.execute(HttpConnection.java:272)
      at com.vpcp.services.VnptService.execute(VnptService.java:110)
      at com.vpcp.services.AgencyServiceImp.getAgenciesList(AgencyServiceImp.java:37)
      at com.quangnam.example.AgenciesListMediator.getAgenciesList(AgenciesListMediator.java:24)
      at com.quangnam.example.AgenciesListMediator.mediate(AgenciesListMediator.java:16)
      at org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:94)
      at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:108)
      at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:70)
      at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
      at org.apache.synapse.rest.Resource.process(Resource.java:364)
      at org.apache.synapse.rest.API.process(API.java:399)
      at org.apache.synapse.rest.RESTRequestHandler.apiProcess(RESTRequestHandler.java:135)
      at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:113)
      at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:71)
      at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:303)
      at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:92)
      at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
      at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:337)
      at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:158)
      at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>I started EI server with -DosgiConsole. As the result, I think the JAVA_SDK_VXP-2.0.3.jar called httpclient_4.3.6.wso2v2 not httpclient-4.5.6.jar, so there is no method setValidateAfterInactivity()</p>
  
  <pre><code>osgi&gt; packages org.apache.http.impl.conn
  org.apache.http.impl.conn; version="4.3.6.wso2v2"&lt;httpclient_4.3.6.wso2v2 [78]&gt;
    JAVA_SDK_VXP_2.0.3_1.0.0 [4] imports
    google-http-client_1.20.0.wso2v1 [68] imports
    solr_5.2.1.wso2v1 [598] imports
    spring.framework_3.2.9.wso2v1 [600] imports
    tomcat_7.0.85.wso2v1 [612] imports
  org.apache.http.impl.conn; version="0.0.0"&lt;httpclient_4.2.5.wso2v1_1.0.0 [79]&gt;
  org.apache.http.impl.conn; version="0.0.0"&lt;httpclient_4.5.6_1.0.0 [80]&gt;
  org.apache.http.impl.conn; version="0.0.0"&lt;httpclient_osgi_4.5.6_1.0.0 [81]&gt;
  </code></pre>
  
  <p>I go to the {EI-HOME}/dropins folder to edit bundle of my external libraries.</p>
  
  <p>Edit MANIFEST.MF of httpclient_4.5.6_1.0.0.jar to</p>
  
  <pre><code>Manifest-Version: 1.0
  Bundle-SymbolicName: httpclient_4.5.6
  Export-Package: org.apache.http.auth,org.apache.http.cookie,org.apache
   .http.cookie.params,org.apache.http.client,org.apache.http.client.met
   hods,org.apache.http.client.params,org.apache.http.client.utils,org.a
   pache.http.client.protocol,org.apache.http.conn,org.apache.http.conn.
   routing,org.apache.http.conn.params,org.apache.http.conn.socket,org.a
   pache.http.conn.ssl,org.apache.http.impl.auth,org.apache.http.impl.co
   okie,org.apache.http.impl.client,org.apache.http.impl.execchain,org.a
   pache.http.impl.conn;version="4.5.6",org.apache.http.client.config,org.apache.http.cl
   ient.entity,org.apache.http.conn.util,org.apache.http.impl.conn.tsccm
   ,org.apache.http.conn.scheme,org.apache.http.auth.params
  Bundle-Name: httpclient_4.5.6
  Bundle-Version: 1.0.0
  Bundle-ClassPath: .,httpclient-4.5.6.jar
  Bundle-ManifestVersion: 2
  DynamicImport-Package: *
  </code></pre>
  
  <p>Edit MANIFEST.MF of JAVA_SDK_VXP_2.0.3_1.0.0.jar to</p>
  
  <pre><code>Manifest-Version: 1.0
  Bundle-SymbolicName: JAVA_SDK_VXP_2.0.3
  Export-Package: com.vpcp.services,com.vpcp.services.exception,com.vpcp
   .services.model,com.vpcp.services.request,com.vpcp.services.utils
  Bundle-Name: JAVA_SDK_VXP_2.0.3
  Bundle-Version: 1.0.0
  Bundle-ClassPath: .,JAVA_SDK_VXP-2.0.3.jar
  Bundle-ManifestVersion: 2
  Import-Package: org.apache.http.impl.conn;version="4.5.6"
  DynamicImport-Package: *
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>osgi&gt; update 80
  osgi&gt; update 4
  osgi&gt; packages org.apache.http.impl.conn
  org.apache.http.impl.conn; version="4.3.6.wso2v2"&lt;httpclient_4.3.6.wso2v2 [78]&gt;
    google-http-client_1.20.0.wso2v1 [68] imports
    solr_5.2.1.wso2v1 [598] imports
    spring.framework_3.2.9.wso2v1 [600] imports
    tomcat_7.0.85.wso2v1 [612] imports
  org.apache.http.impl.conn; version="0.0.0"&lt;httpclient_4.2.5.wso2v1_1.0.0 [79]&gt;
  org.apache.http.impl.conn; version="4.5.6"&lt;httpclient_4.5.6_1.0.0 [80]&gt;
    JAVA_SDK_VXP_2.0.3_1.0.0 [4] imports
  org.apache.http.impl.conn; version="0.0.0"&lt;httpclient_osgi_4.5.6_1.0.0 [81]&gt;
  </code></pre>
  
  <p>But nothing has changed. Please help me.</p>