gpt4 book ai didi

java - 使用 CAR 将自定义中介部署到 WSO2 ESB

转载 作者:行者123 更新时间:2023-11-30 10:33:55 33 4
gpt4 key购买 nike

我正在尝试部署一个打包在 .car 文件中的自定义类中介。 WSO2 documentation关于这个主题不是很具体,也没有可用的例子。

我所做的是:

  1. 编写了一个自定义类中介程序,如果将其作为 .jar 部署到 $CARBON_HOME/repository/components/lib/
  2. 将上述 JAR 打包成 .car,然后使用管理控制台手动上传到 ESB。

问题:服务器找不到中介类:

[2017-01-30 18:12:37,810]  WARN - SynapseXMLConfigurationFactory Proxy Service configuration: test cannot be built - Continue in fail-safe mode
org.apache.synapse.SynapseException: Error loading class : nl.my.mediators.HashMediator - Class not found
at org.apache.synapse.config.xml.ClassMediatorFactory.createSpecificMediator(ClassMediatorFactory.java:107)
at org.apache.synapse.config.xml.AbstractMediatorFactory.createMediator(AbstractMediatorFactory.java:94)
...

.car 文件确实包含有问题的 .jar:

Archive:  mediators-v1_1_1.1.3-SNAPSHOT.car
Length Date Time Name
--------- ---------- ----- ----
...
0 2017-01-30 18:07 ca-mediators_1.1.3-SNAPSHOT/
5399 2017-01-30 18:07 ca-mediators_1.1.3-SNAPSHOT/ca-mediators-1.1.3-SNAPSHOT.jar
257 2017-01-30 18:07 ca-mediators_1.1.3-SNAPSHOT/artifact.xml
...

但是,很明显,它没有被 ESB 接收。 maven-car-plugin 生成的 artifact.xml 文件(顺便说一下,它完全没有文档):

<?xml version="1.0" encoding="UTF-8"?><artifact name="ca-mediators" version="1.1.3-SNAPSHOT" type="lib/library/bundle" serverRole="EnterpriseServiceBus">
<file>ca-mediators-1.1.3-SNAPSHOT.jar</file>
</artifact>

如何让 ESB 获取我的 JAR 中的类?

最佳答案

此问题在 WSO2 documentation 中有描述关于扩展 ESB:

When we ship the mediator through a CAR file, the mediator is accessible only to the artifacts (sequences, proxy services, APIs) available in the same CAR file. The mediator is not available globally.

解决方案在同一页进一步提出:

  • 写一个让类(class)调解员参与的序列
  • 从包含类介体的同一个 CAR 文件中打包序列
  • 从其他 Artifact 中调用序列

我试过了,成功了。

关于java - 使用 CAR 将自定义中介部署到 WSO2 ESB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41942229/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com