2

I keep getting a NoSuchFieldError when I call execute on my DefaultHttpClient instance. These are the lines of code I have.

        HttpClient client = new DefaultHttpClient();        
        HttpPost post = new HttpPost("http://10.65.98.158/atlas/rest/comparablesBulk?type=permId");
        StringEntity req = new StringEntity(request.toJSONString(),ContentType.APPLICATION_JSON);
        post.setEntity(req);
        HttpResponse response = client.execute(post);//this is where the error happens

This is the stacktrace I get:

Exception in thread "main" java.lang.NoSuchFieldError: DEF_CONTENT_CHARSET
    at org.apache.http.impl.client.DefaultHttpClient.setDefaultHttpParams(DefaultHttpClient.java:175)
    at org.apache.http.impl.client.DefaultHttpClient.createHttpParams(DefaultHttpClient.java:158)
    at org.apache.http.impl.client.AbstractHttpClient.getParams(AbstractHttpClient.java:448)
    at org.apache.http.impl.client.AbstractHttpClient.createClientConnectionManager(AbstractHttpClient.java:309)
    at org.apache.http.impl.client.AbstractHttpClient.getConnectionManager(AbstractHttpClient.java:466)
    at org.apache.http.impl.client.AbstractHttpClient.createHttpContext(AbstractHttpClient.java:286)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:851)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784)
    at AtlasService.main(AtlasService.java:62)
user1943079
  • 511
  • 6
  • 20
  • I realize this question is rather old now, but a similar question was also asked [here](http://stackoverflow.com/q/18246979/877472). That poster's problem seemed to be a classpath issue. Not sure yours was similar at all. – Paul Richter Jan 20 '14 at 22:38

0 Answers0