使用smack库的JAVA中的GCM CCS(XMPP)实现.与gcm.googleapis.com的连接失败 [英] GCM CCS (XMPP) implementation in JAVA using smack library. Connection failed with gcm.googleapis.com

查看:86
本文介绍了使用smack库的JAVA中的GCM CCS(XMPP)实现.与gcm.googleapis.com的连接失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用GCM在android客户端和java中的服务器应用程序之间进行通信. 我正在使用基于XMPP的GCM,因为我需要异步的双向消息.

I am trying out GCM for communication between android client and a server application in java. I am using XMPP based GCM as i need asynchronous, bidirectional messages.

在我的客户端, 1. Google Play服务检查显示需要更新.

On my client side, 1. Google Play Service check showed that an update is required.

google play services is out of date. Requires 4242000 but found 3136130

Api级别-17,将AVD与Google API结合使用,Android 4.2.2 Google Play服务修订版15 我该如何解决?

Api level- 17, Using AVD with google API, Android 4.2.2 Google play services Revision 15 How can i solve this?

但是我可以成功注册设备.

But i can successfully register the device.

在服务器端,我使用 2.我正在使用smack库3.4.1 我在Google文档中使用了示例代码. 我收到以下错误

On Server side, i use 2. I am using smack library 3.4.1 i used the sample code in google docs. I get the following error

gcm.googleapis.com:5235 Exception: XMPPError connecting to gcm.googleapis.com:5235.; : remote-server-error(502)
  -- caused by: XMPPError connecting to gcm.googleapis.com:5235.: remote-server-error(502) XMPPError connecting to gcm.googleapis.com:5235.
  -- caused by: java.net.ConnectException: Connection timed out: connect
    at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:592)
    at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1010)
    at SmackCcsClient.connect(SmackCcsClient.java:247)
    at SmackCcsClient.main(SmackCcsClient.java:341)
Nested Exception: 
XMPPError connecting to gcm.googleapis.com:5235.: remote-server-error(502) XMPPError connecting to gcm.googleapis.com:5235.
  -- caused by: java.net.ConnectException: Connection timed out: connect
    at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:565)
    at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1010)
    at SmackCcsClient.connect(SmackCcsClient.java:247)
    at SmackCcsClient.main(SmackCcsClient.java:341)
Nested Exception: 
java.net.ConnectException: Connection timed out: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(Unknown Source)
    at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(Unknown Source)
    at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:557)
    at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1010)
    at SmackCcsClient.connect(SmackCcsClient.java:247)
    at SmackCcsClient.main(SmackCcsClient.java:341)
Exception in thread "main" java.lang.IllegalStateException: Not connected to server.
    at org.jivesoftware.smack.XMPPConnection.sendPacket(XMPPConnection.java:483)
    at SmackCcsClient.send(SmackCcsClient.java:131)
    at SmackCcsClient.main(SmackCcsClient.java:356)

我已经签署了用于上游消息传递的表格.但审批仍在进行中.但是连接本身在这里失败.我该怎么解决.

I have signed up the form for upstream messaging. but the approval is still pending. But the connection itself fails here. How can i solve this.

请帮助! 预先谢谢你!

Please Help! Thank you in advance!!

推荐答案

ERROR CODE 502表示连接SERVER存在问题,可能有多种原因,但是一些常见问题是

The ERROR CODE 502 implies that there is problem with connecting SERVER, There might be several reasons but some common problem are,

1)FIREWALL PROBLEM ---- [正确配置防火墙]

1 ) FIREWALL PROBLEM ----[configure properly your firewall]

2)服务器内部错误---- [稍后重试]

2 ) Server internal error ----[retry latter]

这篇关于使用smack库的JAVA中的GCM CCS(XMPP)实现.与gcm.googleapis.com的连接失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆