骡子问题:不止一个JAXBContext [英] Mule Issue : More than one JAXBContext

查看:67
本文介绍了骡子问题:不止一个JAXBContext的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在与JAXB上下文相关的Mule Adapter中面临一个问题,需要对同一个
的一些看法我们使用xpath来评估我们的适配器中的选择块中的一些表达式,例如,

We are facing one issue in our Mule Adapter related to JAXB context, needed some opinion on the same We are using xpath to evaluate some expressions in the choice blocks in our adapter like below for instance,

<choice doc:name="Choice">
<when expression="//env:abc/env:Body/ref:dataelement/ref:/ref:element" evaluator="xpath">
        ......
</when>

现在,这在我们的应用程序中工作得非常好但是当其他团队中的一个使用此适配器时会出现问题作为他们申请中的一个罐子。

Now, this works perfectly fine in our application but the problem arises when one of other team uses this Adapter as a jar in their application.

当他们尝试使用这个适配器时,他们会遇到错误,

When they try to use this adapter, they are getting below error,

Message : More than one object of type class javax.xml.bind.JAXBContext registered but only one expected. 
Type : org.mule.api.registry.RegistrationException 
Code : MULE_ERROR--2 
JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/registry /RegistrationException.html.

在使用记录器等进行调试后,我们缩小到上面使用的选择块这个特殊问题。另外,谷歌搜索了一下,发现其中一个帖子指出了同样的问题。

After debugging with the help of loggers etc, we narrowed down to the choice block used above which is causing this particular issue. Also, googled a bit and found one of the posts pointing out the same issue.

另外,为了确认我们注释掉了具有xpath表达式的选择块并且流程继续进行但是再次破坏了xpath以其他方式使用的地方。

Also, to confirm we commented out the choice block having xpath expression and the flow went ahead but broke again where was xpath used in some other way.

https://www.mulesoft.org/jira/browse/MULE-5926

任何人都可以建议任何合适的解决方法解决这个问题?

Can anyone please suggest any suitable workaround to resolve this issue?

推荐答案

我同意你的看法。这是Mule中尚未解决的问题。

I agree with you. It is an unresolved issue in Mule.

我们实现的一个解决方案是不在jar文件中提供的配置中定义jaxb上下文。

One solution we have implemented is not define the jaxb context in the config you are providing in the jar file.

与jar文件一起,使用它向最终应用程序发出指令,将JAXB包包含在它们的JAXB Context对象定义中。

Along with the jar file, give instructions to the end application using it, to include the JAXB packages in their JAXB Context object definition.

这样只有一个JAXB上下文,它会顺利运行。

This way there will be only one JAXB context and it will work smoothly.

希望这会有所帮助。

这篇关于骡子问题:不止一个JAXBContext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆