hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: java.lang.NoClassDefFoundError: org/apache/http/config/Lookup
Date Fri, 19 Jan 2018 22:12:08 GMT
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-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.or
> > g
> > 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message