Mule JaxB绑定错误-“包"不包含ObjectFactory.class或jaxb.in​​dex [英] Mule JaxB binding error - "package" doesnt contain ObjectFactory.class or jaxb.index

查看:414
本文介绍了Mule JaxB绑定错误-“包"不包含ObjectFactory.class或jaxb.in​​dex的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在和maven一起使用m子.我已经使用了xml到对象的转换器.我的模型文件带有jaxb注释. JAXB上下文引用看起来像这样-:

I am using mule with maven. I have used a xml to object converter. My model files are annotated with jaxb annotations. The JAXB context ref looks like this -:

mulexml:jaxb-context name="JAXB_Context" packageNames="com.xml.model" doc:name="JAXB Context"/>

我已经创建了一个带有JAXB注释类名称的jaxb.in​​dex文件,并将其放置在com.xml.model文件夹中.

I have created a jaxb.index file with the names of the JAXB annotated classes and placed in the com.xml.model folder.

但是它仍然显示以下异常-:

But still it shows the following exception -:

org.springframework.beans.factory.BeanCreationException:创建名称为"_muleNotificationManager"的bean时出错:FactoryBean被抛出 对象创建中的异常;嵌套的异常是 org.springframework.beans.factory.BeanCreationException:错误 创建名称为"JAXB_Context"的bean:初始化方法的调用 失败的;嵌套的异常是javax.xml.bind.JAXBException:提供程序 com.sun.xml.bind.v2.ContextFactory无法实例化: javax.xml.bind.JAXBException:"com.xml.model"不包含 ObjectFactory.class或jaxb.in​​dex -具有链接的异常:[javax.xml.bind.JAXBException:"com.xml.model"不包含ObjectFactory.class或jaxb.in​​dex]

org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_muleNotificationManager': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'JAXB_Context': Invocation of init method failed; nested exception is javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "com.xml.model" doesnt contain ObjectFactory.class or jaxb.index - with linked exception: [javax.xml.bind.JAXBException: "com.xml.model" doesnt contain ObjectFactory.class or jaxb.index]

这在没有maven的情况下适用于mule项目.

This has worked for the mule project without maven.

推荐答案

我已经找到了解决方案.我们需要将jaxb.index文件保留在具有相同程序包结构的resources文件夹中.

I have found the solution for it. We need to keep the jaxb.index file in the resources folder with the same package structure.

我认为使用 Maven 时,它不会从软件包中选择文件.它使用自己的构建方法,但是在不使用 Maven 的情况下使用Anypoint Studio自己的构建方法进行构建,因此它将获得jaxb文件.

I think when using Maven, it doesn't pick the file from the package. It uses its own build methods, but when used without Maven the build is done by Anypoint studio's own build methods and so it gets the jaxb file.

这篇关于Mule JaxB绑定错误-“包"不包含ObjectFactory.class或jaxb.in​​dex的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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