Atitit 類庫衝突解決方案 httpclient-4.5.2.jar

 

 

Atitit 類庫衝突解決方案  httpclient-4.5.2.jar java

 

錯誤提示以下1apache

版本以下(client and selenium)2工具

解決流程2ui

掛載源碼 (SSLConnectionSocketFactory.java:1442spa

緣由:SSLConnectionSocketFactory調取AllowAllHostnameVerifier 的時候,調取了另一個jar裏面的allowAhnVer這個class3.net

解決: 4.5jar放在前面運行,讓它先加載。。或者使用代碼預先加載4.5jar包裏面的jar。。3firefox

 

錯誤提示以下

Exception in thread "main" java.lang.NoSuchFieldError: INSTANCEblog

at org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit>(SSLConnectionSocketFactory.java:144)ssl

at org.openqa.selenium.remote.internal.HttpClientFactory.getClientConnectionManager(HttpClientFactory.java:65)rem

at org.openqa.selenium.remote.internal.HttpClientFactory.<init>(HttpClientFactory.java:55)

at org.openqa.selenium.remote.internal.ApacheHttpClient$Factory.getDefaultHttpClientFactory(ApacheHttpClient.java:234)

at org.openqa.selenium.remote.internal.ApacheHttpClient$Factory.<init>(ApacheHttpClient.java:211)

at org.openqa.selenium.remote.HttpCommandExecutor.getDefaultClientFactory(HttpCommandExecutor.java:88)

at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:62)

at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:57)

at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:93)

at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)

at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)

at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)

at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)

at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)

at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)

at com.attilax.net.httpTest.main(httpTest.java:18)

 

 

版本以下(client and selenium)

 

(SSLConnectionSocketFactory.java:144)  httpclient-4.5.2.jar

 

selenium

Exception in thread "main" java.lang.NoSuchFieldError: INSTANCE

 

 

 

解決流程

掛載源碼 (SSLConnectionSocketFactory.java:144

  @Deprecated

    public static final X509HostnameVerifier ALLOW_ALL_HOSTNAME_VERIFIER

        = AllowAllHostnameVerifier.INSTANCE;

 

 

Org.apache.http.conn.sslAllowAllHostnameVerifier

 

public class AllowAllHostnameVerifier extends AbstractVerifier {

 

public static final AllowAllHostnameVerifier INSTANCE = new AllowAllHostnameVerifier();

 

這個AllowAllHostnameVerifier 就在client4.5.2 jar裏面啊,也有這個INSTANCE 屬性的。。

我猜測可能,SSLConnectionSocketFactory調取AllowAllHostnameVerifier 的時候,調取了另一個jar裏面的allowAhnVer這個class

 

使用jar包搜索工具,果真搜索到client4.1 這個jar。。

 

 

 

緣由:SSLConnectionSocketFactory調取AllowAllHostnameVerifier 的時候,調取了另一個jar裏面的allowAhnVer這個class 

解決: 4.5jar放在前面運行,讓它先加載。。或者使用代碼預先加載4.5jar包裏面的jar。。

刪除4.1d jar也可,可是可能有兼容性問題,最好仍是調整jar加載優先級在bat .claspath文件裏面。。

 

做者:: 綽號:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿爾 拉帕努伊 ) 

漢字名:艾提拉(艾龍)   EMAIL:1466519819@qq.com

轉載請註明來源: http://www.cnblogs.com/attilax/

 

Atiend

相關文章
相關標籤/搜索