Skip to content

Update java http client dependency to 4.0.0 issue #155 #162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

diegoc-am
Copy link
Contributor

No description provided.

@diegoc-am
Copy link
Contributor Author

The tests were failing on my end, even in master, didn't know how to fix them. The code looks good in my opinion @thinkingserious

@diegoc-am diegoc-am changed the title Update java http client dependency to 4.0.0 issue 155 Update java http client dependency to 4.0.0 issue #155 Oct 20, 2016
@thinkingserious
Copy link
Contributor

@belfazt,

Have you installed Prism for you local tests?

@thinkingserious thinkingserious added type: community enhancement feature request not on Twilio's roadmap status: cla signed status: work in progress Twilio or the community is in the process of implementing labels Oct 20, 2016
@diegoc-am
Copy link
Contributor Author

@thinkingserious,

Awesome, that solved the issue, now, how do I get travis to work? :P

Gradle Worker 1 executing tests. Gradle Worker 1 finished executing tests. Process 'Gradle Worker 1' finished with exit value 0 (state: SUCCEEDED) Finished generating test XML results (0.023 secs) Generating HTML test report... Finished generating test html results (0.037 secs) :test (Thread[main,5,main]) completed. Took 2 mins 18.607 secs.

@thinkingserious
Copy link
Contributor

@belfazt,

Don't worry about the Travis builds, this issue will resolve this problem.

Thank you for verifying!

@ARaqeeb
Copy link

ARaqeeb commented Mar 29, 2017

Kindly try to merge this as soon as possible! Based off Git Issue.

Please try to use the latest Http Client. Thanks a bunch!

@SendGridDX
Copy link
Collaborator

Hello @belfazt,

This issue has finally risen to the top of our queue!

The java-http-client is now at v4.1.0. Could you please update your PR?

Thanks!

Elmer

@diegoc-am
Copy link
Contributor Author

Updating PR

@diegoc-am
Copy link
Contributor Author

Starting process 'Gradle Worker 1'. Working directory: /Users/andres/hacktoberfest/sendgrid-java Command: /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/java -Djava.security.manager=jarjar.org.gradle.process.internal.child.BootstrapSecurityManager -Dfile.encoding=UTF-8 -ea -cp /Users/andres/.gradle/caches/1.8/workerMain/gradle-worker.jar jarjar.org.gradle.process.internal.launcher.GradleWorkerMain
An attempt to initialize for well behaving parent process finished.
Successfully started process 'Gradle Worker 1'
Gradle Worker 1 executing tests.
Gradle Worker 1 finished executing tests.
Process 'Gradle Worker 1' finished with exit value 0 (state: SUCCEEDED)
Finished generating test XML results (0.018 secs)
Generating HTML test report...
Finished generating test html results (0.027 secs)
:test (Thread[main,5,main]) completed. Took 21.741 secs.

BUILD SUCCESSFUL

@diegoc-am diegoc-am force-pushed the update-java-http-client-dependency-to-4.0.0-issue-155 branch from a69c81a to a513999 Compare April 23, 2017 17:27
@SendGridDX
Copy link
Collaborator

SendGridDX commented Apr 23, 2017

CLA assistant check
All committers have signed the CLA.

@diegoc-am
Copy link
Contributor Author

I think I've already signed a CLA agreement

@thinkingserious thinkingserious merged commit 7cff48d into sendgrid:master May 19, 2017
@thinkingserious
Copy link
Contributor

Hello @belfazt,

Thanks again for the PR!

We want to show our appreciation by sending you some swag. Could you please fill out this form so we can send it to you? Thanks!

Team SendGrid DX

thinkingserious added a commit that referenced this pull request May 19, 2017
@diegoc-am
Copy link
Contributor Author

diegoc-am commented May 19, 2017 via email

@thinkingserious
Copy link
Contributor

Well deserved!

@YEMEAC
Copy link

YEMEAC commented Jun 2, 2017

hi, I'm getting java.lang.NoClassDefFoundError: com/sendgrid/SendGridResponseHandler but the mail is being sent.
After read the different comments can't see exactly whats the change that needs to be done to stop having this problem.
some help please? 🙏

@diegoc-am diegoc-am deleted the update-java-http-client-dependency-to-4.0.0-issue-155 branch June 2, 2017 17:25
@thinkingserious
Copy link
Contributor

Hello @YeisonMelo,

Could you please provide the following details:

  1. What version of the SDK are you using?
  2. How did you install it?
  3. Can you share the code that is causing the issue?

Thanks!

With Best Regards,

Elmer

@YEMEAC
Copy link

YEMEAC commented Jun 5, 2017

Hi,
<dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpcore</artifactId> <version>4.4.4</version> </dependency>
<dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.5.2</version> </dependency>
<dependency> <groupId>com.sendgrid</groupId> <artifactId>sendgrid-java</artifactId> <version>4.0.1</version> </dependency>

Response response = sendGrid.api(request); is the line that gives me the error. The application doesn't crash and I get the email but the NoClassDefFoundError appears every time.

Listener method 'handleSendNotifierReport' threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/http/impl/client/AbstractResponseHandler

@thinkingserious
Copy link
Contributor

Hi @YeisonMelo,

I think there is trouble with redundant dependencies.

What happens if you remove all the dependencies to httpcomponents?

e.g. just have:

<dependency>
  <groupId>com.sendgrid</groupId>
  <artifactId>sendgrid-java</artifactId>
  <version>4.0.1</version>
</dependency>

@YEMEAC
Copy link

YEMEAC commented Jun 5, 2017

hi thank you for helping. Only keep the sengrid-java dependency was one of my first tries but after doing it the problem remained with the same behaviour. I have simplified my code to be able to use the version 2.2.2 and it works but from the version 3.0.0 the problem appears. I need to use the version 3.0.0 or higher with my project.

@thinkingserious
Copy link
Contributor

Do you have any other dependencies that use the apache dependencies? I've seen cases where duplicate conflicting versions of apache were installed because of that.

@YEMEAC
Copy link

YEMEAC commented Jun 5, 2017

looks like that can be the problem is a very big project so I isolated the module that uses sendgrid an have been able to send the email without the error.

@YEMEAC
Copy link

YEMEAC commented Jun 5, 2017

is there any way to use send grid without the httpclient dependencies? I found dependencies in the project with different versions that the one send grid includes(4.5.2) but I can't remove them or upgrade them to 4.5.2 without making other modules fail.

@thinkingserious
Copy link
Contributor

@YEMEAC
Copy link

YEMEAC commented Jun 9, 2017

I solve the problem thank you! 🎉 here my thoughts. The initial version 3.2.0 was failing for some problem in the jar file, it was looking for the class SendGridResponseHandler but wasn't able to find it during running time even when it was there, I checked the jar by myself. I read in other blogs that the jar 3.2.0 had some problem...

Then I update to the last version 4.0.1, then my problem was with dependencies since I was importing versions of httpclient and httpcore that were not compatible with send grid 4.0.1 so I made sure sendgrid was the first one importing the httpclient and httcore dependencies placing the sendgrid dependency at the begging of the pom file, the links @thinkingserious shared helped me to understand that this was happening.

@thinkingserious
Copy link
Contributor

That's awesome, thanks for sharing your results @YeisonMelo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: work in progress Twilio or the community is in the process of implementing type: community enhancement feature request not on Twilio's roadmap
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants