twilio / twilio-java

A Java library for communicating with the Twilio REST API and generating TwiML.
MIT License
482 stars 421 forks source link

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

Closed dipanshu91 closed 1 year ago

dipanshu91 commented 1 year ago

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 commented 1 year ago

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

kridai commented 1 year ago

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

blcakcatming commented 1 year ago

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>
childish-sambino commented 1 year ago

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

dipanshu91 commented 1 year ago

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?

childish-sambino commented 1 year ago

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.

rakatyal commented 1 year ago

Closing due to inactivity.