You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2016/06/27 13:18:52 UTC
[jira] [Resolved] (HTTPCLIENT-1753) Exception in thread "main"
java.lang.NoSuchFieldError: INSTANCE
[ https://issues.apache.org/jira/browse/HTTPCLIENT-1753?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oleg Kalnichevski resolved HTTPCLIENT-1753.
-------------------------------------------
Resolution: Invalid
The test case works for me. Please make sure your project does not have older versions of HttpClient as transitive dependencies.
Oleg
> Exception in thread "main" java.lang.NoSuchFieldError: INSTANCE
> ---------------------------------------------------------------
>
> Key: HTTPCLIENT-1753
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1753
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient
> Affects Versions: 4.5.2, 5.0 Alpha1
> Environment: Windows 7, Eclipse Version: Mars Release (4.5.0)
> Build id: 20150621-1200
> Reporter: Sugat Sapkota
> Labels: test
>
> I am trying to write a simple WebService Testing using HTTPClient. I have all my jars loaded up but get the above error message.
> I am getting the above error stacktrace.
> {code:title=RESTTester.java|borderStyle=solid}
> package HTTPClientTest;
> import java.io.IOException;
> import org.apache.http.HttpResponse;
> import org.apache.http.HttpStatus;
> import org.apache.http.client.ClientProtocolException;
> import org.apache.http.client.methods.HttpGet;
> import org.apache.http.client.methods.HttpUriRequest;
> import org.apache.http.impl.client.HttpClientBuilder;
> import org.junit.Assert;
> public class RESTTester {
> public static void main (String args[]) {
> String restURL_XML = "http://parabank.parasoft.com/parabank/services/bank/customers/12212/";
> try {
> testStatusCode(restURL_XML);
> } catch (ClientProtocolException e) {
> e.printStackTrace();
> } catch (IOException e) {
> e.printStackTrace();
> }
> }
> public static void testStatusCode(String restURL) throws ClientProtocolException, IOException {
> HttpUriRequest request = new HttpGet(restURL);
> HttpResponse httpResponse = HttpClientBuilder.create().build().execute(request);
> Assert.assertEquals(httpResponse.getStatusLine().getStatusCode(),HttpStatus.SC_OK);
> }
> }
> {code}
> {code}
> Exception in thread "main" java.lang.NoSuchFieldError: INSTANCE
> at org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit>(SSLConnectionSocketFactory.java:144)
> at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:966)
> at HTTPClientTest.RESTTester.testStatusCode(RESTTester.java:37)
> at HTTPClientTest.RESTTester.main(RESTTester.java:22)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org