I need to create custom Handler to be included in WSO2 api manager (i use version 1.10.0). My custom handler depends on org.apache.http.impl.nio.client.CloseableHttpAsyncClient class from org.apache.httpcomponents.httpasyncclient-4.1 package. this dependency also include some third party library such as org.apache.httpcomponents.httpclient-4.4.1.
As per this instruction https://docs.wso2.com/display/AM1100/Writing+Custom+Handlers, the jar needed to be placed in /repository/components/lib. So i put my custom handler jar with all it's dependency jar files.
But when i restarted the wso2am, i got some class not found exception.
titlement.internal.SchemaBuilder}
TID: [-1234] [] [2016-04-25 17:14:28,659] FATAL {org.wso2.carbon.mediation.initializer.ServiceBusInitializer} - Failed to initialize ESB due to a fatal error {org.wso2.carbon.mediation.initializer.ServiceBusInitializer}
java.lang.NoClassDefFoundError: org/apache/http/conn/util/PublicSuffixMatcherLoader
at org.apache.http.impl.nio.client.HttpAsyncClientBuilder.build(HttpAsyncClientBuilder.java:642)
at id.co.telkom.dds.oam.wso2am.handler.api.client.BillingAPIClient.<init>(BillingAPIClient.java:28)
at id.co.telkom.dds.oam.wso2am.handler.BillingHandler.<init>(BillingHandler.java:26)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at java.lang.Class.newInstance(Class.java:442)
at org.apache.synapse.config.xml.rest.APIFactory.defineHandler(APIFactory.java:130)
at org.apache.synapse.config.xml.rest.APIFactory.createAPI(APIFactory.java:101)
is it because somehow the class is already included in WSO2 OSGI dependencies?
What is the recommended way of creating additional jar file that included several third party library so that it can be safely included in wso2 api manager without having version conflict problem. Should i created an OSGI bundles, included all the third library in the bundles so that only my custom handler class can see it?