开发者社区> 问答> 正文

在tomcat服务器上部署阿里云短信模块时在服务器启动不成功

在eclipse中运行阿里云sms短信服务时,发送与接收信息运行正常,打包后部署到tomcat服务器上后,启动tomcat服务器后,服务器报如下错误,一直运行不起来,不知道啥原因。
08:43:38.175 [PullMessageTask-thread] ERROR c.a.m.t.DefaultAlicomMessagePuller - PullMessageTask_execute_error,messageType:SmsUp,queueName:Alicom-Queue-XXXXXXXXXXXXXX-SmsUp
com.aliyuncs.exceptions.ClientException: SDK.ServerUnreachable : Server unreachable: java.net.UnknownHostException: dybaseapi.aliyuncs.com

at com.aliyuncs.DefaultAcsClient.doAction(DefaultAcsClient.java:207) ~[aliyun-java-sdk-core-3.2.2.jar:na]
at com.aliyuncs.DefaultAcsClient.doAction(DefaultAcsClient.java:152) ~[aliyun-java-sdk-core-3.2.2.jar:na]
at com.aliyuncs.DefaultAcsClient.doAction(DefaultAcsClient.java:60) ~[aliyun-java-sdk-core-3.2.2.jar:na]
at com.aliyuncs.DefaultAcsClient.getAcsResponse(DefaultAcsClient.java:104) ~[aliyun-java-sdk-core-3.2.2.jar:na]
at com.alicom.mns.tools.TokenGetterForAlicom.getTokenFromRemote(TokenGetterForAlicom.java:63) ~[receive-2017.8.jar:na]
at com.alicom.mns.tools.TokenGetterForAlicom.getTokenByMessageType(TokenGetterForAlicom.java:92) ~[receive-2017.8.jar:na]
at com.alicom.mns.tools.DefaultAlicomMessagePuller$PullMessageTask.run(DefaultAlicomMessagePuller.java:31) ~[receive-2017.8.jar:na]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71]

08:43:38.175 [PullMessageTask-thread] ERROR c.a.m.t.DefaultAlicomMessagePuller - PullMessageTask_execute_error,messageType:SmsReport,queueName:Alicom-Queue-XXXXXXXXXXXXXX-SmsReport
com.aliyuncs.exceptions.ClientException: SDK.ServerUnreachable : Server unreachable: java.net.UnknownHostException: dybaseapi.aliyuncs.com

at com.aliyuncs.DefaultAcsClient.doAction(DefaultAcsClient.java:207) ~[aliyun-java-sdk-core-3.2.2.jar:na]
at com.aliyuncs.DefaultAcsClient.doAction(DefaultAcsClient.java:152) ~[aliyun-java-sdk-core-3.2.2.jar:na]
at com.aliyuncs.DefaultAcsClient.doAction(DefaultAcsClient.java:60) ~[aliyun-java-sdk-core-3.2.2.jar:na]
at com.aliyuncs.DefaultAcsClient.getAcsResponse(DefaultAcsClient.java:104) ~[aliyun-java-sdk-core-3.2.2.jar:na]
at com.alicom.mns.tools.TokenGetterForAlicom.getTokenFromRemote(TokenGetterForAlicom.java:63) ~[receive-2017.8.jar:na]
at com.alicom.mns.tools.TokenGetterForAlicom.getTokenByMessageType(TokenGetterForAlicom.java:92) ~[receive-2017.8.jar:na]
at com.alicom.mns.tools.DefaultAlicomMessagePuller$PullMessageTask.run(DefaultAlicomMessagePuller.java:31) ~[receive-2017.8.jar:na]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71]

展开
收起
游客afv2w2vxtgxwi 2019-05-16 18:42:03 8276 0
2 条回答
写回答
取消 提交回答
  • JAVA开发工程师
        public static void main(String[] args) {
            DefaultProfile profile = DefaultProfile.getProfile("default", "<accessKeyId>", "<accessSecret>");
            IAcsClient client = new DefaultAcsClient(profile);
    
            CommonRequest request = new CommonRequest();
            //request.setProtocol(ProtocolType.HTTPS);
            request.setMethod(MethodType.POST);
            request.setDomain("dysmsapi.aliyuncs.com");
            request.setVersion("2017-05-25");
            request.setAction("SendSms");
    
            try {
                CommonResponse response = client.getCommonResponse(request);
                System.out.println(response.getData());
            } catch (ServerException e) {
                e.printStackTrace();
            } catch (ClientException e) {
                e.printStackTrace();
            }
        }

    这是官方的例子,你可以检查下你配置的各个参数,你抛的异常是服务器无法访问,另外推荐你使用我的工具,方便你的使用点击前往

    2019-07-17 23:35:33
    赞同 展开评论 打赏
  • 一.先确定在服务器可否正常打开

    命令行 wget http://localhost:8080检查   或浏览器 http://localhost:8080检查

    二.如果上面没问题进入阿里云控制台:

    步骤:

    1.登陆阿里云 
    2.进入安全组

    “控制台” -> “云服务器 ECS” -> 选择云服务器 -> “更多” -> “安全组配置”

    3.配置规则

    “配置规则” -> “添加安全组规则”

    4.配置8080端口 

    image
    image
    image

    2019-07-17 23:35:33
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
云服务器可观测能力的探索与实践 立即下载
大规模云服务器高效使用及管理最佳实践 立即下载
如何运维千台以上游戏云服务器 立即下载