sshcheung / javapns

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

SSLConnectionHelper NullPointerException using FeedbackServiceManager #36

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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 gregpear...@gmail.com on 23 Dec 2010 at 3:12

GoogleCodeExporter commented 8 years ago
In log4j enable debugging, this should give more info...
as per: 
http://code.google.com/p/javapns/wiki/Tips

Does it work with the test code:
http://code.google.com/p/javapns/wiki/WorkingFeedbackExample

How are you passing your certificate to the feedbackManager?

Original comment by idbill.p...@gmail.com on 25 Dec 2010 at 12:20

GoogleCodeExporter commented 8 years ago
I have enabled the log4j debugging and I have set the JVM argument as well.

Yes, the WorkingFeedbackExample works for me. I am passing certificate to the 
to feedback manager the same way as the WorkingFeedbackExample.

Here is the debug line from log4j just before the exception:

[#|2010-12-26T16:04:00.022-0700|INFO|oracle-glassfish3.0.1|javax.enterprise.syst
em.std.com.sun.enterprise.v3.services.impl|_ThreadID=29;_ThreadName=Thread-1;|16
:04:00,022 DefaultQuartzScheduler_Worker-1 DEBUG 
[javapns.back.FeedbackServiceManager] Retrieving Devices from Host: 
[feedback.push.apple.com] Port: [2196] with KeyStorePath 
[/Users/gregpearman/Documents/LiquidMedia/MobileDev/Keys/PushCertificate.p12]/[P
KCS12]
|#]

I have also verified that the password is being passed and it is the correct 
value.

The second time the feedback manager is called (I'm using the JBoss SEAM Quartz 
integration to schedule the feedback callout), I get this error:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class 
javapns.back.SSLConnectionHelper
    at javapns.back.FeedbackServiceManager.getDevices(Unknown Source)
    at me.loyal2.service.apns.FeedbackService.refreshIphones(FeedbackService.java:84)
    ... 53 more

I'm still not seeing what the issue is.

Original comment by gregpear...@gmail.com on 26 Dec 2010 at 11:21

GoogleCodeExporter commented 8 years ago
You say 'the second time the feedback manager is called'... so this runs fine 
the first time.. but not the 2nd+ time?

I wonder if there is an issue where the scheduler is trying to re-use the 
SSLConnectionHelper at which point the connection has dropped.

But it sounds like the issue has to do with the way the scheduler is calling 
the feedback function.

Original comment by idbill.p...@gmail.com on 27 Dec 2010 at 8:24

GoogleCodeExporter commented 8 years ago
Actual. No, It fails all the time. It's just that the first time, it get the 
original NullPointerException and the second time it get's the 
NoClassDefFoundError.

Original comment by gregpear...@gmail.com on 27 Dec 2010 at 4:35

GoogleCodeExporter commented 8 years ago
Please send more of the debugging output

Original comment by idbill.p...@gmail.com on 27 Dec 2010 at 5:30

GoogleCodeExporter commented 8 years ago
Attached is the section of the log files for where the feedback service is 
being invoked. Please let me know what else I can send to help with this issue.

Original comment by gregpear...@gmail.com on 27 Dec 2010 at 6:43

Attachments:

GoogleCodeExporter commented 8 years ago
As per:
http://stackoverflow.com/questions/899057/hibernate-in-glassfish-ejb3configurati
on-noclassdeffounderror

The error would seem to indicate the JVM was unable to load the class. I 
vaguely recall that Glassfish using BouncyCastle...
and I wonder if there is a conflict.

Interesting... tip:
http://bouncy-castle.1462172.n4.nabble.com/Unstable-BouncyCastle-Library-when-de
ployed-in-Glassfish-server-td2312292.html

Original comment by idbill.p...@gmail.com on 27 Dec 2010 at 11:18

GoogleCodeExporter commented 8 years ago
Thank you for those links. I will investigate and see if any of the suggestions 
in them help resolve this issue and let you know.

Original comment by gregpear...@gmail.com on 28 Dec 2010 at 8:40

GoogleCodeExporter commented 8 years ago
Greg, were you able to solve the issue?

Original comment by sype...@gmail.com on 7 Sep 2011 at 1:15

GoogleCodeExporter commented 8 years ago
Closing issue as no feedback was received since issue was reported.  
Please feel free to re-open if the issue is still valid.

Original comment by sype...@gmail.com on 14 Sep 2011 at 3:55