zoukankan      html  css  js  c++  java
  • NoSuchAlgorithmException

    今天在写UT时遇到了下面的问题:

    1. 使用的powermock来处理static方法;

    2. 静态方法里的却有使用到org.apache.http.client(4.3.1)的方法

    异常如下:

    复制代码
    Caused by: org.apache.http.conn.ssl.SSLInitializationException: class configured for SSLContext: sun.security.ssl.SSLContextImpl$TLS10Context not a SSLContext
    at org.apache.http.conn.ssl.SSLContexts.createDefault(SSLContexts.java:58)
    at org.apache.http.conn.ssl.SSLSocketFactory.getSocketFactory(SSLSocketFactory.java:162)
    at com.taobao.tae.security.topscan.TaeTopScanClient.<clinit>(TaeTopScanClient.java:73)
    ... 37 more
    Caused by: java.security.NoSuchAlgorithmException: class configured for SSLContext: sun.security.ssl.SSLContextImpl$TLS10Context not a SSLContext
    at sun.security.jca.GetInstance.checkSuperClass(GetInstance.java:258)
    at sun.security.jca.GetInstance.getInstance(GetInstance.java:237)
    at sun.security.jca.GetInstance.getInstance(GetInstance.java:164)
    at javax.net.ssl.SSLContext.getInstance(SSLContext.java:156)
    at org.apache.http.conn.ssl.SSLContexts.createDefault(SSLContexts.java:54)
    ... 39 more
    复制代码

    google了一下,倒不是应为包版本或者不存在的问题,是powermock机制的问题。

    解决方法:

    在UTclass上增加annotation:

    @PowerMockIgnore("javax.net.ssl.*")

  • 相关阅读:
    jsp 页面获取当前路径
    html5 页面音频
    微信关于网页授权access_token和普通access_token的区别
    Texlive source
    vscode 快捷键
    vscode setting
    vscode extension 插件管理
    what
    linux manual
    java tool type
  • 原文地址:https://www.cnblogs.com/exmyth/p/12536013.html
Copyright © 2011-2022 走看看