Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Javapns、Java和googleappengine的苹果推送通知服务 @RequestMapping(“/initSendPushNotification.html”) 公共字符串initSendPushNotification()引发FileNotFoundException{ log.debug(“……启动initSendPushNotification方法…………”); 字符串password=“Initial”; 布尔沙盒=真; 字符串[]设备={“cc287c9008c08a8d6cedb9ca22318d675c6b4bf20101244fa1964790c9585f48” “41F888FE5DC2AC37481D6E6F7FAC09A30AD408A016276504EAB20C5DB1E9BA”; 试一试{ 字符串certificate=“/Certificates.p12”; File keystore=新文件(getClass().getResource(certificate).toURI()); log.debug(“……密钥库…………”+密钥库); List notifications=Push.alert(“你好,苹果,这是一条测试消息,名为Push!From:recorosoft”、密钥库、密码、沙盒、设备); 对于(推送通知:通知){ if(notification.issusccessful()){ log.debug(……..成功!苹果接受了通知,并应提交该通知………..+通知); } 否则{ 字符串invalidToken=notification.getDevice().getToken(); log.debug(..success!在此处添加代码以从数据库中删除invalidToken……..+invalidToken); } } log.debug(“……………End initSendPushNotification方法…………”); 回复“你好”; }捕获(通信异常e){ 日志错误(“……通信异常……”,e); } 捕获(KeystoreException e){ 日志错误(“……..KeystoreException………..”,e); } 捕获(URISyntaxException e){ 日志错误(……..URISyntaxException………..”,e); } 回复“你好”; }_Java_Ios_Google App Engine_Keystore_Javapns - Fatal编程技术网

使用Javapns、Java和googleappengine的苹果推送通知服务 @RequestMapping(“/initSendPushNotification.html”) 公共字符串initSendPushNotification()引发FileNotFoundException{ log.debug(“……启动initSendPushNotification方法…………”); 字符串password=“Initial”; 布尔沙盒=真; 字符串[]设备={“cc287c9008c08a8d6cedb9ca22318d675c6b4bf20101244fa1964790c9585f48” “41F888FE5DC2AC37481D6E6F7FAC09A30AD408A016276504EAB20C5DB1E9BA”; 试一试{ 字符串certificate=“/Certificates.p12”; File keystore=新文件(getClass().getResource(certificate).toURI()); log.debug(“……密钥库…………”+密钥库); List notifications=Push.alert(“你好,苹果,这是一条测试消息,名为Push!From:recorosoft”、密钥库、密码、沙盒、设备); 对于(推送通知:通知){ if(notification.issusccessful()){ log.debug(……..成功!苹果接受了通知,并应提交该通知………..+通知); } 否则{ 字符串invalidToken=notification.getDevice().getToken(); log.debug(..success!在此处添加代码以从数据库中删除invalidToken……..+invalidToken); } } log.debug(“……………End initSendPushNotification方法…………”); 回复“你好”; }捕获(通信异常e){ 日志错误(“……通信异常……”,e); } 捕获(KeystoreException e){ 日志错误(“……..KeystoreException………..”,e); } 捕获(URISyntaxException e){ 日志错误(……..URISyntaxException………..”,e); } 回复“你好”; }

使用Javapns、Java和googleappengine的苹果推送通知服务 @RequestMapping(“/initSendPushNotification.html”) 公共字符串initSendPushNotification()引发FileNotFoundException{ log.debug(“……启动initSendPushNotification方法…………”); 字符串password=“Initial”; 布尔沙盒=真; 字符串[]设备={“cc287c9008c08a8d6cedb9ca22318d675c6b4bf20101244fa1964790c9585f48” “41F888FE5DC2AC37481D6E6F7FAC09A30AD408A016276504EAB20C5DB1E9BA”; 试一试{ 字符串certificate=“/Certificates.p12”; File keystore=新文件(getClass().getResource(certificate).toURI()); log.debug(“……密钥库…………”+密钥库); List notifications=Push.alert(“你好,苹果,这是一条测试消息,名为Push!From:recorosoft”、密钥库、密码、沙盒、设备); 对于(推送通知:通知){ if(notification.issusccessful()){ log.debug(……..成功!苹果接受了通知,并应提交该通知………..+通知); } 否则{ 字符串invalidToken=notification.getDevice().getToken(); log.debug(..success!在此处添加代码以从数据库中删除invalidToken……..+invalidToken); } } log.debug(“……………End initSendPushNotification方法…………”); 回复“你好”; }捕获(通信异常e){ 日志错误(“……通信异常……”,e); } 捕获(KeystoreException e){ 日志错误(“……..KeystoreException………..”,e); } 捕获(URISyntaxException e){ 日志错误(……..URISyntaxException………..”,e); } 回复“你好”; },java,ios,google-app-engine,keystore,javapns,Java,Ios,Google App Engine,Keystore,Javapns,} 我已经创建了.p12证书,并且获得了64个字长的设备令牌。在这里,上面的应用程序运行正常,并从我的本地主机发送推送通知,但当我在谷歌云中部署它时,它不会发送推送通知,因为我使用谷歌应用程序引擎作为服务器。这里是谷歌云抛出的一个例外 @RequestMapping("/initSendPushNotification.html") public String initSendPushNotification() throws FileNotFoundException { log.de

}

我已经创建了.p12证书,并且获得了64个字长的设备令牌。在这里,上面的应用程序运行正常,并从我的本地主机发送推送通知,但当我在谷歌云中部署它时,它不会发送推送通知,因为我使用谷歌应用程序引擎作为服务器。这里是谷歌云抛出的一个例外

@RequestMapping("/initSendPushNotification.html")
public String initSendPushNotification() throws FileNotFoundException {
    log.debug(".............Start initSendPushNotification method............");
    String password="Initial";
    boolean sandbox = true;
    String[] devices = {"cc287c9008c08a8d6cedb9ca22318d675c6b4bf20101244fa1964790c9585f48"
                        ,"41f888fe5dc2ac37481d6e7e6f7fac09a30ad408a016276504eab20c5db1e9ba"};
    try{
        String certificate = "/Certificates.p12";
        File keystore = new File(getClass().getResource(certificate).toURI());

        log.debug("............keystore..........."+keystore);
        List<PushedNotification> notifications=Push.alert("Hello Apple This is a test message as push! From: Recrosoft ", keystore, password, sandbox, devices);
        for (PushedNotification notification : notifications) { 
            if (notification.isSuccessful()) {
                log.debug("...............Success! Apple accepted the notification and should deliver it............"+notification);
            } 
            else { 
                String invalidToken = notification.getDevice().getToken(); 
                log.debug("...............UnSuccess! Add code here to remove invalidToken from your database............"+invalidToken); 
            }
        }
        log.debug("..............End initSendPushNotification method............");
        return "hello";
    }catch(CommunicationException e){
        log.error(".................CommunicationException.................",e);
    }
    catch(KeystoreException e){
        log.error(".................KeystoreException.................",e);
    }
    catch(URISyntaxException e){
        log.error(".................URISyntaxException.................",e);
    }
    return "hello";

}
[s~bbdpayment/1.382061744668575915]:2015-02-13 07:25:22053[请求2B2E8452]错误(DemoController.java:54)。。。。。。。。。。。。。。。。。通信异常。。。。。。。。。。。。。。。。。
javapns.communication.exceptions.CommunicationException:CommunicationException:com.google.apphosting.api.ApiProxy$FeatureNotEnabledException:在管理控制台中启用计费后,将为此应用程序启用套接字api。
位于javapns.communication.connectionAppleServer.getSSLSocket(connectionAppleServer.java:158)
位于javapns.notification.PushNotificationManager.initializeConnection(PushNotificationManager.java:106)
在javapns.Push.sendPayload(Push.java:171)
在javapns.Push.alert(Push.java:47)
位于com.controller.DemoController.initSendPushNotification(DemoController.java:41)
在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处
在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)中
在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)中
在java.lang.reflect。你好
调用(Method.java:606)
位于com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_$1.run(Method_$1.java:179)
位于java.security.AccessController.doPrivileged(本机方法)
在com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method\uz.privilegedInvoke上(Method\uz.java:176)
位于com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method\ux.invoke\ux(Method\ux.java:137)
在com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method\uz.invoke(Method\uz.java:45)上
位于org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
位于org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
位于org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:100)
位于org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:604)
位于org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:565)
位于org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
位于org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
位于org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
位于org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
位于org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
位于javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
位于javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
位于org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
位于org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
在com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125)上
位于org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
位于com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:35)
位于org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
位于com.google.apphosting.utils.servlet.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:60)
位于org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:115
[s~bbdpayment/1.382061744668575915].<stdout>: 2015-02-13 07:25:22,053 [Request 2B2E8452] ERROR (DemoController.java:54) ? .................CommunicationException.................
javapns.communication.exceptions.CommunicationException: Communication exception: com.google.apphosting.api.ApiProxy$FeatureNotEnabledException: The Socket API will be enabled for this application once billing has been enabled in the admin console.
    at javapns.communication.ConnectionToAppleServer.getSSLSocket(ConnectionToAppleServer.java:158)
    at javapns.notification.PushNotificationManager.initializeConnection(PushNotificationManager.java:106)
    at javapns.Push.sendPayload(Push.java:171)
    at javapns.Push.alert(Push.java:47)
    at com.controller.DemoController.initSendPushNotification(DemoController.java:41)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.                hi
Method.invoke(Method.java:606)
    at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_$1.run(Method_.java:179)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_.privilegedInvoke(Method_.java:176)
    at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_.invoke_(Method_.java:137)
    at com.google.apphosting.runtime.security.shared.intercept.java.lang.reflect.Method_.invoke(Method_.java:45)
    at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:100)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:604)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:565)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:35)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:60)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:254)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
    at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:146)
    at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:484)
    at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:438)
    at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:445)
    at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:220)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:309)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:301)
    at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:442)
    at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:251)
    at java.lang.Thread.run(Thread.java:724)
Caused by: com.google.apphosting.api.ApiProxy$FeatureNotEnabledException: The Socket API will be enabled for this application once billing has been enabled in the admin console.
    at java.lang.Thread.getStackTrace(Thread.java:1568)
    at com.google.apphosting.runtime.ApiProxyImpl.doSyncCall(ApiProxyImpl.java:258)
    at com.google.apphosting.runtime.ApiProxyImpl.access$000(ApiProxyImpl.java:69)
    at com.google.apphosting.runtime.ApiProxyImpl$1.run(ApiProxyImpl.java:201)
    at com.google.apphosting.runtime.ApiProxyImpl$1.run(ApiProxyImpl.java:198)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.google.apphosting.runtime.ApiProxyImpl.makeSyncCall(ApiProxyImpl.java:198)
    at com.google.apphosting.runtime.ApiProxyImpl.makeSyncCall(ApiProxyImpl.java:69)
    at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:116)
    at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:65)
    at com.google.appengine.api.socket.SocketApiHelper.apiProxyMakeSyncCall(SocketApiHelper.java:90)
    at com.google.appengine.api.socket.SocketApiHelper.makeSyncCall(SocketApiHelper.java:58)
    at com.google.appengine.api.socket.NameServiceImpl.lookupAllHostAddr(NameServiceImpl.java:61)
    at com.google.apphosting.util.ResolverManager$AppEngineNameservice.lookupAllHostAddr(ResolverManager.java:42)
    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1388)
    at java.net.InetAddress.getAllByName0(InetAddress.java:1341)
    at java.net.InetAddress.getAllByName(InetAddress.java:1255)
    at java.net.InetAddress.getAllByName(InetAddress.java:1186)
    at java.net.InetAddress.getByName(InetAddress.java:1136)
    at java.net.InetSocketAddress.<init>(InetSocketAddress.java:220)
    at sun.security.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:409)
    at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:88)
    at javapns.communication.ConnectionToAppleServer.getSSLSocket(ConnectionToAppleServer.java:155)
    ... 57 more
Caused by: com.google.apphosting.api.ApiProxy$FeatureNotEnabledException: The Socket API will be enabled for this application once billing has been enabled in the admin console.
    at com.google.apphosting.utils.runtime.ApiProxyUtils.convertApiError(ApiProxyUtils.java:54)
    at com.google.apphosting.runtime.ApiProxyImpl$AsyncApiFuture.success(ApiProxyImpl.java:497)
    at com.google.apphosting.runtime.ApiProxyImpl$AsyncApiFuture.success(ApiProxyImpl.java:411)
<continued in next message>