sendgrid java,Sendgrid的Java不在Maven的工作

sendgrid java,Sendgrid的Java不在Maven的工作Iamusinghttp github com sendgrid sendgrid javainmyapp WhenItriedto javaitscausi lang NoClassDefFo

sendgrid java,Sendgrid的Java不在Maven的工作

I am using https://github.com/sendgrid/sendgrid-java in my app. When I tried to run a sendgridexample.java its causing error InvocationTargetException and the root cause is

java.lang.NoClassDefFoundError: org/apache/http/impl/client/HttpClientBuilder

com.sendgrid.SendGrid.(SendGrid.java:80)

I am using maven. Is there anyone tried this in maven. I tried reaching the sendgrid support team but still didn’t get any update regarding this. Can any one tell what is wrong with my code. Thanks in advance.

SendGrid sendgrid = new SendGrid(“API_KEY”);

SendGrid.Email email = new SendGrid.Email();

email.addTo(“”);

email.setFrom(“”);

email.setSubject(“Hello World”);

email.setText(“My first email with SendGrid Java!”);

try {

SendGrid.Response response = sendgrid.send(email);

System.out.println(response.getMessage());

}

catch (SendGridException e) {

System.err.println(e);

}

解决方案

Yes, I have found a solution. Go to https://github.com/sendgrid/sendgrid-java/tree/master/src/main/java/com/sendgrid. Copy the two java file[SendGrid.java and SendGridException.java] and create a folder com.sendgrid in your application and paste these two java file inside that folder. Then go to https://github.com/sendgrid/sendgrid-java/blob/master/pom.xml. Copy all the dependency for these two java file and paste in your pom.xml file. It will work fine.

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/233210.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 关于pin码破解的原理和reaver参数的解释「建议收藏」

    关于pin码破解的原理和reaver参数的解释「建议收藏」  路由器开启wps功能后,会随机生成一个8位的pin码,通过暴力枚举pin码,达到破解的目的,尤其现在很多路由器默认开启了wps功能。大家可能会想到8位的随机pin码将会有100000000种情况,这要pin到何年何月呀。。。。。。不过接下来讲解一下原理,大家会发现其实没多少种情况,这也是这种攻击方式比较流行的原因。 1.pin码破解的原理:  pin码是由8位纯数字组成的识别码,pin码破解是分三部分进行的,规律是这样的:pin码分为三部分,如图:      前4位为…

    2022年5月11日
    56
  • pix是什么意思(pixio)

    本文会介绍cGAN和pix2pix,并在TensorFlow中使用pix2pix模型。一、cGAN原理使用GAN可以无监督生成全新的图片,比如使用GAN生成MNIST数字,虽然可以生成数字,但是不能生成确定的数字。如果希望控制生成的结果,例如生成数字1,此时就要用到cGAN了。cGAN的全称为ConditionalGenerativeAdversarialNet…

    2022年4月12日
    83
  • pycharm2021.11永久激活码_在线激活[通俗易懂]

    (pycharm2021.11永久激活码)好多小伙伴总是说激活码老是失效,太麻烦,关注/收藏全栈君太难教程,2021永久激活的方法等着你。IntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,下面是详细链接哦~https://javaforall.net/100143.html23LNPMIJZT-eyJsaWNlbnNlSW…

    2022年3月29日
    105
  • tidb4.0.6离线安装

    tidb4.0.6离线安装

    2021年5月15日
    140
  • 可拔插视图

    可拔插视图基于类的试图fromflask.viewsimportViewfromflaskimportrender_templateclassUserLogin(View):methods=[‘POST’,’GET’]defdispatch_request(self):returnrender_template(‘login.html’)基于方法的试图from

    2022年5月30日
    90
  • UVA 10142 Australian Voting(模拟)

    UVA 10142 Australian Voting(模拟)

    2021年12月16日
    34

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号