Hi, Iโm @healthy-tree ๐
healthy-tree / javapns Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/javapns
Automatically exported from code.google.com/p/javapns
Hi, Iโm @healthy-tree ๐
A Payload is limited to 256 Bytes.
Test if a created Payload is below this limit before sending it, if not
throw an exception.
Original issue reported on code.google.com by [email protected]
on 30 Jul 2009 at 9:55
I'm using javapns from behind a proxy. When attempting to send a push
notification to gateway.sandbox.push.apple.com it would come back with a
java.net.UknownHostException.
This was due to my proxy responding with a HTTP 1.1 header which the JSSE does
not support when using SecureSocket.
To fix the issue I had to implement proxy tunneling within the
javapns.back.SSLConnectionHelper class. (see
http://www.javaworld.com/javaworld/javatips/jw-javatip111.html?page=2) It
looks like this was previously supported was back in Feb 2010 in rev 24 of
SSLConnectionHelper.
The changes I made to the source to support proxy tunneling are attached.
Original issue reported on code.google.com by [email protected]
on 20 Apr 2011 at 8:13
Attachments:
I do not see the support for enhanced format from the source code. Did I miss
something?
I guess I can modify getMessage() for enhanced format, but not sure how to
handle No-Error or any timeout needed to retrieve the response.
Any sample code will be appreciated.
Weiping
Original issue reported on code.google.com by [email protected]
on 12 Apr 2011 at 9:05
It should be possible to design our own DeviceFactories (powered by JPA for
example) by making the following small modifications in your code (there are
other ways, but this one involves less code modifications and no design
changes):
1) Add a static setInstance(DeviceFactory) method to the DeviceFactory class,
to allow us to plug our own implementation of DeviceFactory.
2) Make the DeviceFactory constructor public. There is no reason here to make
it private, and this is preventing us from extending the class. The same
comment goes for the PushNotificationManager, whose private constructor is
preventing us from extending the class.
With these two small changes, we'll be able to build our own custom
DeviceFactory, register it by calling DeviceFactory.setInstance(myFactory), and
automatically get our custom-stored devices to the PushNotificationProvider.
Thank you very much for this very helpful library!
SP
Original issue reported on code.google.com by [email protected]
on 19 Oct 2010 at 8:23
What steps will reproduce the problem?
1.change the host from gateway.sandbox.push.apple.com
to gateway.push.apple.com
2. Use the production certificate generated by apple
What is the expected output? What do you see instead?
A successor connection initialized but instead i am seeing
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException:
PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find
valid certification path to requested target
What version of the product are you using? On what operating system?
Latest, on Linux
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 24 Feb 2011 at 4:24
I think it is good that there's no FeedbackServiceManager.close() method, and
socket's life cycle is encapsulated in the class, if we are sure socket is
closed when done.
In the current version, socket.close() is called at the end of the getDevice()
method, but not in a finally block. Any exception, such as NPE, thrown in the
getDevice() method can cause memory leak which the caller will not be able to
close.
Would it be possible to move the close statement to a finally block?
Thanks,
Eric
Original issue reported on code.google.com by [email protected]
on 7 Apr 2011 at 3:44
Could you make a simple method which only check a clientToken based on feedback
please?
BTW, APNS feedback returns device tokens if the notification delivery has
failed. This doesn't mean
that the application has been uninstalled from the device, it can just be that
the user doesn't have
persistent WiFi? connection at the moment. How can we check the uninstalled
status?
Thanks
Frank
Original issue reported on code.google.com by [email protected]
on 27 Apr 2010 at 4:24
hi,
when i call send notification method i get the following error.Plz help
what is going wrong.
Original issue reported on code.google.com by [email protected]
on 15 Apr 2010 at 1:25
Hi...I am able to send Push notifications using the following code template
Please suggest if there is better way to do this batch push using your APIs
//create payload
//open connection with apple server
pushManager.initializeConnection(.....);
for each iphone in database
pushManager.addDevice("iPhone", device.getDeviceToken());
client=pushManager.getDevice("iPhone");
pushManager.sendNotification(client, payLoad);
pushManager.removeDevice("iPhone");
end for
//close connection in finally block
Original issue reported on code.google.com by [email protected]
on 9 Dec 2010 at 3:28
What steps will reproduce the problem?
1.Run the working example on the IBM JVM
What is the expected output? What do you see instead?
SSL errors
What version of the product are you using? On what operating system?
Linux, latest version
Please provide any additional information below.
There's hardcode as I can see
private static final String ALGORITHM = "sunx509";
Please make a parameter optionally so it could be changed for IBM JVM
environment
Original issue reported on code.google.com by [email protected]
on 14 Jan 2011 at 2:20
What steps will reproduce the problem?
What is the expected output? What do you see instead?
I am waiting to be connected to APNS but after 8-9 seconds I get
java.net.ConnectException: Connection timed out: connect execption.
What version of the product are you using? On what operating system?
javapns-jdk16-161.jar on Windows XP...I am running the provider or client
from eclipse
Please provide any additional information below.
import javapns.back.PushNotificationManager;
import javapns.back.SSLConnectionHelper;
import javapns.data.Device;
import javapns.data.PayLoad;
public class Test {
// APNs Server Host & port
private static final String HOST = "gateway.sandbox.push.apple.com";
private static final int PORT = 2195;
// Badge
private static final int BADGE = 66;
// iPhone's UDID (64-char device token)
private static String iPhoneId =
"f4201f5d8278fe39545349d0868a24a3b60ed732";
private static String certificate =
"D:/certificate/NewAPNSGVDS_Certificate.p12";
private static String passwd = "satyam123";
public static void main( String[] args ) throws Exception
{System.out.println( "Setting up Push notification" );
try {
// Setup up a simple message
PayLoad aPayload = new PayLoad();
aPayload.addBadge( BADGE );
aPayload.addAlert("Hello! you have a new OVD Email");
System.out.println( "Payload setup successfull." );
System.out.println ( aPayload );
// Get PushNotification Instance
PushNotificationManager pushManager =
PushNotificationManager.getInstance();
// Link iPhone's UDID (64-char device token) to a stringName
pushManager.addDevice("iPhone", iPhoneId);
System.out.println( "iPhone UDID taken." );
System.out.println( "Token: " + pushManager.getDevice(
"iPhone" ).getToken() );
// Get iPhone client
Device client = pushManager.getDevice( "iPhone" );
System.out.println( "Client setup successfull." );
// Initialize connection
pushManager.initializeConnection( HOST, PORT, certificate,
passwd, SSLConnectionHelper.KEYSTORE_TYPE_PKCS12);
System.out.println( "Connection initialized..." );
// Send message
pushManager.sendNotification( client, aPayload );
System.out.println( "Message sent!" );
System.out.println( "# of attempts: " +
pushManager.getRetryAttempts() );
pushManager.stopConnection();
System.out.println( "done" );
} catch (Exception e) {
e.printStackTrace();
}
}
}
Original issue reported on code.google.com by [email protected]
on 11 May 2010 at 6:21
Hi,
I am using javapns-jdk1.5-v1.6.2.jar on windows 7, to create a connection to
apple NS
PushNotificationManager pushManager = null;
// Setup up a simple message
PayLoad aPayload = new PayLoad();
aPayload.addBadge(BADGE);
aPayload.addAlert(message);
aPayload.addSound("default");
LOG.info("Payload setup successfull. " + aPayload);
// Get PushNotification Instance
pushManager = PushNotificationManager.getInstance();
// Link iPhone's UDID (64-char device token) to a stringName
pushManager.addDevice("iphone", iPhoneId);
LOG.info("iPhone UDID taken.");
LOG.info("Token: " + pushManager.getDevice("iphone").getToken());
// Get iPhone client
Device client = pushManager.getDevice("iphone");
LOG.info("Client setup successfull.");
// Initialize connection
pushManager.setProxy("p-host", "p-port"); //
pushManager.initializeConnection(HOST, PORT, inputStream, passwd, SSLConnectionHelper.KEYSTORE_TYPE_PKCS12);
LOG.info("Connection initialized...");
// Send message
pushManager.sendNotification(client, aPayload);
LOG.info("Message sent!");
The code try's to connect (pushManager.initializeConnection(..)), it throws a
Connection refused: connect, exception
I have checked my proxy settings and thy are correct, however when i listen on
the proxy ports the executing code does not connect to the proxy server.
Any ideas?
Thanks
Original issue reported on code.google.com by [email protected]
on 14 Sep 2010 at 10:38
When Using an IBM JRE, we get an exception :
java.security.NoSuchAlgorithmException: sunx509 TrustManagerFactory not
available
at sun.security.jca.GetInstance.getInstance(GetInstance.java:158)
at javax.net.ssl.TrustManagerFactory.getInstance(TrustManagerFactory.java:20)
at javapns.back.SSLConnectionHelper.getFeedbackSSLSocketFactory(Unknown Source)
at javapns.back.SSLConnectionHelper.getFeedbackSSLSocket(Unknown Source)
at javapns.back.FeedbackServiceManager.getDevices(Unknown Source)
Problem seems to be in SSLConnectionHelper :
private static final String ALGORITHM = "sunx509";
This Algorithm is only present in Sun JRE.
If possible, could you please implement a more configurable way to provide the
algorithm (see
http://download.oracle.com/javase/1.5.0/docs/api/javax/net/ssl/KeyManagerFactory
.html) ?
For example :
private static final String ALGORITHM = ((Security.getProperty("ssl.KeyManagerFactory.algorithm") == null)? "sunx509" : Security.getProperty("ssl.KeyManagerFactory.algorithm"));
Thanks
Original issue reported on code.google.com by [email protected]
on 19 Jan 2011 at 2:57
No support for detecting devices for which deliveries have repeatable failed.
Original issue reported on code.google.com by sam.cavenagh
on 8 Jul 2009 at 11:08
Hello,
Using 1.6 version of javapns, the feedback service is not working and always
return 0 device
without error.
If i call the feedback service using the method in the following link, the
feedback service works
properly :
http://code.google.com/p/javapns/issues/detail?id=5&can=1
Here is a snippet of my code :
List<Device> device =
FeedbackServiceManager.getInstance().getDevices("feedback.push.apple.com",
2196,
"/ValidPath/PushCertificatsProduction.p12", "myPassword",
SSLConnectionHelper.KEYSTORE_TYPE_PKCS12);
System.out.println("device count = "+device.size());
Note that i have no problem to send notification with this p12 certificate.
Only the service
feedback is not working.
Original issue reported on code.google.com by [email protected]
on 22 Apr 2010 at 8:24
What steps will reproduce the problem?
1. I'm running this code in ActiveMatrix as a service
2. When i call the service it states that Client already exists.
3. It appears to be hanging onto the manager instance. is there a way to
destroy the instance before it tires to create it?
What is the expected output? What do you see instead?
If I run the code as a stand alone program it works fine.
What version of the product are you using? On what operating system?
Java APNS 1..5-v1.6.2
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 2:29
What steps will reproduce the problem?
While trying to initializeConnection on the PushManager, I get the following
exception:
java.io.IOException: failed to decrypt safe contents entry:
javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.net.ssl.internal.ssl.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1275)
at java.security.KeyStore.load(KeyStore.java:1150)
at javapns.back.SSLConnectionHelper.<init>(Unknown Source)
at javapns.back.PushNotificationManager.initializeConnection(Unknown Source)
The password is correct as I've verified it with openssl.
What is the expected output? What do you see instead?
I would love to see the connection initialized :)
What version of the product are you using? On what operating system?
javapns 1.6.2 jdk1.5, windows XP, trying to run it from the JUnit test at this
moment...
Original issue reported on code.google.com by [email protected]
on 14 Jan 2011 at 4:07
I'm trying to send push notifications in bulk, around 800 at a time. But none
of the push notifications are being sent.I can successfully send push for
around 100 devices at a time but not able to send to devices more than 200 at
once.
I am maintaining a persistent connection with APNS.
Did anyone face this issue before? what is the solution to this problem?
Original issue reported on code.google.com by [email protected]
on 8 Jul 2010 at 4:14
There is no way to contact you guys. How can I join this project.
Original issue reported on code.google.com by [email protected]
on 2 Jul 2009 at 5:05
What steps will reproduce the problem?
// Load the Keystore
KeyStore ks = KeyStore.getInstance(keystoreType);
ks.load(this.keyStoreStream, this.keyStorePass.toCharArray());
// Get a KeyManager and initialize it
KeyManagerFactory kmf = KeyManagerFactory.getInstance(ALGORITHM);
kmf.init(ks, this.keyStorePass.toCharArray());
// Get a TrustManagerFactory and init with KeyStore
TrustManager[] tms = new TrustManager[]{new X509TrustManager() {
public void checkClientTrusted(
java.security.cert.X509Certificate[] chain, String authType)
throws CertificateException {}
public void checkServerTrusted(
java.security.cert.X509Certificate[] chain, String authType)
throws CertificateException {}
public java.security.cert.X509Certificate[]
getAcceptedIssuers() {return null;}
}};
// Get the SSLContext to help create SSLSocketFactory
SSLContext sslc = SSLContext.getInstance(PROTOCOL);
sslc.init(kmf.getKeyManagers(), tms, null);
above code working propery
Original issue reported on code.google.com by [email protected]
on 25 Jan 2010 at 2:30
In back.SSLCOnnectionHelper, the keystoreInputStream parameter of the
constructor may be
closed no ?
code concerned :
public SSLConnectionHelper(String appleHost, int applePort, InputStream
keyStoreInputStream, String keyStorePass, String keystoreType) throws
KeyStoreException,
CertificateException, NoSuchAlgorithmException, NoSuchProviderException,
IOException {
logger.debug( "Instantiate SSLConnectionHelper with Keystore as InputStream" );
this.appleHost = appleHost;
this.applePort = applePort;
this.keyStorePass = keyStorePass;
// Load the Keystore
this.keyStore = KeyStore.getInstance(keystoreType, "BC");
this.keyStore.load( keyStoreInputStream, this.keyStorePass.toCharArray() );
}
Original issue reported on code.google.com by [email protected]
on 23 Mar 2010 at 10:50
java.io.IOException: failed to decrypt safe contents entry:
javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.net.ssl.internal.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1277)
at java.security.KeyStore.load(KeyStore.java:1185)
at javapns.back.SSLConnectionHelper.<init>(Unknown Source)
at javapns.back.PushNotificationManager.initializeConnection(Unknown Source)
at cn.knet.wlb2b.ws.PushNotification.main(PushNotification.java:44)
Caused by: javax.crypto.BadPaddingException: Given final block not properly
padded
at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
at com.sun.crypto.provider.PKCS12PBECipherCore.b(DashoA13*..)
at com.sun.crypto.provider.PKCS12PBECipherCore$PBEWithSHA1AndRC2_40.engineDoFinal(DashoA13*..)
at javax.crypto.Cipher.doFinal(DashoA13*..)
at com.sun.net.ssl.internal.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1274)
... 4 more
Original issue reported on code.google.com by [email protected]
on 24 May 2011 at 6:59
Could you make a simple method which only checks one clientToken based on
feedback please?
Frank
Original issue reported on code.google.com by [email protected]
on 27 Apr 2010 at 4:36
The repository is missing a build script. Attached is my build.xml for it.
I also recommend that you delete doc folder from the repository as it is a
generated folder and will
cause big diffs in the future.
Original issue reported on code.google.com by msaeed43
on 28 Aug 2009 at 7:50
Attachments:
It could be nice if Payload constructor allow to create empty Payload, i.e.
without aps dictionary.
Original issue reported on code.google.com by [email protected]
on 1 Jan 2011 at 5:10
What steps will reproduce the problem?
1. Executing the same code from the Java environment
2.
3.
What is the expected output? What do you see instead?
Connected to the APNS
What version of the product are you using? On what operating system?
The current version of the product on Windows XP operating system
Please provide any additional information below.
Have been receiving the following error:
java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:520)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:545)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:348)
at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:69)
at javapns.back.SSLConnectionHelper.getSSLSocket(Unknown Source)
at javapns.back.PushNotificationManager.initializeConnection(Unknown Source)
at com.homedepot.pushnotif.PushServlet.doPost(PushServlet.java:79)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at com.homedepot.ta.aa.dao.catalina.THDDAOValve.invoke(THDDAOValve.java:811)
at com.homedepot.ta.aa.catalina.realm.THDSingleSignOn.invoke(THDSingleSignOn.java:473)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:595)
Original issue reported on code.google.com by [email protected]
on 9 May 2011 at 1:37
Hello, i'm writing from Rome and my english is poor but i try to explain my
problem:
S.O Windows XP SP3
Jdk 1.6.0_20
javapns-jdk16-162.jar
I simply copy and paste your example from web and replace the token with mine.
I've enabled all log and as you can see i can send a message through ssl but on
my device nothin appears.
Thanks in advance for your help.
Original issue reported on code.google.com by [email protected]
on 5 Oct 2010 at 8:55
Attachments:
this is an enhancement request.
it would be nice if we could pool instances of PushNotificationManager...
it likely the case that sending all traffic through a single
PushNotificationManager socket would be problematic under any kind of load.
i'll be changing PushNotificationManager's constructor and extending it to
support apache commons pooling:
http://commons.apache.org/pool/
when i get that going, i'll attach a patch/src here
thanks,
john
Original issue reported on code.google.com by [email protected]
on 2 Oct 2009 at 6:52
Hi.
I am writing a programme to get feedback information from apns sandbox enviorent(feedback.sandbox.push.apple.com) with javapns. I had read articles about feedback service here and there before I start this issue . Util now, I cann't get any feedback information.
I hope anyone can give an advice in detail.
Thanks a lot.
Original issue reported on code.google.com by [email protected]
on 22 Jul 2010 at 9:50
Whether the PushNotificationManager supports to handle multiple apps. If
it is a singleton class i can have only one instance. So whenever i need
to send message, i have to open connection because my application may vary
for each message. But apple suggests that we should not open/close
connections very often.
How can i maintain multiple connections ( for multiple applications) with
pushnotificationmanager? can you please help me out on this ASAP?
Original issue reported on code.google.com by [email protected]
on 21 May 2010 at 7:18
FeedbackServiceManager.getDevices() currently take a String indicating
keypath location. However, on most servers, key is packaged as part of the
war file, so InputStream is more appropriate.
Original issue reported on code.google.com by [email protected]
on 22 Dec 2009 at 8:16
The two constructors of SSLConnectionHelper (where the keystore is given as
path and inputstream respectively) call
this.keyStore = KeyStore.getInstance(keystoreType, "BC");
and
this.keyStore = KeyStore.getInstance(keystoreType);
which makes a difference depending on what providers are installed.
Original issue reported on code.google.com by [email protected]
on 28 May 2010 at 2:28
What steps will reproduce the problem?
1.public class IphoneNotificationManager {
public static void sentMessage(NotificationDetail notificationDetail) {
PayLoad aPayload = payLoadValueOf(notificationDetail);
PushNotificationManager pushManager = PushNotificationManager
.getInstance();
// Get iPhone client
try {
pushManager.addDevice(notificationDetail.getDeviceId(),
notificationDetail.getUuid());
Device client = pushManager.getDevice(notificationDetail
.getDeviceId());
// Send message
pushManager.sendNotification(client, aPayload);
System.out.println("Message sent! " + aPayload);
System.out.println("# of attempts: "
+ pushManager.getRetryAttempts());
pushManager.removeDevice(notificationDetail.getDeviceId());
} catch (Exception e) {
System.out.println("exception : " + e);
e.printStackTrace();
}
}
public static void initializeConnection() {
PushNotificationManager pushManager = PushNotificationManager
.getInstance();
// Initialize connection
try {
pushManager.initializeConnection(ApplicationProperties.APPLE_HOST,
ApplicationProperties.APPLE_PORT,
ApplicationProperties.CERTIFICATE_FILE_PATH,
ApplicationProperties.APPLE_PWD,
SSLConnectionHelper.KEYSTORE_TYPE_PKCS12);
System.out.println("connection establishd to APNS");
} catch (Exception e) {
System.out.println("not able to initialize connection to APNS");
}
}
public static void stopConnection() {
PushNotificationManager pushManager = PushNotificationManager
.getInstance();
try {
pushManager.stopConnection();
System.out.println("connection stopped succesfully");
} catch (IOException e) {
System.out.println("not able to stop connection to APNS");
}
}
private static PayLoad payLoadValueOf(NotificationDetail notificationDetail) {
PayLoad aPayload = null;
try {
aPayload = new PayLoad();
aPayload.addAlert(notificationDetail.getMatchbetween() + " at "
+ notificationDetail.getMatchdate() + " on "
+ notificationDetail.getMatchtime());
aPayload.addSound("default");
} catch (JSONException e) {
System.out.println("Exceptio : " + e);
}
return aPayload;
}
public static void main(String args[]) {
NotificationDetail notificationDetail = new NotificationDetail();
notificationDetail
.setUuid("ebbf8c927bfd6754348fb7ccf17cbe73f2e4741fc10f08fc2316ae877867eb80");
notificationDetail.setMatchbetween("abc vs axy");
notificationDetail.setDeviceId("1");
notificationDetail.setMatchdate("today ");
notificationDetail.setMatchtime("12:30");
initializeConnection();
IphoneNotificationManager.sentMessage(notificationDetail);
stopConnection();
}
}
2. Working fine on Window 7 but not working in linux server.
What is the expected output? What do you see instead?
Getting an exception
exception : javax.net.ssl.SSLHandshakeException: Remote host closed connection
during handshake
javax.net.ssl.SSLHandshakeException: Remote host closed connection during
handshake
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:801)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1089)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:618)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
at java.io.OutputStream.write(OutputStream.java:58)
at javapns.back.PushNotificationManager.sendNotification(Unknown Source)
at com.src.IphoneNotificationManager.sentMessage(IphoneNotificationManager.java:29)
at com.src.PushJob.execute(PushJob.java:20)
at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
Caused by: java.io.EOFException: SSL peer shut down incorrectly
at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:333)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:782)
... 9 more
What version of the product are you using? On what operating system?
Using
bcprov-jdk15-145.jar
javapns-jdk1.5-v1.6.2.jar
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 14 Oct 2010 at 8:32
What steps will reproduce the problem?
The error occured when I try to initialize the ssl connection :
1. pushManager.initializeConnection(PushNotification.HOST,
PushNotification.PORT, PushNotification.CERTIFICATE, PushNotification.PASSWORD,
SSLConnectionHelper.KEYSTORE_TYPE_PKCS12);
I test also with the classical approach
2. KeyStore ks=KeyStore.getInstance("pkcs12");
3. ks.load(new FileInputStream("C:/key.pem"),"password".toCharArray());
Always I catch the same error :
java.io.IOException: toDerInputStream rejects tag type 66
at sun.security.util.DerValue.toDerInputStream(Unknown Source)
at com.sun.net.ssl.internal.pkcs12.PKCS12KeyStore.engineLoad(Unknown Source)
at java.security.KeyStore.load(Unknown Source)
I test on Windows (Eclipse) and Debian (jboss server) ...
What to do please ?
Original issue reported on code.google.com by [email protected]
on 25 Aug 2010 at 9:38
I'm running send notification in a tight loop to try and benchmark the
performance/throughput. I'm
seeing a broken pipe exception fairly often. This limits my throughput to
around 100-300
messages per second, with significant overhead in re-establishing the
connection. I've enabled
TCP keepalive, but this doesn't seem to have effected performance at all.
Original issue reported on code.google.com by [email protected]
on 1 Dec 2009 at 4:38
PushNotificationManager requires the keystore to be a file to be accessed by
FileInputStream. This
limits how the certificate is bundled with the project.
It will be nice to relax it to be accept InputStream as well. Attached is my
patch.
Also, I recommend that you make SSLConnectionHelper be a packaged scope. While
it is helpful as
an independent class to get SSLConnection, no other class in the project can
take an instance of it
as a parameter. Currently it is used as a holder to keystore types.
Original issue reported on code.google.com by msaeed43
on 28 Aug 2009 at 8:24
Attachments:
my maven build is unable to download the latest javapns-jdk16-161.jar.
javapns-1.0.jar is the version that I can download using maven.
Thanks
Original issue reported on code.google.com by [email protected]
on 15 Jul 2010 at 8:00
Hi guys,
when I try to run the code closely modeled after the sample use code snippet
that's posted on the wiki I get the following error:
java.lang.NoClassDefFoundError: org.bouncycastle.jce.provider.WrapCipherSpi
It sounds like I'm not linking the bouncy house library properly, but I'm not
very sure what I'm doing wrong. Anyone have any idea what I'm doing wrong. The
code is posted below.
Thank you.
vova
import javapns.back.PushNotificationManager;
import javapns.data.PayLoad;
import javapns.data.Device;
import javapns.back.SSLConnectionHelper;
class send_apns{
// APN Server Host & Port
private static final String HOST = "gateway.sandbox.push.apple.com";
private static final int PORT = 2195;
// Badge
private static final int BADGE = 66;
// iPhone's UDID (64-char device token)
private static String iPhoneId = "22017e6cad7..........4097b6d";
private static String certificate = "/root/cgi/APNS/push_certificate.p12";
private static String passwd = "*****";
public static void main(String []args){
try{
// set up a simple payload
PayLoad aPayload = new PayLoad();
aPayload.addBadge(BADGE);
System.out.println("Payload setup successfull.");
System.out.println(aPayload);
// get PushNotification Instance
PushNotificationManager pushManager = PushNotificationManager.getInstance();
// Link iPhone's UDID (64-char device token) to a stringName
pushManager.addDevice("iPhone", iPhoneId);
System.out.println("iPhone UDID taken.");
System.out.println("Token: " + pushManager.getDevice("iPhone").getToken());
// Get iPhone client
Device client = pushManager.getDevice("iPhone");
System.out.println("Client setup successfull.");
// Initialize connection pushManager.initializeConnection(HOST, PORT, certificate, passwd, SSLConnectionHelper.KEYSTORE_TYPE_PKCS12); pushManager.sendNotification(client, aPayload);
System.out.println("Message sent!");
System.out.println("# of attempts: " + pushManager.getRetryAttempts());
pushManager.stopConnection();
System.out.println("done");
}
catch(Exception e){
e.printStackTrace();
}
}
}
Original issue reported on code.google.com by [email protected]
on 12 Mar 2011 at 10:30
pushManager.initializeConnection("gateway.sandbox.push.apple.com", 2195,
certificatePath, certificatePassword, SSLConnectionHelper.KEYSTORE_TYPE_PKCS12);
when these code run, java.net.SocketEcetption happened.
until oct. these code wort well. but recently make an error
why????
Original issue reported on code.google.com by [email protected]
on 4 Oct 2010 at 9:52
I've found a problem- when my script is running (and keeping connection with
apns server) for a several hours without sending any notification, when I do
first sendNotification - it says "Attempt failed... trying
again" (PushNotificationManager.java line 152), and then send notification
(second attempt). But problem is what this notification DO NOT get to
device. Second and others- all ok.
Original issue reported on code.google.com by [email protected]
on 19 May 2010 at 9:04
What steps will reproduce the problem?
1. Execute sendEvents with pushManager initialized with "" or null as the
password
2. You get:
- for "" - java.io.IOException: failed to decrypt safe contents entry:
java.lang.ArithmeticException: / by zero
- for null - java.lang.NullPointerException
at javapns.back.SSLConnectionHelper.<init>(Unknown Source)
What is the expected output? What do you see instead?
I hope to connect to APNS with a certificate that has no password.
What version of the product are you using? On what operating system?
v1.6.2 JDK 1.5, Windows XP
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 7 Jan 2011 at 3:03
What steps will reproduce the problem?
1. I am trying to add javapns jar file in my maven based project.
2. but, Maven is not able to find out this jar.
What version of the product are you using? On what operating system?
I am using Eclipse and M2_ plugin.
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 9 Dec 2010 at 11:30
What steps will reproduce the problem?
1. Start Glassfish v3 server
2. Glassfish server is running a timed service via JBoss SEAM
3. FeedbackService is invoked and tries to call out to Apple.
What is the expected output? What do you see instead?
Expect the FeedbackServiceManager to fetch devices list from Apple but get an
exception instead.
What version of the product are you using? On what operating system?
JDK 6 API 1.6.3
Please provide any additional information below.
When the FeedbackServiceManager is trying to get devices, an exception is
thrown.
This is running in Glassfish v3 on a Mac running OS X Snow Leopard.
Getting this exception:
Caused by: java.lang.ExceptionInInitializerError
at javapns.back.FeedbackServiceManager.getDevices(Unknown Source)
at me.loyal2.service.apns.FeedbackService.refreshIphones(FeedbackService.java:74)
... 53 more
Caused by: java.lang.NullPointerException
at sun.security.jca.ProviderList.getIndex(ProviderList.java:246)
at sun.security.jca.ProviderList.getProviderConfig(ProviderList.java:229)
at sun.security.jca.ProviderList.getProvider(ProviderList.java:235)
at sun.security.jca.ProviderList.insertAt(ProviderList.java:79)
at java.security.Security.insertProviderAt(Security.java:326)
at java.security.Security.addProvider(Security.java:372)
at javapns.back.SSLConnectionHelper.<clinit>(Unknown Source)
... 55 more
Original issue reported on code.google.com by [email protected]
on 23 Dec 2010 at 3:12
If I use this code on a Mac, it works fine. But, if my server is running on a
linux environment, it throws a null pointer exception the first time I try to
send the message:
java.lang.NullPointerException
at javapns.back.PushNotificationManager.sendNotification(Unknown Source)
After I get this exception, if I try to send a message again, I get the
following error:
javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error:
java.security.InvalidAlgorithmParameterException: the trustAnchors parameter
must be non-empty
at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1611)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1574)
at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1557)
at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1483)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:83)
at java.io.OutputStream.write(OutputStream.java:75)
at javapns.back.PushNotificationManager.sendNotification(Unknown Source)
Any pointers? Do I need to convert the certificate from the P12 format to some
other format in linux?
Thanks,
Gautam
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 9:49
Hello,
My question is simple, is FeedbackServiceManager class working ?
I use PushNotificationManager class to send my notifications and it works
great, but if i try to
read data from the apple feedback server, the server send me back :
Exception in thread "main" javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: No trusted certificate found
The cercificate seems to be good because i can send my notifications with it...
Here is a snippet of the code :
LinkedList<Device> liste =
FeedbackServiceManager.getInstance().getDevices("feedback.sandbox.push.apple.com
", 2196,
"PushCertificats.p12", "myPassword", SSLConnectionHelper.KEYSTORE_TYPE_PKCS12);
for(int i=0; i<liste.size(); i++) {
System.out.println(liste.get(i).getToken()+" "+liste.get(i).getLastRegister());
}
Original issue reported on code.google.com by [email protected]
on 14 Aug 2009 at 2:16
The APNS allows custom data to be delivered to the client app as part of
the notification. The PayLoad class currently doesn't provide a way to
specify a payload.
Original issue reported on code.google.com by sam.cavenagh
on 8 Jul 2009 at 11:14
I keep getting this error when ever i send notifications in a loop. It sends
notifications for few devices in the beginning and shows this error later for
the rest.
java.io.IOException: DerInputStream.getLength(): lengthTag=127, too big.
Thanks,
Sudheer
Original issue reported on code.google.com by [email protected]
on 12 Jul 2010 at 6:19
Because J2EE applications do not allow normal file access I need the keystore
to be retrieved from
my resources. To do this I have made some changes to the SSLConnectionHelper
and
PushNotificationManager to accept InputStream's. Are you interested in these
changes?
Original issue reported on code.google.com by robin%[email protected]
on 27 Nov 2009 at 10:28
What steps will reproduce the problem?
1.
2.
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 26 Jan 2011 at 6:42
I modified the code to send enhanced nofitication. As part of testing, I
intentionally omitted device token in the raw packet, but still i did not
receive any error packet back. I am using gateway.push.apple.com:2195.
Any thoughts and suggestions?
Many thanks.
Weiping
Original issue reported on code.google.com by [email protected]
on 15 Apr 2011 at 7:54
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.