2012-04-06 18 views
0

私はしばらく頭を下げていましたが、誰かが助けてくれることを願っていますか? ローカルマシンから実行しているときにデバイスにプッシュするJavaPNSコードがいくつかありますが、コードを自分のサーバーにコピーすると、すべてエラーは発生しませんが、デバイス上でアラートが表示されません。 ローカルボックスと比較してサーバーからのログを調べた後、サーバー上でフラッシングメッセージが表示されないことに気付きました.30スレッドのJavaPNSキューを使用しています。ローカルボックスとサーバーの両方の場合、30件未満のアラートを送信しています。JavaPNS - サーバーからではなく、ラップトップから正常に動作しますか?

public class PushWorker 
{ 
private PushQueue queue = null; 

public PushWorker(File keystore, String password, boolean production) throws KeystoreException 
{ 
    BasicConfigurator.configure(); 
    int threads = 30; 
    this.queue = Push.queue(keystore, password, production, threads); 
    queue.start(); 
} 

public void push(String message, String sound, String token, String eventId) throws JSONException 
{ 
    BasicDevice bd = new BasicDevice(); 
    bd.setToken(token); 

    PushNotificationPayload payload = PushNotificationPayload.complex(); 
    payload.addAlert(message); 
    payload.addSound(sound); 
    payload.addCustomDictionary("eid", eventId); 

    push(payload, bd); 
} 

private void push(Payload payload, Device device) 
{ 
    queue.add(payload, device); 
} 
} 

---- BELOWフラッシュメッセージが

4872 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.notification.PushNotificationManager - Flushing 
4872 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.notification.PushNotificationManager - At this point, the entire 139-bytes message has been streamed out successfully through the SSL connection 
4872 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.notification.PushNotificationManager - Notification sent on first attempt 

私はキューから何とかフラッシュを強制することができ、私の地元のボックス--------------からでしょうか?

---------------------- BELLOWはサーバーJavaPNSログです------------------ -----

0 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.communication.ConnectionToAppleServer - Creating SSLSocketFactory 
16 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.communication.ConnectionToAppleServer - Creating SSLSocketFactory 
49 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.communication.ConnectionToAppleServer - Creating SSLSocket to gateway.sandbox.push.apple.com:2195 
49 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.communication.ConnectionToAppleServer - Creating SSLSocket to gateway.sandbox.push.apple.com:2195 
177 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.notification.PushNotificationManager - Initialized Connection to Host: [gateway.sandbox.push.apple.com] Port: [2195]: 5117f31e[SSL_NULL_WITH_NULL_NULL: Socket[addr=gateway.sandbox.push.apple.com/17.172.233.65,port=2195,localport=56015]] 
... 
... 

DEBUG javapns.notification.Payload - Adding alert [blah, blah my alert] 
14767 [main] DEBUG javapns.notification.Payload - Adding sound [default] 
14767 [main] DEBUG javapns.notification.Payload - Adding custom Dictionary [eid] = [193790] 
14776 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.notification.PushNotificationManager - Building Raw message from deviceToken and payload 
14776 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.notification.PushNotificationManager - Built raw message ID 16777217 of total length 135 
14777 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.notification.PushNotificationManager - Attempting to send notification: {"aps":{"sound":"default","alert":"blah, blah my alert"},"eid":"193790"} 
14777 [JavaPNS grouped notification thread in QUEUE mode] DEBUG javapns.notification.PushNotificationManager - to device: [my device number] 

そして、それはそれだ、フラッシュなし...

答えて

0

は、サーバーまたは他のファイアウォールデバイス上で設定iptablesのを持っていませんか?

  • 多分ポート2195を許可する必要があります。

は、テストにTelnetを使用してみてください:

の$のtelnet gateway.sandbox.push.apple.com 2195

あなたはSELinuxが有効になっていますか?次の設定を確認してください。

$ getsebool -a | grep httpd

httpd_can_network_connect - >?

がオンになっていることを確認してください。

javapnsリポジトリのサイトでドキュメントを確認しましたか?

どうすればいいのか教えてください。

ビル

+0

ありがとうございます。サーバーからこのメソッドを使用してアラートを送信できるので、これは問題ではないと思います。Push.payloads(キーストア、パスワード、プロダクション、リスト); 私はキューではなくバルクで送信するこの方法に切り替えることにしました... – steve

関連する問題