Avatar of Al Larson
Al Larson
 asked on

Java Runtime Error CloseableHttpClient

Why am I getting this runtime error on this Java code?
CloseableHttpClient client = HttpClients.createDefault();

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.http.conn.ssl.DefaultHostnameVerifier.(DefaultHostnameVerifier.java:70) at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:944) at org.apache.http.impl.client.HttpClients.createDefault(HttpClients.java:58) at com.epsilon.SeismicExtractOAuth2.main(SeismicExtractOAuth2.java:206)
Java

Avatar of undefined
Last Comment
Jeffrey Dake

8/22/2022 - Mon
CEHJ

You need to add the Commons logging libraries to your project/classpath
Jeffrey Dake

Looks like when you compiled your code the apache common-logging package was included.  However when you ran your program, the classpath for your program did not include the location of where those files are.
CEHJ

Yes, that's more precise ;) Of course, it could have been compiled by someone else ...
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
girionis

You need to have the apache commons-logging in your classpath.
Al Larson

ASKER
Never mind; I figured it out.   Please close this ticket.
ASKER CERTIFIED SOLUTION
Jeffrey Dake

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.