powermock java.lang.IllegalAccessError: 解決方案
阿新 • • 發佈:2019-09-27
java.lang.IllegalAccessError: class javax.xml.parsers.FactoryFinder (in unnamed module @0x39651a82) cannot access class jdk.xml.internal.SecuritySupport (in module java.xml) because module java.xml does not export jdk.xml.internal to unnamed module @0x39651a82 at javax.xml.parsers.FactoryFinder.<clinit>(FactoryFinder.java:69) at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:147) at ch.qos.logback.core.joran.event.SaxEventRecorder.buildSaxParser(SaxEventRecorder.java:79)
解決方案:
在相關class上添加註解
@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"})@RunWith(PowerMockRunner.class)