question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incompatibility with PowerMockRunner

See original GitHub issue

wiremock-jre8, version 2.27.2 powermockito, version 2.0.4 Java 14

The annotation @RunWith(PowerMockRunner.class) in a test case leads to the following exception:

    javax.xml.transform.TransformerFactoryConfigurationError: Provider 
    com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl could not be instantiated: 
    java.lang.reflect.InvocationTargetException

at java.xml/javax.xml.transform.FactoryFinder.newInstance(FactoryFinder.java:181)
at java.xml/javax.xml.transform.FactoryFinder.find(FactoryFinder.java:257)
at java.xml/javax.xml.transform.TransformerFactory.newInstance(TransformerFactory.java:126)
at com.github.tomakehurst.wiremock.common.xml.Xml.optimizeFactoriesLoading(Xml.java:52)
at com.github.tomakehurst.wiremock.core.WireMockApp.<clinit>(WireMockApp.java:75)
at com.github.tomakehurst.wiremock.WireMockServer.<init>(WireMockServer.java:73)
at com.github.tomakehurst.wiremock.junit.WireMockRule.<init>(WireMockRule.java:43)
at com.github.tomakehurst.wiremock.junit.WireMockRule.<init>(WireMockRule.java:39)

Removing PowerMock and switching to a different runner like @RunWith(MockitoJUnitRunner.class) fixes the issue. The cause of the exception was kinda hard to track down so maybe this could be improved.

The issue is probably related to https://github.com/tomakehurst/wiremock/issues/1072

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
tomakehurstcommented, Apr 27, 2021

I’ve wrapped the optimise method in a try/catch in 882b7d044fb6f113025237c9e3ad6c27fb923b49. Curious to know if this fixes the issue if you’re able to re-test?

0reactions
tomakehurstcommented, Apr 27, 2021

OK, I’m going to close this for now. Someone please shout if it’s still an issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Incompatibility with PowerMockRunner · Issue #1392 - GitHub
Have you looked at your project dependencies when Powermock is present to see what's different and whether it can be fixed by e.g....
Read more >
Powermock and mockito compatibility and changes
I am trying to move to power mock 2.0.2 and mockito 2.0. Previously I used powermock to mock some local variables: I used...
Read more >
Using another JUnit Runner with PowerMock - Jayway
Here's a (contrived) example of combining PowerMock and the SpringJUnit4ClassRunner for integration testing “MyBean”. First consider the code ...
Read more >
Mocking statics - Google Groups
Does anyone have any idea why "java.lang.IllegalStateException: incompatible return value type" is throws by PowerMock ? @RunWith(PowerMockRunner.class)
Read more >
[#LENS-399] TestRewriting test is failing with powermock ...
Right now, TestRewriting is failing with the incompatible version of pwoermock on jdk8. We need to use latest version which is compatible for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found