mwkirk / javapns

Test import of svn javapns repo from Google Code
3 stars 0 forks source link

Issue in bundling the certificate with war file. #135

Closed mwkirk closed 11 years ago

mwkirk commented 11 years ago

Original author: hirant...@gmail.com (July 13, 2012 19:12:59)

Hi,

I have developed a stand alone app to push notifications and it is working fine without any issue. Now, I am in a process of converting the same into a RESTFul web service. I have configured the relative path to the certificate to access the same in the web context, but the API(KeystoreManager.validateKeystoreParameter) always throws the file not find exception. The configuration was done to get the file from /resources/certificate.p12 path but it searches in D:\resource\certificate.p12 path. Always it concatenates the path with the drive. The exception is javapns.communication.exceptions.InvalidKeystoreReferenceException: Invalid keystore reference. File does not exist: D:\resource\CIGMobiSuite_PROD.p12

Can you please help me to resolve this issue?

Original issue: http://code.google.com/p/javapns/issues/detail?id=135

mwkirk commented 11 years ago

From hirant...@gmail.com on July 13, 2012 19:19:22 Please note that the certificate is bundled correctly and even I change the location of the resources directory inside the web context it throws the same exception.

mwkirk commented 11 years ago

From sype...@gmail.com on July 13, 2012 19:31:28 Since the library uses java.io.File (and not URL) when trying to load your keystore, I would expect the result you described.

I would suggest getting yourself an InputStream to your keystore first, then invoke JavaPNS with the InputStream instead of the path. If you provide a stream, it will obviously avoid any possibility of having file location issues..

mwkirk commented 11 years ago

From sype...@gmail.com on July 17, 2012 18:37:04 Closing issue because poster's code made false assumptions regarding java.io.File behaviour in the context of a WAR bundle (unrelated to JavaPNS). Solution provided.