我创建了一个自定义调解器。当我在/ repository / components / lib'中部署jar时文件夹,它抛出以下异常。请检查下面的代码和例外。
我在component / lib / component / dropins中复制了synapse-core_2.1.2.wso2v2,但这没有帮助。我不认为我需要复制这些库,因为它们是作为WSO2 ESB一部分的核心库。
有人可以帮助我们为什么会抛出这个例外吗?我在developer studio中创建了这个Mediators并创建了jar。它应该没有任何问题地部署。
代码:
public boolean mediate(MessageContext synCtx) {
SynapseLog synLog = getLog(synCtx);
if (synLog.isTraceOrDebugEnabled()) {
synLog.traceOrDebug("Start : Cache mediator");
if (synLog.isTraceTraceEnabled()) {
synLog.traceTrace("Message : " + synCtx.getEnvelope());
}
}
ConfigurationContext cfgCtx =
((Axis2MessageContext) synCtx).getAxis2MessageContext().getConfigurationContext();
例外:
java.lang.NoClassDefFoundError: org/apache/synapse/core/axis2/Axis2MessageContext
at com.span.custom.cache.DistributedCacheMediator.mediate(DistributedCacheMediator.java:82)
at org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:78)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:166)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:411)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:183)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
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:356)
... 13 more
答案 0 :(得分:0)
只有在您开发了自定义类介体
时,您的自定义jar才会转到repository / components / lib如果您已经开发了一个真正的中介(具有您可以在中介中使用的特定名称,并且它是序列化器和工厂,并且它'在META-INF / services中输入MediatorFactory& MediatorSerializer),您必须生成一个带有maven-bundle-plugin的jar转到repository / components / dropins
答案 1 :(得分:0)
我使用WSo2 ESB 4.9.0而不是4.8.1。问题得到解决。