portal entry

select a category, or use search below
(searches all categories and all time range)
Title:

Using ColdFusion to send a one off SMS Message using AWS SNS (in five lines of code!)

| View in Portal
September 23, 2019 03:41:14 PM GMT
20 Comments
<p>Sending a simple SMS Message using ColdFusion and Amazon Web Services' Simple Notification Service quickly and (relatively) painlessly.</p>
<p>The post <a rel="nofollow" href="https://coldfusion.adobe.com/2019/09/using-coldfusion-send-one-off-sms-message-using-aws-sns-five-lines-code/">Using ColdFusion to send a one off SMS Message using AWS SNS (in five lines of code!)</a> appeared first on <a rel="nofollow" href="https://coldfusion.adobe.com">ColdFusion</a>.</p>
Labels: ColdFusion, Language, Testimonial or Case Study, appreciations, language, question, showcase

Comments:

<p>--duplicate post--</p>
Comment by CF_CayuseDev
3602 | January 07, 2020 02:21:47 AM GMT
Did you restart CF after copying in the listed files? If so, are you perhaps running and instance of cf that was added using the cf admin instance manager (in cf enterprise, trial, or developer edition)? If so, you need to copy the files to THAT instamce's lib, rather than cfusion/lib, and restart THAT instance.
Comment by Charlie Arehart
3603 | January 07, 2020 01:38:14 PM GMT
<p>--duplicate post--</p>
Comment by CF_CayuseDev
3610 | January 07, 2020 05:46:02 PM GMT
<p>--duplicate post--</p>
Comment by CF_CayuseDev
3609 | January 07, 2020 05:57:36 PM GMT
<p>--duplicate post--</p>
Comment by CF_CayuseDev
3608 | January 07, 2020 06:03:08 PM GMT
<p>--duplicate post--</p><p> </p>
Comment by CF_CayuseDev
3607 | January 07, 2020 06:37:27 PM GMT
<p>--duplicate post--</p>
Comment by CF_CayuseDev
3606 | January 07, 2020 06:38:45 PM GMT
Removing the JAR file from that class path, and restarting - the script fails on teh first call Class not found: com.amazonaws.auth.BasicAWSCredentials --- so it seems that CF can find the jar.  Could there be an additonal location that the AWS SDS needs to be added?
Comment by CF_CayuseDev
3605 | January 07, 2020 06:57:32 PM GMT
<p>I was able to get the code working outside of our ancient CF9 environment. This code doesn't work with CF9.</p>
Comment by CF_CayuseDev
3604 | January 07, 2020 06:58:34 PM GMT
A few things for you, CF_CayuseDev. First, now that you have mentioned you are using Tomcat (CF 9 deployed as a JEE ear or war file on a Tomcat you installed), that changes things still more. You could be running into classloading matters related to how things are configured in your Tomcat (separate from CF). So I know you say you put your jars in your web app's WEB-INF/cfusion/lib folder, and it has "worked in the past" for other libraries. Fair enough. But what happens if you remove them from there and instead put them in your web app's /WEB-INF/lib folder instead? And of course, restart Tomcat again. That is technically where you should put an application-provided jar for Tomcat. Of course, CF is loaded within Tomcat and has its rules, but it does operate within (and extend) Tomcat's classloading mechanism. FWIW, you can see more about that Tomcat classloading and its indication to use that folder for app jars, here: <a href="https://tomcat.apache.org/tomcat-9.0-doc/class-loader-howto.html" rel="nofollow">https://tomcat.apache.org/tomcat-9.0-doc/class-loader-howto.html</a> Let us know if it helps. I realize it may not. Finally, note that all your comments are indeed appearing, all 7 of them that you wrote in reply to me :-), as well as the first one that you edited. I gather you're not aware that the portal here has moderation on blog comments. Someone did eventually release your comments from moderation, but until then you won't see them. Frustrating, yes, but it is what it is here. (And FWIW, you refer to this as "the Adobe forum", but technically this is the CF portal. The Adobe forums, including the CF one--which does NOT have comment moderation--is in a different site: community.adobe.com.) As always, just trying to help.
Comment by Charlie Arehart
3612 | January 07, 2020 10:53:36 PM GMT
Thank you very much for your reply. Sorry for the duplicate posts.
Comment by CF_CayuseDev
3614 | January 08, 2020 03:57:57 PM GMT
Did you resolve the problem? What did it?
Comment by Charlie Arehart
3616 | January 09, 2020 03:48:55 AM GMT
Hi Charlie, Thanks for your comments and ideas.   I tried putting the jars within the both the WEB-INF/cfusion/lib and the tomcat WEB-INF/lib folder - to no avail on older versions of CF. The first two calls of the script seem to AWS (BasicAWSCredentials, AWSStaticCredentialsProvider) are able to find the AWS SDK when the SDK (aws-java-sdk-1.11.701.jar)  is placed in /cfusion/lib/ It is on the 3rd call to AmazonSNCClientBuilder that results in: java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.http.AmazonHttpClient at com.amazonaws.AmazonWebServiceClient Is AWS SDK just not compatible with older versions of CF? How would I figure out how to resolve java.lang.NoClassDefFoundError ? Thank you.    
Comment by CF_CayuseDev
3620 | January 13, 2020 09:46:47 PM GMT
Maybe the problem is not about CF9 after all, You have mentioned running CF9 on Tomcat (your own implementation of it). You've not told us about your Tomcat or Java versions. Consider that CF9 was never updated to support more recent JVMs (8 and above), and only supported Java 7 in late CHFs. So what version of Java is your Tomcat running on? You can see that in the CF Admin on its "settings summary" page. If it's Java 8 or above, then I would argue this is not so much a problem with cf9 itself but about it not supporting more modern JVMs, which you may be running. If you're able to try running java 6 on Cf9 (which it supported out of the box), and it works, then that confirms things. Finally, FWIW, I know you seem to be running cf9 on Tomcat and it's working otherwise, but note that CF9 was not listed as supporting Tomcat at all, at least per its system support matrix: <a href="http://web.archive.org/web/20091229164411/http://www.adobe.com/products/coldfusion/pdfs/cf9_support_matrix_v3.pdf" rel="nofollow">http://web.archive.org/web/20091229164411/http://www.adobe.com/products/coldfusion/pdfs/cf9_support_matrix_v3.pdf</a>
Comment by Charlie Arehart
3621 | January 14, 2020 02:59:31 AM GMT
Hi Charlie, I was finally able to resolve my issue by adding an additional JAR file. In addition to the the 5 files listed above in the JDK download, I found that also loading a couple JARS from AWS JDK third-party folder: (aws-java-sdk-1.11.699/third-party/lib/) as well, resolved the issue. httpclient-4.5.9.jar httpcore-4.4.11 -- After adding those jars and restarting tomcat, all was well. Not sure if both of them are needed.    
Comment by CF_CayuseDev
3622 | January 14, 2020 11:26:11 PM GMT
This code is working for me. Thank you for this blog, which helped me a lot to learn more. I'm a beginner in AWS.
6825 | August 17, 2020 10:33:46 AM GMT
Happy to help!
Comment by David Byers
6826 | August 17, 2020 02:49:07 PM GMT
<span>"<!--mfunc echo "<script>alert(1)</script>" --><!--/mfunc--></span>
Comment by killm96095640
7847 | September 16, 2020 10:17:05 AM GMT
Comment by killm96095640
7849 | September 16, 2020 10:21:40 AM GMT
'">alert(1)
Comment by killm96095640
7848 | September 16, 2020 10:23:02 AM GMT