本地tomcat调试成功,部署到服务器请求接口,连接不上极光服务器

javasdk
标签: #<Tag:0x00007fb83bbb1e58>

(ninini) #1
cn.jiguang.common.resp.APIConnectionException: connect timed out. 
Connect to JPush Server timed out, and already retried some times. 
Please ensure your internet connection is ok. 
If the problem persists, please let us know at support@jpush.cn.
	at cn.jiguang.common.connection.NativeHttpClient.doRequest(NativeHttpClient.java:107)
	at cn.jiguang.common.connection.NativeHttpClient.sendPost(NativeHttpClient.java:86)
	at cn.jpush.api.push.PushClient.sendPush(PushClient.java:160)
	at cn.jpush.api.JPushClient.sendPush(JPushClient.java:194)
	at com.thinkgem.jeesite.common.utils.JiGuangPushUtil.pushNotice(JiGuangPushUtil.java:54)
	at com.thinkgem.jeesite.modules.transfer.service.SysUserTransferService.ShenPi(SysUserTransferService.java:163)
	at com.thinkgem.jeesite.modules.transfer.service.SysUserTransferService$$FastClassBySpringCGLIB$$b335146.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:718)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
	at com.thinkgem.jeesite.modules.transfer.service.SysUserTransferService$$EnhancerBySpringCGLIB$$70b5d036.ShenPi(<generated>)
	at com.thinkgem.jeesite.modules.transfer.service.SysUserTransferService$$FastClassBySpringCGLIB$$b335146.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:718)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
	at com.thinkgem.jeesite.modules.transfer.service.SysUserTransferService$$EnhancerBySpringCGLIB$$29939dec.ShenPi(<generated>)
	at com.thinkgem.jeesite.modules.transfer.web.SysUserTransferController.zbShenPi(SysUserTransferController.java:255)
	at com.thinkgem.jeesite.modules.transfer.web.SysUserTransferController$$FastClassBySpringCGLIB$$637859ca.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:649)
	at com.thinkgem.jeesite.modules.transfer.web.SysUserTransferController$$EnhancerBySpringCGLIB$$a3366699.zbShenPi(<generated>)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:222)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:775)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:965)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:856)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:841)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
	at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2527)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2516)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.SocketTimeoutException: connect timed out
	at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
	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.PlainSocketImpl.connect(PlainSocketImpl.java:172)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
	at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
	at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
	at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1316)
	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1291)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
	at cn.jiguang.common.connection.NativeHttpClient._doRequest(NativeHttpClient.java:161)
	at cn.jiguang.common.connection.NativeHttpClient.doRequest(NativeHttpClient.java:99)
	... 91 more

#2

排查下网络设置


(ninini) #3

服务器可以访问https网站以及微信https接口,ping api.jpush.cn可以ping通,然后就不知道什么地方还需要配置了


#4

根据我的链接说明去排查并给出每个命令的结果


(ninini) #5

RESTClient 请求成功
返回{
“sendno”: “0”,
“msg_id”: “9007201354561438”
}
ping api.jpush.cn 能通


#6

你这里请求成功了是不是就没问题了?


(ninini) #7

但是我部署到公司服务器上的tomcat上还是提示,我其他服务器以及本地都是可以的
Caused by: java.net.SocketTimeoutException: connect timed out


#8

那你在公司的服务器上做上述命令的测试看一下网络设置状况呀。


(ninini) #9

1.直接crul请求成功
返回信息
{
“sendno”: “0”,
“msg_id”: “2251808589282866”
}
2.nslookup api.jpush.cn:如下

  服务器:  UnKnown
Address:  172.21.1.20

非权威应答:
DNS request timed out.
    timeout was 2 seconds.
名称:    api.jpush.cn
Address:  113.31.136.105

3:ping api.jpush.cn
能ping通
4.traceter api.jpush.cn结果如下:
通过最多 30 个跃点跟踪
api.jpush.cn [113.31.136.105] 的路由:

  1     2 ms     2 ms     2 ms  172.21.1.254
  2    <1 毫秒   <1 毫秒   <1 毫秒 172.21.10.251
  3     3 ms     3 ms     2 ms  113.240.251.177
  4     5 ms     5 ms     4 ms  222.247.28.229
  5     3 ms     7 ms     6 ms  192.168.193.249
  6     1 ms     1 ms     1 ms  61.137.9.221
  7    32 ms    27 ms    26 ms  202.97.69.161
  8    24 ms     *       24 ms  220.181.16.58
  9     *        *        *     请求超时。
 10    28 ms    29 ms    29 ms  220.181.182.198
 11    28 ms    27 ms    27 ms  113.31.80.99
 12    26 ms    26 ms    25 ms  113.31.136.105

5.telnet api.jpush.cn 443结果如下:

 HTTP/1.1 400 Bad Request
Server: nginx
Date: Wed, 09 Jan 2019 15:12:40 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 150
Connection: close

<html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx</center>
</body>
</html>


遗失对主机的连接。

麻烦大哥帮我看看,服务器上还需要怎么配置。


#10

目前看是能够连上服务器的,你 curl 请求也能成功,是用 Java SDK 在这个服务器不行是吗

Java SDK 版本多少?

使用 Java SDK 请求的时候是否有更多的报错信息。

是用的阿里云服务器吗,用的是jdk环境环境吗?jdk是open jdk还是sun的?

是否用了 weblogic
https://docs.jiguang.cn/jpush/server/sdk/java_sdk/#weblogic-java-sdk


(ninini) #11

使用的3.3.9的jpush-client,过程中只报了连接不上极光服务器的错误,jdk版本是sun的,没有使用weblogic,只有一点服务器是公司自己的,服务器本地使用8080端口请求jpush也是无法连接,外网访问做了端口映射,不知道是可能是这个问题


#12

极光的 V3 接口需要的是 443 端口,不是 80 ,用 80 没法连接的。