嘿我一直在关注gcm教程来创建gcm-demo-server和一个demo-client。 一切都在tomcat上运作良好,
然后我将.war文件上传到免费的jsp域
首先页面上写着“没有设备注册” 一旦我从我的Android注册,它似乎已注册1个设备
我按下发送按钮在设备上发送通知,服务器崩溃时出现以下错误
ype Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
java.security.AccessControlException: access denied (java.net.SocketPermission android.googleapis.com:443 connect,resolve)
java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
java.security.AccessController.checkPermission(AccessController.java:546)
java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
java.lang.SecurityManager.checkConnect(SecurityManager.java:1034)
sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:271)
sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:328)
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:172)
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:793)
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:158)
sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:896)
sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230)
com.google.android.gcm.server.Sender.post(Sender.java:479)
com.google.android.gcm.server.Sender.post(Sender.java:458)
com.google.android.gcm.server.Sender.sendNoRetry(Sender.java:170)
com.google.android.gcm.server.Sender.send(Sender.java:121)
com.google.android.gcm.demo.server.SendAllMessagesServlet.doPost(SendAllMessagesServlet.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:274)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:271)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:306)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:166)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.26 logs.
答案 0 :(得分:2)
看起来某些身份验证问题可能是因为Key使用了。我不知道它的确切问题。请参阅本教程,它可能会对您有所帮助,
http://androidv5.wordpress.com/2012/08/15/how-to-implement-google-cloud-messaging/
它适用于我。