1

I want to send Push notification using Coldfusion. I couldn't find much help on google. I could find only one article that discusses this topic. But unfortunately I am getting exceptions while following that method. As that method uses a JAR file, I am not able to debug the exception. Even I cannot see the exceptions.

I just want to know is there a simple way to send Push Notifications? Like there is one for Android. In Android you just have to send an http request and you're done. But I can see things are so complicated in case of Apple.

But I am sure that someone would have definitely achieved this. Can anyone please help me on this?

Finally from suggestions, I implemented onError in my Application.cfc and got the following error:

Could not initialize class com.rsa.jcm.c.br
ava.lang.NoClassDefFoundError: Could not initialize class com.rsa.jcm.c.br at
com.rsa.jcm.c.ch.g(Unknown Source) at com.rsa.jcm.c.ch.h(Unknown Source) at
com.rsa.jcm.c.ch.f(Unknown Source) at com.rsa.jcm.c.jt.newSymmetricCipher(Unknown Source) at
com.rsa.cryptoj.o.mu.newSymmetricCipher(Unknown Source) at com.rsa.cryptoj.o.an.d(Unknown Source) at com.rsa.cryptoj.o.li.<init>(Unknown Source) at com.rsa.cryptoj.o.hh.<init>(Unknown Source) at com.rsa.cryptoj.o.gu.<init>(Unknown Source) at com.rsa.cryptoj.o.cc$240.a(Unknown Source) at com.rsa.cryptoj.o.da.a(Unknown Source) at com.rsa.cryptoj.o.da.a(Unknown Source) at
com.rsa.cryptoj.o.gx.b(Unknown Source) at com.rsa.cryptoj.o.gx.a(Unknown Source) at
com.rsa.cryptoj.o.gx.a(Unknown Source) at com.rsa.cryptoj.o.gx.a(Unknown Source) at
com.rsa.cryptoj.o.gx.a(Unknown Source) at com.rsa.cryptoj.o.gx.engineLoad(Unknown Source) at java.security.KeyStore.load(KeyStore.java:1185) at
com.notnoop.apns.internal.Utilities.newSSLContext(Utilities.java:87) at
com.notnoop.apns.ApnsServiceBuilder.withCert(ApnsServiceBuilder.java:139) at
com.notnoop.apns.ApnsServiceBuilder.withCert(ApnsServiceBuilder.java:114) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at
java.lang.reflect.Method.invoke(Method.java:597) at
coldfusion.runtime.StructBean.invoke(StructBean.java:508) at
coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2465) at

Edit:

CF Code:

<cfset APNSService = createObject( "java", "com.notnoop.apns.APNS" ).newService()
    .withCert("E:\WEB\mysite.com\login\JAR\DevPushCertificates.p12", "")
    .withSandboxDestination()
    .build() />

<!--- I get the exception here and the code bellow is not executed --->        

<cfset payload = createObject( "java", "com.notnoop.apns.APNS" ).newPayload()
    .badge(3)
    .alertBody("Hello, world.")
    .sound("PushNotification.caf")
    .build()/>

<cfset APNSService.push('#deviceToken#', payload) />

I am using this JAR file: https://github.com/notnoop/java-apns/downloads

I got it from this blog: http://www.raymondcamden.com/index.cfm/2010/9/13/Guest-Post-Apple-Push-Notifications-From-ColdFusion-in-Ten-Minutes-or-Less#c843ED990-C791-2A3E-1E9FD9B78ECADFF7

4

2 回答 2

1

如果您在多个位置发布该问题,请添加指向其他问题副本的链接。

在 github 上查看我对您的 java-apns 问题的回答。

(更新了来自链接的响应)

这看起来像是 ColdFusion 的问题。在上面的堆栈转储中,您会看到:

    com.notnoop.apns.internal.Utilities.newSSLContext(Utilities.java:87)

调用

    java.security.KeyStore.load(KeyStore.java:1185)

com.rsa.cryptoj 在图书馆经过一番思考后,这又失败了。所以很明显,有些东西在访问 ColdFusion 中的 java 密钥库时是行不通的。

谷歌搜索错误中的一个类会产生一些有趣的结果:

于 2013-04-11T09:58:40.003 回答
0

因为我的服务器在共享主机上。因此,对于每一次更改,我都必须向托管站点提交一张票。它引起了头痛。最后,我让 php 服务器设置将推送通知代码(在 google 上的 PHP 中很容易获得)放在 PHP 服务器上。然后我从 Coldfusion 代码中调用了那个 php 文件。这对我有用。

于 2013-05-09T14:12:56.127 回答