Conflict library when deploy custom mediator in WSO2 ESB
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).
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());
}
}
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.
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:
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)
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()
osgi> packages org.apache.http.impl.conn
org.apache.http.impl.conn; version="4.3.6.wso2v2"<httpclient_4.3.6.wso2v2 [78]>
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"<httpclient_4.2.5.wso2v1_1.0.0 [79]>
org.apache.http.impl.conn; version="0.0.0"<httpclient_4.5.6_1.0.0 [80]>
org.apache.http.impl.conn; version="0.0.0"<httpclient_osgi_4.5.6_1.0.0 [81]>
I go to the {EI-HOME}/dropins folder to edit bundle of my external libraries.
Edit MANIFEST.MF of httpclient_4.5.6_1.0.0.jar to
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: *
Edit MANIFEST.MF of JAVA_SDK_VXP_2.0.3_1.0.0.jar to
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: *
Result:
osgi> update 80
osgi> update 4
osgi> packages org.apache.http.impl.conn
org.apache.http.impl.conn; version="4.3.6.wso2v2"<httpclient_4.3.6.wso2v2 [78]>
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"<httpclient_4.2.5.wso2v1_1.0.0 [79]>
org.apache.http.impl.conn; version="4.5.6"<httpclient_4.5.6_1.0.0 [80]>
JAVA_SDK_VXP_2.0.3_1.0.0 [4] imports
org.apache.http.impl.conn; version="0.0.0"<httpclient_osgi_4.5.6_1.0.0 [81]>
But nothing has changed. Please help me.
java wso2 wso2esb wso2ei
add a comment |
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).
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());
}
}
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.
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:
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)
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()
osgi> packages org.apache.http.impl.conn
org.apache.http.impl.conn; version="4.3.6.wso2v2"<httpclient_4.3.6.wso2v2 [78]>
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"<httpclient_4.2.5.wso2v1_1.0.0 [79]>
org.apache.http.impl.conn; version="0.0.0"<httpclient_4.5.6_1.0.0 [80]>
org.apache.http.impl.conn; version="0.0.0"<httpclient_osgi_4.5.6_1.0.0 [81]>
I go to the {EI-HOME}/dropins folder to edit bundle of my external libraries.
Edit MANIFEST.MF of httpclient_4.5.6_1.0.0.jar to
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: *
Edit MANIFEST.MF of JAVA_SDK_VXP_2.0.3_1.0.0.jar to
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: *
Result:
osgi> update 80
osgi> update 4
osgi> packages org.apache.http.impl.conn
org.apache.http.impl.conn; version="4.3.6.wso2v2"<httpclient_4.3.6.wso2v2 [78]>
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"<httpclient_4.2.5.wso2v1_1.0.0 [79]>
org.apache.http.impl.conn; version="4.5.6"<httpclient_4.5.6_1.0.0 [80]>
JAVA_SDK_VXP_2.0.3_1.0.0 [4] imports
org.apache.http.impl.conn; version="0.0.0"<httpclient_osgi_4.5.6_1.0.0 [81]>
But nothing has changed. Please help me.
java wso2 wso2esb wso2ei
You could include the required httpclient library into the mediator bundle and not to import the http client from the OSGi references, so the internal (included) library is used
– gusto2
Nov 14 '18 at 8:59
Please tell me how to include it, I added the dependency of httpclient to mediator pom file.
– ThanhQB
Nov 14 '18 at 9:15
please see the doc, felix.apache.org/documentation/subprojects/… look for theEmbed-Dependency
tag.
– gusto2
Nov 14 '18 at 12:29
add a comment |
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).
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());
}
}
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.
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:
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)
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()
osgi> packages org.apache.http.impl.conn
org.apache.http.impl.conn; version="4.3.6.wso2v2"<httpclient_4.3.6.wso2v2 [78]>
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"<httpclient_4.2.5.wso2v1_1.0.0 [79]>
org.apache.http.impl.conn; version="0.0.0"<httpclient_4.5.6_1.0.0 [80]>
org.apache.http.impl.conn; version="0.0.0"<httpclient_osgi_4.5.6_1.0.0 [81]>
I go to the {EI-HOME}/dropins folder to edit bundle of my external libraries.
Edit MANIFEST.MF of httpclient_4.5.6_1.0.0.jar to
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: *
Edit MANIFEST.MF of JAVA_SDK_VXP_2.0.3_1.0.0.jar to
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: *
Result:
osgi> update 80
osgi> update 4
osgi> packages org.apache.http.impl.conn
org.apache.http.impl.conn; version="4.3.6.wso2v2"<httpclient_4.3.6.wso2v2 [78]>
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"<httpclient_4.2.5.wso2v1_1.0.0 [79]>
org.apache.http.impl.conn; version="4.5.6"<httpclient_4.5.6_1.0.0 [80]>
JAVA_SDK_VXP_2.0.3_1.0.0 [4] imports
org.apache.http.impl.conn; version="0.0.0"<httpclient_osgi_4.5.6_1.0.0 [81]>
But nothing has changed. Please help me.
java wso2 wso2esb wso2ei
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).
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());
}
}
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.
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:
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)
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()
osgi> packages org.apache.http.impl.conn
org.apache.http.impl.conn; version="4.3.6.wso2v2"<httpclient_4.3.6.wso2v2 [78]>
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"<httpclient_4.2.5.wso2v1_1.0.0 [79]>
org.apache.http.impl.conn; version="0.0.0"<httpclient_4.5.6_1.0.0 [80]>
org.apache.http.impl.conn; version="0.0.0"<httpclient_osgi_4.5.6_1.0.0 [81]>
I go to the {EI-HOME}/dropins folder to edit bundle of my external libraries.
Edit MANIFEST.MF of httpclient_4.5.6_1.0.0.jar to
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: *
Edit MANIFEST.MF of JAVA_SDK_VXP_2.0.3_1.0.0.jar to
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: *
Result:
osgi> update 80
osgi> update 4
osgi> packages org.apache.http.impl.conn
org.apache.http.impl.conn; version="4.3.6.wso2v2"<httpclient_4.3.6.wso2v2 [78]>
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"<httpclient_4.2.5.wso2v1_1.0.0 [79]>
org.apache.http.impl.conn; version="4.5.6"<httpclient_4.5.6_1.0.0 [80]>
JAVA_SDK_VXP_2.0.3_1.0.0 [4] imports
org.apache.http.impl.conn; version="0.0.0"<httpclient_osgi_4.5.6_1.0.0 [81]>
But nothing has changed. Please help me.
java wso2 wso2esb wso2ei
java wso2 wso2esb wso2ei
edited Nov 14 '18 at 8:46
ThanhQB
asked Nov 14 '18 at 8:33
ThanhQBThanhQB
32
32
You could include the required httpclient library into the mediator bundle and not to import the http client from the OSGi references, so the internal (included) library is used
– gusto2
Nov 14 '18 at 8:59
Please tell me how to include it, I added the dependency of httpclient to mediator pom file.
– ThanhQB
Nov 14 '18 at 9:15
please see the doc, felix.apache.org/documentation/subprojects/… look for theEmbed-Dependency
tag.
– gusto2
Nov 14 '18 at 12:29
add a comment |
You could include the required httpclient library into the mediator bundle and not to import the http client from the OSGi references, so the internal (included) library is used
– gusto2
Nov 14 '18 at 8:59
Please tell me how to include it, I added the dependency of httpclient to mediator pom file.
– ThanhQB
Nov 14 '18 at 9:15
please see the doc, felix.apache.org/documentation/subprojects/… look for theEmbed-Dependency
tag.
– gusto2
Nov 14 '18 at 12:29
You could include the required httpclient library into the mediator bundle and not to import the http client from the OSGi references, so the internal (included) library is used
– gusto2
Nov 14 '18 at 8:59
You could include the required httpclient library into the mediator bundle and not to import the http client from the OSGi references, so the internal (included) library is used
– gusto2
Nov 14 '18 at 8:59
Please tell me how to include it, I added the dependency of httpclient to mediator pom file.
– ThanhQB
Nov 14 '18 at 9:15
Please tell me how to include it, I added the dependency of httpclient to mediator pom file.
– ThanhQB
Nov 14 '18 at 9:15
please see the doc, felix.apache.org/documentation/subprojects/… look for the
Embed-Dependency
tag.– gusto2
Nov 14 '18 at 12:29
please see the doc, felix.apache.org/documentation/subprojects/… look for the
Embed-Dependency
tag.– gusto2
Nov 14 '18 at 12:29
add a comment |
2 Answers
2
active
oldest
votes
I updated the pom.xml with Embed-Dependency tag but still error
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.quangnam</groupId>
<artifactId>JavaClassMediatorExample</artifactId>
<version>1.0.0</version>
</parent>
<groupId>com.quangnam.example.ClassMediatorExample</groupId>
<artifactId>ClassMediatorExample</artifactId>
<version>1.0.0</version>
<packaging>bundle</packaging>
<name>ClassMediatorExample</name>
<description>ClassMediatorExample</description>
<properties>
<CApp.type>lib/synapse/mediator</CApp.type>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.axis2.wso2</groupId>
<artifactId>axis2</artifactId>
<version>1.6.1.wso2v20</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.synapse</groupId>
<artifactId>synapse-core</artifactId>
<version>2.1.7-wso2v80</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.6</version>
</dependency>
<dependency>
<groupId>com.vnpt</groupId>
<artifactId>JAVA_SDK_VXP</artifactId>
<version>0.9.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/JAVA_SDK_VXP-2.0.3.jar</systemPath>
</dependency>
</dependencies>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<id>wso2-nexus</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<id>wso2-nexus</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.4</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>ClassMediatorExample</Bundle-SymbolicName>
<Bundle-Name>ClassMediatorExample</Bundle-Name>
<Export-Package>com.quangnam.example</Export-Package>
<Import-Package>org.apache.http.impl.conn;version="4.5.6"</Import-Package>
<Embed-Dependency>*;scope=compile|runtime;inline=true;artifactId=JAVA_SDK_VXP|httpclient|httpmime</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<DynamicImport-Package>*</DynamicImport-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<buildcommands>
<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
</buildcommands>
<projectnatures>
<projectnature>org.wso2.developerstudio.eclipse.artifact.mediator.project.nature</projectnature>
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
</projectnatures>
</configuration>
</plugin>
</plugins>
</build>
</project>
add a comment |
UPDATE
I resolved it. After editing MANIFEST.MF, from {EI-HOME}/lib, I deleted httpclient-4.5.6.jar, JAVA_SDK_VXP-2.0.3.jar and restart EI server.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53295915%2fconflict-library-when-deploy-custom-mediator-in-wso2-esb%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I updated the pom.xml with Embed-Dependency tag but still error
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.quangnam</groupId>
<artifactId>JavaClassMediatorExample</artifactId>
<version>1.0.0</version>
</parent>
<groupId>com.quangnam.example.ClassMediatorExample</groupId>
<artifactId>ClassMediatorExample</artifactId>
<version>1.0.0</version>
<packaging>bundle</packaging>
<name>ClassMediatorExample</name>
<description>ClassMediatorExample</description>
<properties>
<CApp.type>lib/synapse/mediator</CApp.type>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.axis2.wso2</groupId>
<artifactId>axis2</artifactId>
<version>1.6.1.wso2v20</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.synapse</groupId>
<artifactId>synapse-core</artifactId>
<version>2.1.7-wso2v80</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.6</version>
</dependency>
<dependency>
<groupId>com.vnpt</groupId>
<artifactId>JAVA_SDK_VXP</artifactId>
<version>0.9.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/JAVA_SDK_VXP-2.0.3.jar</systemPath>
</dependency>
</dependencies>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<id>wso2-nexus</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<id>wso2-nexus</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.4</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>ClassMediatorExample</Bundle-SymbolicName>
<Bundle-Name>ClassMediatorExample</Bundle-Name>
<Export-Package>com.quangnam.example</Export-Package>
<Import-Package>org.apache.http.impl.conn;version="4.5.6"</Import-Package>
<Embed-Dependency>*;scope=compile|runtime;inline=true;artifactId=JAVA_SDK_VXP|httpclient|httpmime</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<DynamicImport-Package>*</DynamicImport-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<buildcommands>
<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
</buildcommands>
<projectnatures>
<projectnature>org.wso2.developerstudio.eclipse.artifact.mediator.project.nature</projectnature>
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
</projectnatures>
</configuration>
</plugin>
</plugins>
</build>
</project>
add a comment |
I updated the pom.xml with Embed-Dependency tag but still error
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.quangnam</groupId>
<artifactId>JavaClassMediatorExample</artifactId>
<version>1.0.0</version>
</parent>
<groupId>com.quangnam.example.ClassMediatorExample</groupId>
<artifactId>ClassMediatorExample</artifactId>
<version>1.0.0</version>
<packaging>bundle</packaging>
<name>ClassMediatorExample</name>
<description>ClassMediatorExample</description>
<properties>
<CApp.type>lib/synapse/mediator</CApp.type>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.axis2.wso2</groupId>
<artifactId>axis2</artifactId>
<version>1.6.1.wso2v20</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.synapse</groupId>
<artifactId>synapse-core</artifactId>
<version>2.1.7-wso2v80</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.6</version>
</dependency>
<dependency>
<groupId>com.vnpt</groupId>
<artifactId>JAVA_SDK_VXP</artifactId>
<version>0.9.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/JAVA_SDK_VXP-2.0.3.jar</systemPath>
</dependency>
</dependencies>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<id>wso2-nexus</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<id>wso2-nexus</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.4</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>ClassMediatorExample</Bundle-SymbolicName>
<Bundle-Name>ClassMediatorExample</Bundle-Name>
<Export-Package>com.quangnam.example</Export-Package>
<Import-Package>org.apache.http.impl.conn;version="4.5.6"</Import-Package>
<Embed-Dependency>*;scope=compile|runtime;inline=true;artifactId=JAVA_SDK_VXP|httpclient|httpmime</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<DynamicImport-Package>*</DynamicImport-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<buildcommands>
<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
</buildcommands>
<projectnatures>
<projectnature>org.wso2.developerstudio.eclipse.artifact.mediator.project.nature</projectnature>
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
</projectnatures>
</configuration>
</plugin>
</plugins>
</build>
</project>
add a comment |
I updated the pom.xml with Embed-Dependency tag but still error
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.quangnam</groupId>
<artifactId>JavaClassMediatorExample</artifactId>
<version>1.0.0</version>
</parent>
<groupId>com.quangnam.example.ClassMediatorExample</groupId>
<artifactId>ClassMediatorExample</artifactId>
<version>1.0.0</version>
<packaging>bundle</packaging>
<name>ClassMediatorExample</name>
<description>ClassMediatorExample</description>
<properties>
<CApp.type>lib/synapse/mediator</CApp.type>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.axis2.wso2</groupId>
<artifactId>axis2</artifactId>
<version>1.6.1.wso2v20</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.synapse</groupId>
<artifactId>synapse-core</artifactId>
<version>2.1.7-wso2v80</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.6</version>
</dependency>
<dependency>
<groupId>com.vnpt</groupId>
<artifactId>JAVA_SDK_VXP</artifactId>
<version>0.9.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/JAVA_SDK_VXP-2.0.3.jar</systemPath>
</dependency>
</dependencies>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<id>wso2-nexus</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<id>wso2-nexus</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.4</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>ClassMediatorExample</Bundle-SymbolicName>
<Bundle-Name>ClassMediatorExample</Bundle-Name>
<Export-Package>com.quangnam.example</Export-Package>
<Import-Package>org.apache.http.impl.conn;version="4.5.6"</Import-Package>
<Embed-Dependency>*;scope=compile|runtime;inline=true;artifactId=JAVA_SDK_VXP|httpclient|httpmime</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<DynamicImport-Package>*</DynamicImport-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<buildcommands>
<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
</buildcommands>
<projectnatures>
<projectnature>org.wso2.developerstudio.eclipse.artifact.mediator.project.nature</projectnature>
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
</projectnatures>
</configuration>
</plugin>
</plugins>
</build>
</project>
I updated the pom.xml with Embed-Dependency tag but still error
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.quangnam</groupId>
<artifactId>JavaClassMediatorExample</artifactId>
<version>1.0.0</version>
</parent>
<groupId>com.quangnam.example.ClassMediatorExample</groupId>
<artifactId>ClassMediatorExample</artifactId>
<version>1.0.0</version>
<packaging>bundle</packaging>
<name>ClassMediatorExample</name>
<description>ClassMediatorExample</description>
<properties>
<CApp.type>lib/synapse/mediator</CApp.type>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.axis2.wso2</groupId>
<artifactId>axis2</artifactId>
<version>1.6.1.wso2v20</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.synapse</groupId>
<artifactId>synapse-core</artifactId>
<version>2.1.7-wso2v80</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.6</version>
</dependency>
<dependency>
<groupId>com.vnpt</groupId>
<artifactId>JAVA_SDK_VXP</artifactId>
<version>0.9.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/JAVA_SDK_VXP-2.0.3.jar</systemPath>
</dependency>
</dependencies>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<id>wso2-nexus</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<id>wso2-nexus</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.4</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>ClassMediatorExample</Bundle-SymbolicName>
<Bundle-Name>ClassMediatorExample</Bundle-Name>
<Export-Package>com.quangnam.example</Export-Package>
<Import-Package>org.apache.http.impl.conn;version="4.5.6"</Import-Package>
<Embed-Dependency>*;scope=compile|runtime;inline=true;artifactId=JAVA_SDK_VXP|httpclient|httpmime</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<DynamicImport-Package>*</DynamicImport-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<buildcommands>
<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
</buildcommands>
<projectnatures>
<projectnature>org.wso2.developerstudio.eclipse.artifact.mediator.project.nature</projectnature>
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
</projectnatures>
</configuration>
</plugin>
</plugins>
</build>
</project>
answered Nov 15 '18 at 2:31
ThanhQBThanhQB
32
32
add a comment |
add a comment |
UPDATE
I resolved it. After editing MANIFEST.MF, from {EI-HOME}/lib, I deleted httpclient-4.5.6.jar, JAVA_SDK_VXP-2.0.3.jar and restart EI server.
add a comment |
UPDATE
I resolved it. After editing MANIFEST.MF, from {EI-HOME}/lib, I deleted httpclient-4.5.6.jar, JAVA_SDK_VXP-2.0.3.jar and restart EI server.
add a comment |
UPDATE
I resolved it. After editing MANIFEST.MF, from {EI-HOME}/lib, I deleted httpclient-4.5.6.jar, JAVA_SDK_VXP-2.0.3.jar and restart EI server.
UPDATE
I resolved it. After editing MANIFEST.MF, from {EI-HOME}/lib, I deleted httpclient-4.5.6.jar, JAVA_SDK_VXP-2.0.3.jar and restart EI server.
answered Nov 15 '18 at 8:56
ThanhQBThanhQB
32
32
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53295915%2fconflict-library-when-deploy-custom-mediator-in-wso2-esb%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You could include the required httpclient library into the mediator bundle and not to import the http client from the OSGi references, so the internal (included) library is used
– gusto2
Nov 14 '18 at 8:59
Please tell me how to include it, I added the dependency of httpclient to mediator pom file.
– ThanhQB
Nov 14 '18 at 9:15
please see the doc, felix.apache.org/documentation/subprojects/… look for the
Embed-Dependency
tag.– gusto2
Nov 14 '18 at 12:29