I am using java-apns in my push notification server. The process is run as an Apache Commons daemon using jsvc. I have a thread that runs every 'N' seconds and checks for new notifications. If it finds any it attempts to send them out. From the stack trace below, the error happens on line 80 of my NotificationManager class. The code I have on that line is:
Exception in thread "Timer-0" java.lang.VerifyError: Cannot inherit from final class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at com.notnoop.apns.PayloadBuilder.<clinit>(PayloadBuilder.java:47)
at ca.site.mobile.apns.service.NotificationManager.sendNotification(NotificationManager.java:80)
at ca.site.mobile.apns.service.NotificationManager.purgeNotifications(NotificationManager.java:64)
at ca.site.mobile.apns.service.NotificationChecker$1.checkForNotifications(NotificationChecker.java:46)
at ca.site.mobile.apns.service.NotificationChecker$1.run(NotificationChecker.java:41)
at ca.site.mobile.apns.scheduling.Scheduler$SchedulerTimerTask.run(Scheduler.java:18)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
I've tried this on both Mac OSX and Linux running Java 1.6 with the same result. I am able to run that same line of code in a standalone java application (not using jsvc) without error but when run from within the daemon I get that error. I think it might have to do with running this as part of a daemon. Any ideas?
Thanks.
I assume that you are having a dependency version conflict for the Jackson API, when running with jsvc. However, jsvc seems not to require any dependencies beyond junit.
I am using java-apns in my push notification server. The process is run as an Apache Commons daemon using jsvc. I have a thread that runs every 'N' seconds and checks for new notifications. If it finds any it attempts to send them out. From the stack trace below, the error happens on line 80 of my NotificationManager class. The code I have on that line is:
And this raises the exception below:
I've tried this on both Mac OSX and Linux running Java 1.6 with the same result. I am able to run that same line of code in a standalone java application (not using jsvc) without error but when run from within the daemon I get that error. I think it might have to do with running this as part of a daemon. Any ideas? Thanks.