Dordrecht
Participant
Dordrecht
Participant
Activity
‎Mar 10, 2025
12:46 PM
@BKBK I have finished implementing your GraalJS solution, which you so helpfully and generously worked out and supplied, in a development environment for evaluation by the decision-makers. I was able to get the same results with GraalJS that were being delivered by Nashorn in a number of side-to-side tests. More testing will be needed, of course. Thank you once again!
... View more
‎Mar 03, 2025
01:29 PM
1 Upvote
@BKBK , I have started to go thorugh your solution. In step 4, immediately after running mvn dependency:copy-dependencies, I get the error "The JAVA_HOME environment variable is not defined correctly, this environment variable is needeed to run this program." I defined a new JAVA_HOME environment variable with value of C:\ColdFusion2023\jre and added %JAVA_HOME%\bin to the path. After doing this and then closing and reopening the command window, I was able to generate the necessary files. Subsequently I was able to follow the other instructions and get the square root example to work. I'm planning on working more on this in the coming days, and I'll report on how it is going. Thanks again!
... View more
‎Feb 26, 2025
07:24 AM
Thank you, @Charlie Arehart! I followed the steps you mentioned to check the version and it is indeed 2.20.0.
... View more
‎Feb 26, 2025
06:38 AM
@BKBK, I'm sorry for the delay in responding. Work has been extremely busy. I haven't been able to dive into what you have replied with above, but it looks amazing! I very much appreciate your significant efforts in providing assistance on this! I hope to be able to scan more through what you have written this week, and hopefully do a deeper dive next week. (The urgent for this scripting engine alternative has recently been somewhat lessened - for now at least - but it is still very important, and my interest in digging in ASAP. Thank you!
... View more
‎Feb 21, 2025
10:27 AM
The test server installation went perfectly, @Charlie Arehart, and I cleared the felix-cache. Sometime next week we do the same on two production servers. Hopefully they will go smoothly as well. Thanks again!
... View more
‎Feb 21, 2025
05:22 AM
Thank you, @Charlie Arehart. I did not run all of the updates. I ran Update 11 and 13, then proceeded to 18, because at one point we found that we couldn't get update 13 to install without running 11 first, so I did what we did historically, having started from scratch I was aware of that technote for upddate 17, but had not noticed any issues loading the PDF Services page in ColdFusion Administrator (if I even tried it). The error I posted above was, to my knowledge, from the log of the installation, not generated by trying to access the admin page, so the technote seemed unrelated. I'll be updating to update 18 on a different test server today, and will keep these things in mind. Thanks again!
... View more
‎Feb 20, 2025
09:03 AM
@Charlie Arehart , thank you for the reply. I went ahead and uninstalled CF altogether, then reinstalled CF2021 up to hotfix 18 yesterday morning. I used the admin to install the updates rather than using comand line. (I seem to have had better results dong it that way in the past.) Every install seemingly worked without any errors, and I joked to my supervisor that it seemed like a day I should purchase a lottery ticket. 🙂 My plan was to examine the logs for install errors more today, whcih I did. The only error I saw from yesterday's installs was: ----- Feb 19, 2025 10:37:46 AM Information [main] - Package htmltopdf started... Feb 19, 2025 10:37:46 AM Error [main] - Unable to install htmltopdf package: java.lang.NullPointerException: Specified service reference cannot be null. ----- Oddly, I see in the admin when I click the htmltopdf package that it is installed, so I'm not sure what happened there: I examined all of our code and we don't have any uses of cfhtmltopdf, so I expect that error will have no effect on us even if not installed. Thank you again for your assistance!
... View more
‎Feb 18, 2025
10:26 AM
1 Upvote
Thank you, @BKBK! I really appreciate your assistance. To make the coding needs clearer using some altered examples, the Nashorn interaction with the javascript engine in my code is not extensive. Once the engine is made available for CF to use, there is a block of hard-coded JavaScript brought in (mostly Javacript functions): <cfset local.engine.eval(local.scriptBody)> Next, some dynamically derived JSON data is made available to the engine. (JSON below is defined in scriptBody): <cfsavecontent variable="local.jsData">
<cfoutput>
var myFirstData = JSON.parse('#JSStringFormat(SerializeJSON(local.firstData))#');
var mySecondData = JSON.parse('#JSStringFormat(SerializeJSON(local.secondData))#');
</cfoutput>
</cfsavecontent>
<cfset local.engine.eval(local.jsData) /> Next, more JavaScript is eval'd. (myFunction is defined in scriptBody): <cfsavecontent variable="local.jsRunStuff">
var myResults;
myResults = myFunction(myFirstData, mySecondData);
</cfsavecontent>
<cfset local.engine.eval(local.jsRunStuff) /> And last, an invocation is executed with a value returned to CF: <cfset local.myResults = DeSerializeJSON(local.engine.invokeFunction('getmyResultsAsJSON', [])) />
So, I think the only thing I'd need Graal to do is equivalents of eval and invokeFunction methods. (I'm not quite sure at thie time what each of those methods do.) Hopefully everything else would just be handled by Graal.
... View more
‎Feb 18, 2025
05:46 AM
Thanks, @Charlie Arehart Referencing your #2: I did both the install and the uninstall from the CF Admin. The install and uninstall logs show no errors: ----- Installation: Successful. 1659 Successes 0 Warnings 0 NonFatalErrors 0 FatalErrors ----- Uninstallation: Successful null 1481 Successes 1 Warnings 0 NonFatalErrors 0 FatalErrors ----- I'm not sure what is meant by "If the former, was CF running as a service with localsystem as the user running the service?" In Services, the Cf Application Server shows "Local System" in the Log On As column value. #3: The server.log shows the following errors around the time I did the install/uninstall. I'm not sure which of those caused the errors. Possibly I had the lib dir open in file explorer during the installation? "Registration error for service manager : .http://127.0.0.1:8993/PDFgServlet/.Reason: SERVER ERROR" "Unable to install SQL package: coldfusion.server.ServiceRuntimeException: java.io.FileNotFoundException: (CF_Home redacted)\lib\neo-drivers.xml (The requested operation cannot be performed on a file with a user-mapped section open)" "Unable to install htmltopdf package: java.lang.NullPointerException: Specified service reference cannot be null." #4 I did the suyggested folder operations. They did not fix the issue.
... View more
‎Feb 17, 2025
01:31 PM
After I upgraded to update 18 on CF2021, I find that many of the administrator pages display errors like those below. I backed out the upgrade back to CF2021 Update 13 and the errors persist. The errors did not occur prior to the upgrade attempt. Anyone kno0w a solution? (P.S. Sorry to be asking so many questions lately. I've been a ColdFusion user for 25 years and am much better at programming than debugging software versioning and installation issues.)
... View more
‎Feb 17, 2025
11:29 AM
Hi, all. I recently asked about Log4j vulnerabilities in CF2023, and learned that there are not any known at this time. Now, I need to ask whether CF2021, Update 18 has any Log4j vulnerabilities. The main reason I ask is because I have CF2021 Update 13 installed locally, and when I match the files that @Charlie Arehart mentioned in one of his linked articles, I find that of the files he indicates should exist in (CF_Home)/lib folder prior to file replacement with 2.17.1 versions: log4j-core-2.16.0.jar log4j-api-2.16.0.jar log4j-to-slf4j-2.16.0.jar My directory has only these unversioned files (with no corresponding file for log4j-to-slf4j) log4j-core.jar log4j-api.jar Possibly the files I have are version 2.16.0, although not named as such? I'm not sure how to check the versions programmatically, and I don't see that the installed Log4j versions are listed anywhere in the CF Admin. In a nutshell, will updating to CF2021 Update 18 remove all known Log4j vulnerabilities, or would further fixes still be necessary? Thank you!
... View more
‎Feb 14, 2025
07:24 AM
For GraalVM, I dropped the following files into my cf lib folder as the instructions indicated, but got "Variable JSENGINE is undefined": js-23.0.7,jar js-scriptengine-23.0.7.jar Later, I added in: js-language-23.1.1.jar graal-sdk-23.0.7.jar truffle-api-23.0.7.jar Following the addition of those, running the Graal script provided in my previous reply, the line: jsEngine = engineManager.getEngineByName("graal.js"); worked. I was able to dump the contents of jsEngine and when I added and ran: foo = engineManager.getEngineFactories(); writedump(foo); It showed Graal as an available engine, which is great; however, I immediately got the following error whern the actual JavaScript is processed: java.lang.NoClassDefFoundError: com/ibm/icu/number/Notation
... View more
‎Feb 13, 2025
10:13 AM
This is the code (below) for implementation of GraalJS, as supplied (verbatim) by a helpful contributor in the Facebook CF group. I have tried to implement it as described but can't get it to work. I get the result, "Variable JSENGINE is undefined" when running her example. Possibly I have the wrong versions of the jars? I haven't been able to find a good cross-reference indicating which versions of GraalJS/GraalVM work with which versions of Java, which seems really odd. Any assistance would be greatly appreciated. ----- Nashorn was removed from Java 15+, and ColdFusion 2023, which runs on Java 17, no longer includes it. GraalVM’s JavaScript engine is the best alternative, but it does require some setup. Steps to Integrate GraalVM JavaScript into ColdFusion 2023 1. Download the GraalVM JavaScript JAR Since you need JavaScript support within CF2023, you can use the standalone GraalJS JAR instead of the full GraalVM distribution. Download the latest graal-js JAR from Maven: GraalVM JavaScript JAR The current version should be something like org.graalvm.js:js:23.1.1 You may also need org.graalvm.js:js-scriptengine for Java ScriptEngine compatibility. 2. Add the JAR(s) to ColdFusion's Classpath After downloading the necessary JARs, you need to add them to ColdFusion's Java classpath: Place the JAR(s) into ColdFusion’s lib directory: Path: {ColdFusion2023_Home}/cfusion/lib Alternatively, you can place them in a custom folder and reference them dynamically. Edit ColdFusion’s JVM Arguments: Open jvm.config (found in {ColdFusion2023_Home}/cfusion/bin). Add the path to the JAR(s) in the java.class.path entry. Example: ini Copy code java.class.path={other existing entries};C:/path/to/graal-js.jar;C:/path/to/js-scriptengine.jar Restart ColdFusion to load the new JARs. 3. Use GraalVM JavaScript in ColdFusion Once GraalVM JavaScript is installed, you can use it in ColdFusion via the Java ScriptEngineManager, similar to how Nashorn was used. Here’s how you can execute JavaScript in ColdFusion using GraalVM: cfml Copy code <cfscript> // Import required Java classes ScriptEngineManager = createObject("java", "javax.script.ScriptEngineManager"); engineManager = ScriptEngineManager.init(); // Get the GraalVM JavaScript engine jsEngine = engineManager.getEngineByName("graal.js"); // Execute JavaScript code jsCode = "var x = 10; var y = 20; x + y;"; result = jsEngine.eval(jsCode); // Output result writeOutput("JavaScript result: " & result); </cfscript>
Troubleshooting
If getEngineByName("graal.js") returns null, ensure:
The JARs are correctly added to the classpath.
The ColdFusion server has been restarted.
You're using the correct JAR versions.
... View more
‎Feb 12, 2025
07:10 AM
1 Upvote
Thank you, @Charlie Arehart , as always!
... View more
‎Feb 12, 2025
05:39 AM
Understood, @BKBK. I did start to play with GraalVM, or specifically GraalJS, based on notes offered to me by a couple of very helpful people on Facebook's CF Group. I tried unsuccessfully to apply their CF2023 step-by-strp to CF2021, because 2021 was the only environment I had installed. Of course, I had to substitute earlier versions of the GraalJS jar files that I thought would be apropos to CF2021. I now have CF2023 installed and am planning on trying your Nashorn solution and the other person's GraalJS solution to 2023 soon. (We're having some internal dev environment issues that are delaying progress.)
... View more
‎Feb 11, 2025
01:00 PM
Last year the Log4J vulnerability called for the addition of the JVM argument -Dlog4j2.formatMsgNoLookups=true in CF2018 and CF2021. Does anyone know if this JVM argument is still needed/recommended/valid in ColdFusion 2023?
... View more
‎Feb 11, 2025
12:55 PM
@BKBK Thank you for the response. I'm just finishing the setup of my CF2023 environmet for implementing and testing this, and hope to strat trying to apply your suggestion shortly.
... View more
‎Feb 05, 2025
05:13 AM
This is a very rudimentary example, @Dave Watts. I didn't code the original in our codebase but I got this to work yesterday when I was experimenting with it in CF2021. <cfset local.scriptManager = createObject("java", "javax.script.ScriptEngineManager").init() />
<cfset local.engine = local.scriptManager.getEngineByName("javascript") />
<cfsavecontent variable="local.someJavaScript">
function addNums() { return 2 + 3; }
</cfsavecontent>
<cfset local.engine.eval(local.someJavaScript) />
<cfset local.myResults = local.engine.invokeFunction('addNums',[]) />
<cfoutput>#local.myResults#</cfoutput>
... View more
‎Feb 04, 2025
10:53 AM
Hi all. ColdFusion 2021 uses Java 11 and ColdFusion 2023 uses Java 17. Java 11 contained the Nashorn Scripting Engine, which is used in my CF 2021 code to run JavaScript on the back end, but Nashorn was removed from Java 17, so I'm looking for the best way to replace what it did in ColdFusion 2023. Has anyone else successfully done this? Apparently Nashorn is now available as a standalone package but I'm not a Java guy, so I don't know how to get it into a form that ColdFusion can use (maybe a jar file). Would anyone else know how to go about this? Another alternative is the GraalJS scripting engine, which I understand can duplicate what Nashorn did, but again, how can this be put into a ColdFusion-usable library or installation? Any help would be greatly appreciated!
... View more
‎Aug 14, 2024
08:34 AM
BKBK Yes, there is no confusion as to why the existing code doesn't work. The purpose of my post was to find an easy workaround, such as a JVM argument. Your use of QueryNew() is more efficient than actually doing a dummy query, so that is the going solution if nobody else has a quick fix. Thanks
... View more
‎Aug 14, 2024
07:57 AM
The best short-term solution hack I can think of, if nobody here has a better solution, is to code a method in our global utilities object... <cffunction name="ZeroRecQuery" returntype="query" output="false">
<cfquery name="getZeroRows">
SELECT 1 AS dummy WHERE 1 = 2
</cfquery>
<cfreturn getZeroRows>
</cffunction> Then replace a command like the following: <cfset myQuery.RecordCount = 0> with the following: <cfset myQuery = request.utils.ZeroRecQuery()> This works because it replaces the whole query. It's a horrible hack, but it has the benefit of beig highly reliable and a line-for-line replacement. Still, I'd like to avoid doing that if there's a better solution.
... View more
‎Aug 14, 2024
07:45 AM
Hi, BKBK. The error is exactly the same as pauljarema's above, and I've tested it and confirmed that the issue is due to setting the recordcount of query results to zero with the cfset tag. Previous coders of our app have code that sets query recordcounts to 0 in cases where the query results don't matter, followed by conditionals that take action only if the recordcount is greater than 0. Recoding all of the instances to use other variables would be a big task, with a great deal of testing required, which is not desired because the ColdFusion app is being rewritten in a different language over the coming year anyway.
... View more
‎Aug 14, 2024
06:20 AM
Thank you all for the explanation of the CF2021 issue explained in this thread. I am experiencing the same issue. I just performed a simple query, tried to set the recordcount afterward, and got the same error. My question is about whether there might be a JVM argument to revert this back to the way things worked in CF2018, or some other global fix. Our codebase appears to set recordcount manually upwards of 90 times throughout, and our application is already live. Any info would be greatly appreciated.
... View more
‎Jul 08, 2024
11:01 AM
My thanks to Charlie and BKBK. I'm sorry for not responding back sooner. We just got over the deluge of more pressing issues that accompanied the huge modernization implementation we recently did. Charlie, thank you for the final answer. You came and visited a small CF shop where I worked in Annandale, NJ way back in the early 2000's, and have been helpful ever since! The install lines do indeed occur whenever I restart CF, and I noticed today that they appear on both of the live CF servers that support our site. It is a relief to know that they do not equate to a time bomb.
... View more
‎Jun 20, 2024
11:52 AM
Hi All. I am seeing many of these installation messages in the cfpm-audit.log from this morning on our production server, and there are many others from June 18th. We are not installing anything! Can someone shed some light on what these entries are referring to? We absolutely don't want anything being installed without our testing first! We do have the "Automatically Check for Updates" checkbox checked in the cf administrator, but everythign on the web indicates that this will only send notifications of updates, and will not automatically install them. Thank you.
... View more
‎Jun 09, 2024
11:02 AM
Hi, All. I'm running cf2021. Our application has been running smoothly during development for months, but we suddently got the following error message in the browser when accessing the site: After that, everyone else accssing the site got the same message. I'm seeing the following in the application log for the same times as the user attempts (URL changed for privacy purposes): "The prepared statement handle 1 is not valid in this context. Please verify that current database, user default schema, and ANSI_NULLS and QUOTED_IDENTIFIER set options are not changed since the handle is prepared. The specific sequence of files included or processed is: C:\inetpub\wwwroot\blabla\index.cfm, line: 55" I found comments at https://community.progress.com/s/article/Queries-with-ANSI-NULLS-ON-OFF-fails-with-SQL-Server-JDBC-Driver about this error, and it said it is related to SQL pooling. I looked at the advanced settings for my datasource (out of the box settings) and the look like this: As a test, I changed the "Max Pooled Statements" to 1000, and everyone was then able to get to the site. I changed the value back to 100 and I was STILL able to get to load the site successfully. Can anyone tell me more clearly what this error means, and how to make sure it doesn't occur again?
... View more
‎May 05, 2021
06:17 AM
1 Upvote
Thsi is the code that worked: <cffile action="readbinary" file="C:\junk\myBinaryKey.key" variable="keyAsBinary">
<cfset myKey = ToBase64(keyAsBinary)>
<cfoutput>#myKey#</cfoutput>
... View more
‎Apr 29, 2021
03:50 PM
1 Upvote
Thank you for the effort, BKBK, but what worked was running the binary data through the ToBase64() function.
... View more
‎Apr 26, 2021
07:21 AM
Hi all. Help would be very appreciated... I have a requirement to accept a POST parameter that is encrypted using DESede/ECB/PKCS5Padding, and decrypt that param for use in my application. In attempting to test out this encryption and decryption, the following code was found to work successfully: <cfset theKey = generateSecretKey('DESEDE')>
<cfset varString = "Testing">
<cfset encrypted=encrypt(varString, theKey, 'DESEDE','Base64')>
<cfset decrypted=decrypt(encrypted, theKey, 'DESEDE','Base64')>
<cfdump var="#decrypted#"> Our issue is that in the test above the key value produced appears to be plain text, but the key that we are receiving from our data sender is in a .key file, and which seems to contain binary data. Can anyone tell me how a .key file might be used to decrypt a desede encrypted file?
... View more
‎Feb 19, 2021
05:45 AM
Thank you, Charlie Arehart. As mentioned, the addtoken param was doing what I wanted it to in my application, but that was on a Wednesday with the windows closed. I wanted to make sure there were no contingencies or dependencies that affect addToken's usability. More importantly, we all know it isn't safe to use elements of a language in ways contrary to the docs, even if they happen to work, because we can't rely on them to act the same way in future updates. Thank you for the comment. I believe I can use cflocation with addtoken comfortably now despite clientmanagement being false. There was a concerning detail I found in relation to Secure Profile being turned on. I found a work ticket in our system from 2014 (before my time with the organization) through which hundreds (all) of addtoken params having a value of "no" were removed from our application "in preparation for CF11", despite the fact that Secure Profile was apparently never turned on. That makes no sense to me, neither in relation to why that was done nor why addToken="no" wasn't put back into the code when it was realized that cfid and cftoken were appearing on the URL after CF11 was installed. For now, I'm just chalking it up to misreading the CF docs and a busy department for the last 7 years. It's just concerning to me. As I am tasked with removing cfid and cftoken from the site's urls, I'm considering a safe course of action to be putting the addtoken params back into the code with an application variable set to "no" as the value. Then, if things go South when deployed, we can quickly change the application variable to "yes" until we evauate further. Thanks again.
... View more