hengsokchamroeun / javapns

Automatically exported from code.google.com/p/javapns
0 stars 0 forks source link

Issue in bundling the certificate with war file. #135

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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 reported on code.google.com by hirant...@gmail.com on 13 Jul 2012 at 7:12

GoogleCodeExporter commented 8 years ago
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.

Original comment by hirant...@gmail.com on 13 Jul 2012 at 7:19

GoogleCodeExporter commented 8 years ago
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..

Original comment by sype...@gmail.com on 13 Jul 2012 at 7:31

GoogleCodeExporter commented 8 years ago
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.

Original comment by sype...@gmail.com on 17 Jul 2012 at 6:37