title: Fail to restTemplate create with @PowerMockIgnore in powermock
body: <p>I need a powermock for private method test.<br>
  It is working well if I use only @RunWith(PowerMockRunner.class) without @PowerMockRunnerDelegate(SpringJUnit4ClassRunner.class).
  <br><br>I need to use @PowerMockRunnerDelegate(SpringJUnit4ClassRunner.class) for @autowired.
  But It doesn't fail to start.</p>
  <pre><code>@RunWith(PowerMockRunner.class)
  @PowerMockRunnerDelegate(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(classes = { MyConfig.class}) 
  @SpringBootTest
  public class SpringPowerMockTest {
  
  }
  </code></pre>
  <p>Error's detail</p>
   <pre>
  java.lang.IllegalAccessError: class javax.xml.parsers.FactoryFinder (in unnamed module @0x45d84a20) cannot access class jdk.xml.internal.SecuritySupport (in module java.xml) because module java.xml does not export jdk.xml.internal to unnamed module @0x45d84a20
      at javax.xml.parsers.FactoryFinder.(FactoryFinder.java:69)
      at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:147)
      at ch.qos.logback.core.joran.event.SaxEventRecorder.buildSaxParser(SaxEventRecorder.java:79)
      at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(SaxEventRecorder.java:57)
      at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:151)
      at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:110)
      at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
      at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
      at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
      at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
      at org.slf4j.impl.StaticLoggerBinder.(StaticLoggerBinder.java:55)
      at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
      at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
      at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
      at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
      at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
      at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
      at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:655)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.(SpringJUnit4ClassRunner.java:99)
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
      at org.powermock.reflect.internal.WhiteboxImpl.createInstance(WhiteboxImpl.java:1414)
      at org.powermock.reflect.internal.WhiteboxImpl.invokeConstructor(WhiteboxImpl.java:1262)
      at org.powermock.reflect.Whitebox.invokeConstructor(Whitebox.java:497)
      at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner$1.call(DelegatingPowerMockRunner.java:101)
      at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner$1.call(DelegatingPowerMockRunner.java:97)
      at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner.withContextClassLoader(DelegatingPowerMockRunner.java:132)
      at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner.createDelegate(DelegatingPowerMockRunner.java:96)
      at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner.(DelegatingPowerMockRunner.java:64)
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
      at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:165)
      at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:47)
      at org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.createTestDelegators(AbstractTestSuiteChunkerImpl.java:107)
      at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.(JUnit4TestSuiteChunkerImpl.java:69)
      at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.(AbstractCommonPowerMockRunner.java:36)
      at org.powermock.modules.junit4.PowerMockRunner.(PowerMockRunner.java:34)
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
      at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
      at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
      at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
      at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:37)
      at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
      at org.junit.internal.requests.ClassRequest.createRunner(ClassRequest.java:28)
      at org.junit.internal.requests.MemoizingRequest.getRunner(MemoizingRequest.java:19)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:90)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:76)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:49)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:525)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:768)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
  
  
  </pre>
  <p>Threfore I add this through <a href="https://github.com/powermock/powermock/issues/864" rel="nofollow noreferrer">https://github.com/powermock/powermock/issues/864</a></p>
  <pre><code>@RunWith(PowerMockRunner.class)
  @PowerMockRunnerDelegate(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(classes = { MyConfig.class}) 
  // I added this
  @PowerMockIgnore({&quot;javax.net.ssl.*&quot;, &quot;org.slf4j.*&quot;, &quot;javax.parsers.*&quot;, &quot;ch.qos.logback.*&quot;, 
  &quot;jdk.xml.internal.*&quot;, &quot;com.sun.org.apache.xerces.*&quot;, &quot;javax.xml.*&quot;, &quot;org.xml.*&quot;, 
  &quot;javax.management.*&quot;})
  @SpringBootTest
  public class SpringPowerMockTest {
  
      @Test
      public void test() {
        //success
      }
  
  }
  </code></pre>
  <p>It was working well.</p>
  <p>Therefore, I started to write code for test</p>
  <pre><code>@RunWith(PowerMockRunner.class)
  @PowerMockRunnerDelegate(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(classes = { MyConfig.class}) 
  @PowerMockIgnore({&quot;javax.net.ssl.*&quot;, &quot;org.slf4j.*&quot;, &quot;javax.parsers.*&quot;, &quot;ch.qos.logback.*&quot;, 
  &quot;jdk.xml.internal.*&quot;, &quot;com.sun.org.apache.xerces.*&quot;, &quot;javax.xml.*&quot;, &quot;org.xml.*&quot;, 
  &quot;javax.management.*&quot;})
  @SpringBootTest
  public class SpringPowerMockTest {
  
      @Test
      public void initalize() throws IOException {
          RestTemplate restTemplate = new RestTemplate();
          .....
      }
  
  
  }
  </code></pre>
  <p>But I couldn't start with this error message</p>
  <pre>
  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 org.springframework.http.converter.xml.AbstractXmlHttpMessageConverter.(AbstractXmlHttpMessageConverter.java:52)
      at org.springframework.http.converter.xml.AbstractJaxb2HttpMessageConverter.(AbstractJaxb2HttpMessageConverter.java:38)
      at org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter.(Jaxb2RootElementHttpMessageConverter.java:64)
      at org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter.(AllEncompassingFormHttpMessageConverter.java:86)
      at org.springframework.web.client.RestTemplate.(RestTemplate.java:161)
      at com.nesic.mroc.elevator.SpringPowerMockTest.initalize(SpringPowerMockTest.java:26)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
      at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
      at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
      at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
      at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
      at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
      at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
      at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
      at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
      at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
      at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
      at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner$2.call(DelegatingPowerMockRunner.java:149)
      at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner$2.call(DelegatingPowerMockRunner.java:141)
      at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner.withContextClassLoader(DelegatingPowerMockRunner.java:132)
      at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner.run(DelegatingPowerMockRunner.java:141)
      at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:117)
      at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:57)
      at org.powermock.modules.junit4.PowerMockRunner.run(PowerMockRunner.java:59)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:768)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
  Caused by: java.lang.reflect.InvocationTargetException
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
      at java.xml/javax.xml.transform.FactoryFinder.newInstance(FactoryFinder.java:169)
      ... 47 more
  Caused by: java.lang.IllegalAccessError: class com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl (in unnamed module @0x10d5ba8d) cannot access class jdk.xml.internal.JdkXmlUtils (in module java.xml) because module java.xml does not export jdk.xml.internal to unnamed module @0x10d5ba8d
      at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.(TransformerFactoryImpl.java:251)
      ... 52 more
  
  
  </pre>
  <p>my pom.xml</p>
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;org.powermock&lt;/groupId&gt;
          &lt;artifactId&gt;powermock-api-mockito2&lt;/artifactId&gt;
          &lt;version&gt;2.0.0-beta.5&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.powermock&lt;/groupId&gt;
          &lt;artifactId&gt;powermock-module-junit4&lt;/artifactId&gt;
          &lt;version&gt;2.0.0-beta.5&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;pl.pragmatists&lt;/groupId&gt;
          &lt;artifactId&gt;JUnitParams&lt;/artifactId&gt;
          &lt;version&gt;1.0.5&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  </code></pre>
  <p>I don't know why I can't create RestTempleate. and I don't know @PowerMockIgnore</p>