Skip to main content
Inspiring
February 22, 2024
Answered

CF2023 Java error

  • February 22, 2024
  • 1 reply
  • 2412 views

I am running CF2023 with JDK-21 using commandbox. I am getting the following error (see attached screenshot), which doesn't occur for me on prior versions of CF/Java. I added the following to my server.json which my understanding is this should be added by commandbox to the jvm.config file and I had assumed this would have stop the error, but it did not. Any advice/help would be appreciated:"jvm":{
        "minHeapSize":"${MINHEAP:1G}",
        "heapSize":"${MAXHEAP:2G}",
        "args":[
            "-Dcoldfusion.datemask.useDasdayofmonth=true",
            "-Dcoldfusion.xml.allowPathCharacters=true",
            "--add-opens=java.desktop/com.sun.awt=ALL-UNNAMED"
        ],
        "javaHome":"C:\\Program Files\\Java\\jdk-21"
    },


    This topic has been closed for replies.
    Correct answer donaldy1202780

    There's something else I am curious about.  Why did you use Java 21? Adobe recommends Java 17 for ColdFusion 2023.


    The only reason I used JDK-21 is that what I was directed to do when I first installed it here by another developer and at the time I didn't think to question it. I do realize now it's not yet supported by adobe. I was able to get the issue resolved, apparently I wasn't using the proper string, when I add this to the args, it began working:

    "--add-opens=java.desktop/sun.awt=ALL-UNNAMED"

    1 reply

    Inspiring
    February 22, 2024

    After realizing CF2023 still doesn't support JDK-21 I switched to JDK-17 and same issue. However switching to JDK-11 stopped the issue. What's more interesting is that running JDK-17 on a stand alone install of CF2023 this issue does not arise, it's only occurring on a commandbox instance of the server. Any advice would b emuch appreciated. Thanks!

    BKBK
    Community Expert
    Community Expert
    February 22, 2024

    As a test (using JDK-17 and JDK-21), what happens when you leave out the flag 

    "--add-opens=java.desktop/com.sun.awt=ALL-UNNAMED"

    from the JVM?

    Inspiring
    February 22, 2024

    It also fails, I only added that argument into the server.json file because the error was occurring and I was hopeful that argument would propogate at runtime and stop the error. Either way it fails in both JDK-17 and JDK-21 with or without the argument passed through to commandbox. Frankly I don't think the argument is being consumed and passed onto the server via commandbox at runtime because this populates on commandline at startup and it doesn't contain the line I added above Picked up JDK_JAVA_OPTIONS:

    JDK-11, without the argument, works fine via commandbox running CF2023. It's just not really helpful because my qa and live environments are running JDK-17 in standalone CF without this issue, so I don't want to develop in my local on an older version of Java if I can avoid it.