Mockito: java.lang.IllegalAccessError: class javax.xml.parsers.FactoryFinder

Created on 7 Dec 2018  路  3Comments  路  Source: mockito/mockito

Hi All,

I am trying to run my Junit test but getting the below error. Any help would be really appreciated.

I am using PowerMockRunner in my test cases.

java.lang.IllegalAccessError: class javax.xml.parsers.FactoryFinder (in unnamed module @0x6dd79214) cannot access class jdk.xml.internal.SecuritySupport (in module java.xml) because module java.xml does not export jdk.xml.internal to unnamed module @0x6dd79214
at javax.xml.parsers.FactoryFinder.(FactoryFinder.java:69)
at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:140)

Most helpful comment

@hiteshbargujar I can't exactly recollect the solution as there were lot of such errors which I have resolved in one go.

could you please try adding @PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"}) at class level?

Probably this shall resolve your issue.

All 3 comments

I don't see any mention of Mockito in your stacktrace, so it is probably not an issue with Mockito. If you can post a reproduction with only Mockito, we can reopen this issue.

@bharukaRupesh did you ever find the solution for this, I am getting the same error with Powermock. I update the libs to 2.0.0 of powermock but still getting the error.

@hiteshbargujar I can't exactly recollect the solution as there were lot of such errors which I have resolved in one go.

could you please try adding @PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"}) at class level?

Probably this shall resolve your issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rcornell picture rcornell  路  5Comments

Raghu290 picture Raghu290  路  4Comments

HonoluluHenk picture HonoluluHenk  路  4Comments

cedrik23 picture cedrik23  路  6Comments

yujishe picture yujishe  路  3Comments