2012-10-01 96 views
0
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:468) 
    com.google.android.gcm.server.Sender.post(Sender.java:447) 
    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:91) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:710) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803) 
    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:244) 
    java.security.AccessController.doPrivileged(Native Method) 
    javax.security.auth.Subject.doAsPrivileged(Subject.java:517) 
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276) 
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162) 

我從http://androidv5.wordpress.com/2012/08/15/how-to-implement-google-cloud-messaging/ refferd ......所以除了這個解決方案.. PL幫我解決這個錯誤..我已授予所有權限文件toones ..東西是..我主持我的戰爭文件在網絡上..當我運行客戶端從Android emultor pgm ..服務器註冊客戶端(即服務器獲得客戶端的響應(emulatore),但是當我從服務器發送味精客戶端即時得到上述錯誤)......我也有使用的瀏覽器的API密鑰java.security.AccessControlException:訪問被拒絕(java.net.SocketPermission android.googleapis.com:443連接,解決)

回答

2

把權限在menifest文件:

 <permission android:name="com.example.gcm.permission.C2D_MESSAGE"android:protectionLevel="signature"/> 
     <uses-permission android:name="com.example.gcm.permission.C2D_MESSAGE" /> 
     <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> 
0

我有完全相同的錯誤 - 我已經構建serverside.war文件並將其部署在免費的java託管eatj上。好像我的免費主機沒有權限

相關問題