On Fri, 2018-01-19 at 14:46 -0700, Russell Bateman wrote: > Oleg, > > Thank you for responding. > > What version of httpcore should I put there? There is apparently non > corresponding to 4.5.4. I tried httpcore-4.4.8 and the result was > the > same. 4.4.8 is the latest version I can find in Maven. > > https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore > > Russ >
The version is correct but _something else_ (like AWS SDK) is pulling older code from your classpath. You need to find out what it is. See this SO thread. It might help https://stackoverflow.com/questions/21864521/java-lang-nosuchfielderror -org-apache-http-message-basiclineformatter-instance Oleg > On 01/19/2018 02:28 PM, Oleg Kalnichevski wrote: > > On Fri, 2018-01-19 at 13:37 -0700, Russell Bateman wrote: > > > I haven't used an Apache HTTP client in a few years. So, I've > > > started > > > fresh. Having written precious little code carefully following > > > http://hc.apache.org/httpcomponents-client-4.5.x/quickstart.html, > > > I > > > get > > > this exception as soon as I call createDefault(): > > > > > > /* CloseableHttpClient client = HttpClients.createDefault();*/ > > > HttpGet get = new HttpGet( query ); > > > > > > get.setHeader( ACCEPT_CHARSET, UTF8 ); > > > get.setHeader( "Accept", "application/xml,application/json" > > > ); > > > > > > CloseableHttpResponse response = client.execute( get ); > > > HttpEntity entity = response.getEntity(); > > > > > > try > > > { > > > return entity.getContent(); > > > } > > > catch( IOException e ) > > > { > > > throw new IOException( e.getMessage() + " occurred > > > getting > > > query > > > response" ); > > > } > > > finally > > > { > > > response.close(); > > > } > > > > > > I die similarly in my POST requests. > > > > > > The full stack trace follows (below), but here's what I have in > > > /pom.xml/:. I added the httpcore out of desperation and googling > > > for > > > this problem. No matter, it happens with or without it and no > > > matter > > > what version I add. > > > > > > > > > <apache.http.client.version>*4.5.4*</apache.http.client.version> > > > > > > * <dependency>** > > > **<groupId>org.apache.httpcomponents</groupId>** > > > **<artifactId>httpclient</artifactId>** > > > **<version>${apache.http.client.version}</version>** > > > ** </dependency>* > > > <dependency> > > > <groupId>org.apache.httpcomponents</groupId> > > > <artifactId>httpcore</artifactId> > > > <version>*4.4.7*</version> > > > </dependency> > > > > > > What have I done wrong? > > > > > > > Your dependency tree appears to be wrong. Something is pulling an > > old > > version of HttpCore. > > > > Oleg > > > > > > ----------------------------------------------------------------- > > ---- > > To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org > > For additional commands, e-mail: httpclient-users-h...@hc.apache.or > > g > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org