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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • pycharm2021激活码【2021.7最新】

    (pycharm2021激活码)本文适用于JetBrains家族所有ide,包括IntelliJidea,phpstorm,webstorm,pycharm,datagrip等。https://javaforall.net/100143.htmlIntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,上面是详细链接哦~M…

    2022年3月21日
    65
  • Android 动态改变布局属性RelativeLayout.LayoutParams「建议收藏」

    Android 动态改变布局属性RelativeLayout.LayoutParams「建议收藏」我们知道,在RelativeLayout布局中有很多特殊的属性,通常在载入布局之前,在相关的xml文件中进行静态设置即可。但是,在有些情况下,我们需要动态设置布局的属性,在不同的条件下设置不同的布局排列方式,这时候就需要用到RelativeLayout.LayoutParams.addRule()方法,该方法有两种重载方式:首先初始化:RelativeLayout.LayoutParamslp=(RelativeLayout.LayoutParams)mBottomLayout.ge

    2022年7月17日
    31
  • 思科 计算机网络 期末考试答案

    思科 计算机网络 期末考试答案1.以下哪个域名是顶级域的一个示例?A.root.cisco.comB.www.cisco.comC.cisco.comD…com2.第2层数据封装有哪三个主要功能?(请选择三项。)A.将位组定界为帧B.通过冲突检测方法纠正错误C.在介质中放置和删除帧D.将位转换为数据信号E.通过CRC计算检测错误F.数据链路层寻址G.使用端口号控制会话3.管理员在发出ping命令之后在交换机上使用Ctrl-Shift-6键组合。使用这些按键有什么用途?A.允许用户完成命令B.中

    2022年7月23日
    10
  • fiddler和charles哪个好用_电脑15分钟自动重启

    fiddler和charles哪个好用_电脑15分钟自动重启前言Charles是收费软件,可以免费试用30天。试用期过后,未付费的用户仍然可以继续使用,但是每次使用时间不能超过30分钟,并且启动时将会有10秒种的延时。此时,我们只需网上找一个注册码即可解

    2022年7月28日
    9
  • suds用法_soap是不可数名词吗

    suds用法_soap是不可数名词吗http://www.cnblogs.com/Tommy-Yu/p/5567091.html

    2025年7月12日
    1
  • phpstorm 激活码(破解版激活)

    phpstorm 激活码(破解版激活),https://javaforall.net/100143.html。详细ieda激活码不妨到全栈程序员必看教程网一起来了解一下吧!

    2022年3月15日
    49

发表回复

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

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