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.
at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:140)
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.
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.