twilio-java
twilio-java copied to clipboard
NoSuchMethodError: org.apache.http.impl.client.DefaultRedirectStrategy.<init>(java.lang.String[])
I'm getting NoSuchMethodError: org.apache.http.impl.client.DefaultRedirectStrategy.
Not added any external dependency for httpclient. What should be fix for this?
@thinkingserious @childish-sambino : Can you please help with above?
Hi @dipanshu91 , I did try reproducing the issue with the same configuration as you, but couldn't. This could be due to dependency conflict issue, since the httpclient version in twilio sdk should have org.apache.http.impl.client.DefaultRedirectStrategy method. One way to find out the httpclient version is using the command mvn dependency:tree -Dincludes=org.apache.httpcomponents:httpclient
I update the httpclient
dependency solved this problem
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
@dipanshu91 Does updating the httpclient
dependency resolve the issue you're seeing?
After adding the httpclient dependency it got resolved. But the question was why we required to do that? Can't Twilio handle this conflict within SDK itself?
It depends on how the dependencies are being resolved in your application. Recommend using your build tool to inspect the dependency tree to determine where the potentially conflicting version of httpclient
is being pulled from.
Closing due to inactivity.