使用Java 5运行的JAXB编组异常javax.xml.stream.FactoryConfigurationError [英] JAXB marshalling exception javax.xml.stream.FactoryConfigurationError running with Java 5

查看:75
本文介绍了使用Java 5运行的JAXB编组异常javax.xml.stream.FactoryConfigurationError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在我的JUit测试类中尝试一个简单的JAXB编组,我正在使用Java 5.运行测试时出现此错误。

I am trying a simple JAXB marshaling in my JUit test class and I am using Java 5. I get this error while running the test.

javax.xml。 stream.FactoryConfigurationError:找不到提供者com.bea.xml.stream.XMLOutputFactoryBase

javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.XMLOutputFactoryBase not found

我在我的pom中添加了以下依赖项。

I have added the following dependencies in my pom.

     <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.2</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-xjc</artifactId>
        <version>2.2</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.2</version>
    </dependency>
    <dependency>
        <groupId>javax.xml</groupId>
        <artifactId>jsr173</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
       <groupId>javax.activation</groupId>
       <artifactId>activation</artifactId>
       <version>1.1</version>
    </dependency>

我们非常感谢您对此问题的任何帮助。

any help on this issue is highly appreciated.

推荐答案

从上面的依赖列表中,看起来你正在使用 jsr173 - 用于XML的steaming API。您指定的依赖项仅提供API。您需要添加一个实现此功能的提供程序。它寻找的默认提供程序,如果找不到,则是bea实现。因此错误。

From the dependency list above, it looks like you are using jsr173 - steaming API for XML. The dependency you have specified just provides the API. You need to add a provider which implements this. The default provider that it looks for, if it does not find any is the bea implementation. Hence the error.

这是讨论就此而言。您可以添加bea实现或其他替代实现,如 woodstox

Here is a discussion on this. You could add the bea implementation or alternate ones like woodstox.

这篇关于使用Java 5运行的JAXB编组异常javax.xml.stream.FactoryConfigurationError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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