I have implemented http client to communicate with my rest server which I have implemented using Apache CXF. when I use url at browser, evrything is fine but when I use client then I got an exception. The exception is
Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V at org.apache.commons.logging.impl.SLF4JLocationAwareLog.debug(SLF4JLocationAwareLog.java:99) at org.apache.http.client.protocol.RequestAuthCache.process(RequestAuthCache.java:75) at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:131) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:193) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:85) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57) at ABC.XYZ(ABC.java:45) at ABC.XYZ(ABC.java:93)
I have written following code at my client side
HttpClient client = HttpClientBuilder.create().build();
HttpGet getRequest = new HttpGet(path);
getRequest.addHeader("accept", "application/xml");
HttpResponse response = client.execute(getRequest);//here I have an exception