I'm building an application to send push notifications to Apple devices from ColdFusion 8 using notnoop's java-apns library, and when calling a method in the library, I'm receiving "method not found" exception, even though the method is clearly defined in the library (line 161). I am able to send push notifications successfully, just this one method is not working. What is possibly wrong here???
Code:
<cfscript>
LOCAL.APNSService =
CreateObject("java", "com.notnoop.apns.APNS").newService()
.withCert(
"MyCert.p12",
"MyPassword"
)
.withProductionDestination()
.build();
LOCAL.APNSService.start();
LOCAL.InactiveDevices = LOCAL.APNSService.getInactiveDevices();
LOCAL.payload =
CreateObject("java", "com.notnoop.apns.APNS").newPayload()
.badge(1)
.alertBody("Hello, world.")
.sound("PushNotification.caf")
.build();
LOCAL.APNSNotification =
CreateObject("java", "com.notnoop.apns.SimpleApnsNotification")
.init(
JavaCast("string", LOCAL.MyDeviceToken),
JavaCast("string", LOCAL.payload)
);
LOCAL.APNSService.push(LOCAL.APNSNotification);
LOCAL.APNSService.stop();
</cfscript>
Exception:
The getInactiveDevices method was not found.
Stack Trace:
coldfusion.runtime.java.MethodSelectionException: The getInactiveDevices method was not found.
at coldfusion.runtime.java.ObjectHandler.findMethodUsingCFMLRules(ObjectHandler.java:322)
at coldfusion.runtime.StructBean.invoke(StructBean.java:527)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2300)
\lib
directory. Does it include a version of the slf4j jar? If yes, that could be the problem. Use a zip tool to open the apns jar and remove the entireorg.slf4j.*
package. Then restart CF.createObject("java", "org.slf4j.LoggerFactory")
. If it throws a class not found error, then you are right.<cfset LOCAL.Object = createObject("java", "org.slf4j.LoggerFactory") />
does not throw an error.LOCAL.APNSService
and verified the method is there? Is there anything else listed in the stack trace OR CF error logs? Sometimes the cause is further down in the chained message.