Running with Tests with RobolectricTestRunner.class throws javax.xml.stream.FactoryConfigurationError

68 views
Skip to first unread message

Mobius

unread,
Sep 15, 2017, 3:13:28 AM9/15/17
to Robolectric
Hi,
Running with Tests with RobolectricTestRunner.class throws javax.xml.stream.FactoryConfigurationError: Provider for class javax.xml.stream.XMLInputFactory cannot be created.
this seems to be a problem with dependencies, so I am copy pasting my dependencies also here.
 
Dependencies
 compile fileTree(include: '*.jar', dir: 'libs')
    compile 'com.android.support:multidex:1.0.1'
    compile 'ca.uhn.hapi.fhir:hapi-fhir-android:2.5:dstu2@jar'
    compile('commons-validator:commons-validator:1.5.1') {
        exclude group: 'commons-logging'
        exclude group: 'commons-collections'
        exclude group: 'commons-digester'
    }
    compile 'com.squareup.okhttp3:okhttp:3.7.0'
    compile 'commons-io:commons-io:2.4@jar'
    compile 'org.slf4j:slf4j-api:1.7.10@jar'
    compile 'org.slf4j:slf4j-android:1.7.10@jar'
    compile 'org.apache.commons:commons-lang3:3.3.2'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:recyclerview-v7:25.3.1'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.android.support:support-v13:25.3.1'
    compile 'com.github.bumptech.glide:glide:3.8.0'
    compile 'org.greenrobot:eventbus:3.0.0'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'ch.acra:acra:4.9.2'
   
   
    //For test
    testCompile 'junit:junit:4.12'
    testCompile 'com.android.support:support-annotations:25.3.1'
    testCompile 'com.android.support.test:runner:0.5'
    testCompile 'com.android.support.test:rules:0.5'
    testCompile 'org.hamcrest:hamcrest-library:1.3'

    testCompile 'org.mockito:mockito-core:2.4.0'
    testCompile "org.robolectric:robolectric:3.4.2"
    testCompile 'org.powermock:powermock-module-junit4:1.7.0RC2',
            'org.powermock:powermock-api-mockito2:1.7.0RC2'
}

StackTrace
javax.xml.stream.FactoryConfigurationError: Provider for class javax.xml.stream.XMLInputFactory cannot be created

    at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:370)
    at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:313)
    at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:227)
    at javax.xml.stream.XMLInputFactory.newFactory(XMLInputFactory.java:205)
    at org.robolectric.res.StaxDocumentLoader.<init>(StaxDocumentLoader.java:20)
    at org.robolectric.res.ResourceTableFactory.parseResourceFiles(ResourceTableFactory.java:113)
    at org.robolectric.res.ResourceTableFactory.newFrameworkResourceTable(ResourceTableFactory.java:24)
    at org.robolectric.internal.SdkEnvironment.getSystemResourceTable(SdkEnvironment.java:23)
    at org.robolectric.RobolectricTestRunner.beforeTest(RobolectricTestRunner.java:290)
    at org.robolectric.internal.SandboxTestRunner$2.evaluate(SandboxTestRunner.java:222)
    at org.robolectric.internal.SandboxTestRunner.runChild(SandboxTestRunner.java:110)
    at org.robolectric.internal.SandboxTestRunner.runChild(SandboxTestRunner.java:37)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.robolectric.internal.SandboxTestRunner$1.evaluate(SandboxTestRunner.java:64)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.RuntimeException: Provider for class javax.xml.stream.XMLInputFactory cannot be created
    at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:367)
    ... 28 more
Caused by: java.util.ServiceConfigurationError: javax.xml.stream.XMLInputFactory: Provider com.ctc.wstx.stax.WstxInputFactory not found
    at java.util.ServiceLoader.fail(ServiceLoader.java:239)
    at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
    at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372)
    at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
    at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
    at javax.xml.stream.FactoryFinder$1.run(FactoryFinder.java:353)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:341)
    ... 28 more


Process finished with exit code -1

Reply all
Reply to author
Forward
0 new messages