title: When a TrustManagerFactory is not a TrustManagerFactory (Java)
body: <p>I am trying to add some additional JUnit test to an existing App-Server (TomCat) product. I have run into an issue with the (existing and fielded) custom TrustManager. This thing works fine in production, but during JUnit, gives exception.</p>
  
  <p>The customized TrustManager merely loads a keystore from a path, and implicitly trusts our own public certs. For some reason, using this in JUnits causes an exception on the following line: </p>
  
  <pre><code>TrustManagerFactory tmFactory = TrustManagerFactory.getInstance("PKIX");    
  </code></pre>
  
  <p>Exception:  </p>
  
  <pre><code>java.security.NoSuchAlgorithmException:  class configured for TrustManagerFactory: com.sun.net.ssl.internal.ssl.TrustManagerFactoryImpl$PKIXFactory not a TrustManagerFactory
  </code></pre>
  
  <p>This exception takes place regardless of what Provider/Algorithm combinations are used ("SunX509", .getDefaultAlgorithm(), et al.).</p>
  
  <p>Any insight will be greatly appreciated.</p>