twilio-java icon indicating copy to clipboard operation
twilio-java copied to clipboard

NoSuchMethodError: org.apache.http.impl.client.DefaultRedirectStrategy.<init>(java.lang.String[])

Open dipanshu91 opened this issue 2 years ago • 2 comments

I'm getting NoSuchMethodError: org.apache.http.impl.client.DefaultRedirectStrategy.(java.lang.String[]) exception with Twilio v9.0.0-rc.4. Spring Boot v2.5.6. Java v11.

Not added any external dependency for httpclient. What should be fix for this?

dipanshu91 avatar Sep 13 '22 19:09 dipanshu91

@thinkingserious @childish-sambino : Can you please help with above?

dipanshu91 avatar Sep 13 '22 19:09 dipanshu91

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

kridai avatar Sep 15 '22 04:09 kridai

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>

blcakcatming avatar Sep 29 '22 08:09 blcakcatming

@dipanshu91 Does updating the httpclient dependency resolve the issue you're seeing?

childish-sambino avatar Sep 30 '22 14:09 childish-sambino

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?

dipanshu91 avatar Sep 30 '22 14:09 dipanshu91

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.

childish-sambino avatar Sep 30 '22 14:09 childish-sambino

Closing due to inactivity.

rakatyal avatar Oct 31 '22 18:10 rakatyal