Today I was trying to load a -javaagent
on Java 21 / ColdFusion 2025 on Windows Server 2022, but I was getting the following error:
Error occurred during initialization of VM Could not find agent library instrument on the library path, with error: Can't find dependent libraries Module java.instrument may be missing from runtime image.
Let's take a step back because I was actually not finding any error messages, there was nothing in ColdFusion's Log directory. The only error logged was in Event Viewer, was a quite unhelpful:
The ColdFusion 2025 Application Server service terminated with the following service-specific error: The system cannot find the file specified.
I was only able to see that above error if I tried running:
coldfusion.exe -start -console
Now with that error, the first thing I did was make sure that the java.instrument
module was actually part of the JVM I was using. It is possible to ship a JVM without certain modules using JLink, so I wanted to see if Adobe had done that with ColdFusion 2025.
java.exe --list-modules
And it does in fact list:
java.instrument@21.0.6
Next I am checking to see if instrument.dll
indeed in the JVM folder, and it was.
Next I invoked the java agent using java.exe
directly instead of via coldfusion.exe
, and it worked fine. So it did not appear to be an issue with the JVM, or the JavaAgent itself. This leaves coldfusion.exe
, which invokes the JVM a little differently than java.exe, I believe it is using jvm.dll.
The error message does appear to indicate that it cannot find the instrument.dll, I tried adding the jvm bin directory to the java.library.path
, but that still didn't work. Finally adding the JVM bin directory to the system PATH environment variable did the trick, and Java was now able to find the instrument.dll library.
I put the following in a bat file to test it first:
set PATH=C:\java\jdk-21.0.6\bin;C:\java\jdk-21.0.6\bin\server;%PATH%
Then after finally adding it to the system environment variables I was able to start the ColdFusion 2025 Application Server Service.
Note: The ColdFusion service actually executes coldfusionsvc.exe, which then creates a sub process of coldfusion.exe
I'm not sure if this is a common issue, or if I did something to cause this on the server (I was a test server that I was tinkering around on quite a bit), but I figured I would post it, incase it helps anyone else.