December 11, 2024
coldfusion packaged jre missing classes?
Comments
(3)
December 11, 2024
coldfusion packaged jre missing classes?
Newbie 1 posts
Followers: 0 people
(3)

From what I understand, the “java.net.http” package has been included in JREs since Java 11.  Coldfusion comes with a Java 17 JRE.  However, it seems that there is no “java.net.http” package available with that JRE as executing the following produces a ClassNotFoundException:

CreateObject(“java”, “java.net.http.HttpClient”)

I’m not quite understanding.  Does Coldfusion ship with a special JRE that doesn’t have all the modules that a normal Java 17 JRE would have?

3 Comments
2024-12-13 18:34:55
2024-12-13 18:34:55

So I re-downloaded the installer zip from https://helpx.adobe.com/coldfusion/kb/coldfusion-downloads.html#download0 because I noticed a note on the download page that says on 10/10/2023 the zip and gui installers were updated.  After downloading, I extracted only the jre directory from it in order to inspect it.  I noticed the jre/lib/modules file in the download was larger than what we originally got/installed.  I replaced the jre directory with the new download version and restarted, but kept seeing the same error.

I then noticed that a new installer for JDK 17.0.13 was on the downloads page (https://helpx.adobe.com/coldfusion/kb/coldfusion-downloads.html#downloads3).  I downloaded it to the server and pointed CF at it.  After restarting, the ClassNotFoundException disappeared.  So it seems that the JRE that comes with the installer does NOT have the java.net.http classes or module.  Are you still running the JRE that came installed?  Or have you updated to one of the more recent versions that Adobe has made available?

Like
()
2024-12-13 16:59:38
2024-12-13 16:59:38

Thanks for your response Charlie.  Yes – we are running Coldfusion 2023 (update 11) on Windows Server 2016 Standard.  We previously were on from CF2018 and prior to switching over, exported our settings into a .car file then imported them after the install of CF2023.  We did the install from the executable (ColdFusion_2023_GUI_WWEJ_win64.exe) but I also have a copy of the zip.

When I run your cfdump, I see “17.0.6”

When I log into the server and run “C:\ColdFusion2023\jre\bin\java.exe -version”, I see the following:

java version “17.0.6” 2023-01-17 LTS
Java(TM) SE Runtime Environment (build 17.0.6+9-LTS-190)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.6+9-LTS-190, mixed mode)

I did take a look at our jvm.config and we didn’t have the –add-opens you mentioned, but after I added it, I still end up with the ClassNotFoundException.  Since I still have access to the zip, I will compare the jvm.config that comes out of the box with our current version to see if I can find anything that may be causing this.

 

Like
()
2024-12-12 16:07:23
2024-12-12 16:07:23

svn, let me clarify first that I can run that exact code on CF2023, without error. As for why it’s happening for you, more in a moment. (You mention Java 17, and only CF2023 supports that, so I am assuming you’re using CF2023.)

Next, as for your question, “Does Coldfusion ship with a special JRE that doesn’t have all the modules that a normal Java 17 JRE would have?“, the answer to that is “no”: the JVM that CF provides (in the coldfusion/jre folder) is a complete JVM which is the same as the equivalent you’d obtain from Oracle (for the same version/same OS).

So as for why it’s happening for you, let’s ask first what IS the exact JVM version your CF2023 is using? As you may know, that can be CHANGED (using the CF Admin or jvm.config, modifying the java.home location). But if you look at your CF Admin “settings summary” page , that shows it. So would this code:

<cfdump var=“#server.system.properties.java.version#”>

(And I discuss still other ways at https://www.carehart.org/blog/2021/4/5/Confirming-ColdFusions-Java-version-via-CFML-code.) Is it the 17.0.6 that CF2023 came with? or perhaps a newer one you’ve pointed it to? But the REAL question is whether somehow it may be something OTHER than Java 17. It should NOT be, as that’s all that CF2023 supports. But let’s perform that sanity check.

I’ll add also that I wondered if PERHAPS the problem may be instead with how your jvm.config was setup, perhaps due to an import of settings from an older CF version. That has led to some problems for folks. And specifically, because later versions of CF now come with later Java versions, those later Java versions default to blocking some modules/libraries. And you may notice that the java.args line of your jvm.config has many “–add-opens” lines. It should have 15, by default.

And one of those specifically is “–add-opens=java.base/java.net=ALL-UNNAMED”, and I’d wondered if perhaps the problem for you was if that was missing…but I went ahead and removed that from mine and restarted, and even so I could STILL run that code above. So ensuring that’s there is NOT the solution for you.

As for what will be, that remains to be seen. If what I’ve shared doesn’t help you, can you clarify how you installed CF (the installer or the zip approach, per perhaps the Docker image or commandbox)? And also what OS are you running?

Like
()
Add Comment