1.先看看错误日志
2019-01-11 09:21:32,242 INFO [pool-3-thread-1] com.ejavashop.core.sms.xfbsms.utils.LoggerUtil.info(45) -- Fri Jan 11 09:21:32 CST 2019 sendTemplateSMS url = https://sandboxapp.cloopen.com:8883/2013-12-26/Accounts/aaf98f8952f7367a01530c5dd33626c6/SMS/TemplateSMS?sig=7939BE20B60257805AF0B6A99B28ED38
2019-01-11 09:21:32,243 INFO [pool-3-thread-1] com.ejavashop.core.sms.xfbsms.utils.LoggerUtil.info(45) -- Fri Jan 11 09:21:32 CST 2019 sendTemplateSMS Request body = {"appId":"8aaf07085e0e36d0015e279952c20746","to":"13152541141","templateId":"259015","datas":["您好,您已成功注册,您的验证码是613957【广东禧越科技】","10"]}
2019-01-11 09:21:32,243 DEBUG [pool-3-thread-1] org.apache.http.impl.conn.BasicClientConnectionManager.getConnection(160) -- Get connection for route {s}->https://sandboxapp.cloopen.com:8883
2019-01-11 09:21:32,278 DEBUG [pool-3-thread-1] org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(174) -- Connecting to sandboxapp.cloopen.com:8883
2019-01-11 09:21:47,870 DEBUG [Timer-0] org.apache.http.impl.conn.LoggingManagedHttpClientConnection.shutdown(87) -- http-outgoing-85: Shutdown connection
2019-01-11 09:21:47,871 DEBUG [Timer-0] org.apache.http.impl.execchain.ConnectionHolder.abortConnection(128) -- Connection discarded
2019-01-11 09:21:47,871 DEBUG [Timer-0] org.apache.http.impl.conn.LoggingManagedHttpClientConnection.close(79) -- http-outgoing-85: Close connection
2019-01-11 09:21:47,871 DEBUG [Timer-0] org.apache.http.impl.conn.PoolingHttpClientConnectionManager.releaseConnection(320) -- Connection released: [id: 85][route: {}->http://183.232.34.84:8080][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
org.apache.http.conn.ConnectTimeoutException: Connect to 183.232.34.84:8080 [/183.232.34.84] failed: Connection timed out
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:149)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
at com.ejavashop.core.HttpClientUtil.sendGet(HttpClientUtil.java:36)
at com.ejavashop.web.job.IndexCacheTimerTask.run(IndexCacheTimerTask.java:40)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Caused by: java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
... 13 more
2019-01-11 09:21:47,871 DEBUG [Timer-0] org.apache.http.impl.conn.PoolingHttpClientConnectionManager.shutdown(388) -- Connection manager is shutting down
2019-01-11 09:21:47,872 DEBUG [Timer-0] org.apache.http.impl.conn.PoolingHttpClientConnectionManager.shutdown(394) -- Connection manager shut down
2019-01-11 09:21:47,872 INFO [Timer-0] com.ejavashop.web.job.IndexCacheTimerTask.run(46) -- ----------------定时器执行结束-----------------------
2019-01-11 09:21:56,433 DEBUG [Timer-1] org.apache.http.impl.conn.LoggingManagedHttpClientConnection.shutdown(87) -- http-outgoing-85: Shutdown connection
2019-01-11 09:21:56,433 DEBUG [Timer-1] org.apache.http.impl.execchain.ConnectionHolder.abortConnection(128) -- Connection discarded
2019-01-11 09:21:56,434 DEBUG [Timer-1] org.apache.http.impl.conn.LoggingManagedHttpClientConnection.close(79) -- http-outgoing-85: Close connection
2019-01-11 09:21:56,434 DEBUG [Timer-1] org.apache.http.impl.conn.PoolingHttpClientConnectionManager.releaseConnection(320) -- Connection released: [id: 85][route: {}->http://183.232.34.84:8080][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
org.apache.http.conn.ConnectTimeoutException: Connect to 183.232.34.84:8080 [/183.232.34.84] failed: Connection timed out
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:149)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
at com.ejavashop.core.HttpClientUtil.sendGet(HttpClientUtil.java:36)
at com.ejavashop.web.job.IndexCacheTimerTask.run(IndexCacheTimerTask.java:40)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Caused by: java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
... 13 more
2019-01-11 09:21:56,434 DEBUG [Timer-1] org.apache.http.impl.conn.PoolingHttpClientConnectionManager.shutdown(388) -- Connection manager is shutting down
2019-01-11 09:21:56,434 DEBUG [Timer-1] org.apache.http.impl.conn.PoolingHttpClientConnectionManager.shutdown(394) -- Connection manager shut down
2019-01-11 09:21:56,434 INFO [Timer-1] com.ejavashop.web.job.IndexCacheTimerTask.run(46) -- ----------------定时器执行结束-----------------------
2.
首先从main方法开始。。。图中箭头从左到右依次为 手机号,模板号,验证码。。有效期
3. 检查一些参数
4.执行main方法
发现本地能发送短信,服务器却超时
5.解决方法。。。由于服务器和本地的环境不同。。检查端口是否开放权限
最重要的….将ip从沙箱设置为app…SERVER_IP = "app.cloopen.com";
6. clean install package 上传服务器
完成
网友评论