Axis2 PhaseException ServiceClient.engageModule()

Axis2 PhaseException ServiceClient.engageModule()

您好,我遇到了 Axis2 1.6.2 中的模块问题。 根据轴文档,我创建了一个 module.xml,我还更新了 axis2.xml 中的相位。

现在,当我尝试使用

参与模块时

ServiceClient.enageModule().

我得到一个 PhaseException 如下

org.apache.axis2.phaseresolver.PhaseException: Did not find the desired phase 'myPhase' while deploying handler 'MyInFlowHandler'.

我认为配置 (xml) 完全符合需要...我什至尝试将 .mar 文件保存在 lib 文件夹中并包含在构建路径中。

我已经搜索过,所有指向 xml 中缺少的东西 axis2.xml or services.xml or module.xml 可能会导致这个异常,我已经检查过,所有文件都很好。

当我这样做时:

Map<String, AxisModule> modules = serviceClient.getAxisConfiguration().getModules();

地图(模块)不为空,包含我需要参与的模块。

我应该提到的另一件事是我正在创建一个新的 MessageContext 并且以某种方式 m MessageContext.getCurrentMessageContext() returns null.

我想知道不正确的 xml 声明是否是此 PhaseException 的唯一原因,或者还有其他我可能忽略的原因。

我希望我很清楚,因为我很抱歉不能提供更多细节(代码和所有)。

已解决... 显然,问题是没有找到 ServiceContext/ConfigurationContext 供 ServiceClient 加载所有模块(mar's)。

使用新的自定义 ConfigurationContext 创建 ServiceClient 就成功了。

ConfigurationContext CTX = new ConfigurationContext("path to axis2 repo","path to axis2.XML");

ServiceClient sender=new ServiceClient(CTX, null);