3

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: Provider com.bea.xml.stream.XMLOutputFactoryBase not found

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.

Sanath
  • 4,774
  • 10
  • 51
  • 81

1 Answers1

3

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.

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

Raghuram
  • 51,854
  • 11
  • 110
  • 122
  • 1
    [Link that helped](http://www.emmersonmiranda.net/2010/09/provider-combeaxmlstreammxparserfactory.html) When I added the stax dependency, I was able ti run the tests with jaxb – Sanath Feb 21 '12 at 07:03
  • Thanks Raghuram for the reply I believe that the required implementation is bundled with stax dependency. – Sanath Feb 22 '12 at 02:23