Skip to main content
Participating Frequently
February 1, 2023
Answered

Getting Error: Unable to initialise JAI service: java.lang.UnsatisfiedLinkError using cfdocument

  • February 1, 2023
  • 2 replies
  • 2545 views

Getting a few errors when we are cf document to generate a pdf file. coldfusion-error.log records: 

java.lang.NoClassDefFoundError: Could not initialize class java.awt.Toolkit

and coldfusion-out.log records the error: 

Feb 1, 2023 14:16:36 PM Error [main] - Unable to initialise JAI service: java.lang.UnsatisfiedLinkError: C:\Program Files\Java\jdk-11.0.17\bin\awt.dll: Can't find dependent libraries

 

Do I need to reinstall or repair either the Java SE Dev Kit app or CF 2018?

    This topic has been closed for replies.
    Correct answer SamsonLaw

    My ColdFusion release version is 2021, sorry to typo.


    Hi the issue get fixed after installing the latest Visual C++ Redistributable package, thanks all.

    2 replies

    Charlie Arehart
    Community Expert
    Community Expert
    February 8, 2023

    OK, Keith. I think it's time we stop trying to guess at what change you may want to consider to solve your problem. That seems to have us all going in circles, and I'm sure it's unsatisfactory for you. And you may well be presuming, "CF''s got a bug. Can I just get Adobe to fix it" (and I suspect BKBK would soon be proposing you open a ticket at tracker.adobe.com).

     

    But can you offer to us a simple (few line) code example of what you're trying to do that fails? You're likely thinking "CF is broken", but if we find WE can run the code, then clearly CF is NOT broken and it's something unique about your environment. That can happen, of course, for many reasons.

     

    I do realize that creating sample code is boring and tedious. But honesly, if you opened a tracker ticket you would find that the response may be poor if you can't offer a reproducible case for them, either.

     

    So really, please take just a few minutes and create us a page to demonstrate the least you need to cause the problem. Please be SURE to not include any code that relies on any database data or variables set in any code other than the template you offer us. Sometimes, in doing that, you may find that indeed that TEST page works, which may lead you to wonder how it differs from what for you does NOT work. But maybe it will fail with just a few lines, the first time you try it.

     

    Finally, as another sanity check as as you create this test page, you could put it in a new folder (under where you have other CF code), but in that new folder put in a blank application.cfc--so that CF does not process anything BUT your simple test page. Sometimes people find when doing that, a page that failed ABOVE that folder no longer fails WITHIN that folder--which tells us that the problem has to do with something in your application.cfc/cfm code controlling that folder above this one.) 

     

    Hope that's helpful.

    /Charlie (troubleshooter, carehart. org)
    Participant
    February 23, 2024

    Hi I got the same when after  a routine restart of our production server last weekend :


    "Error","main","02/23/24","09:40:07","","Unable to install JAI package: java.lang.UnsatisfiedLinkError: D:\ColdFusion2021\jre\bin\awt.dll: Can't find dependent libraries"
    java.lang.UnsatisfiedLinkError: D:\ColdFusion2021\jre\bin\awt.dll: Can't find dependent libraries
    at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
    at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2430)
    at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2487)

    ...

    "Error","http-nio-8500-exec-5","02/23/24","09:41:14","cfadmin","Could not initialize class sun.awt.SunToolkit The specific sequence of files included or processed is: D:\ColdFusion2021\cfusion\wwwroot\CFIDE\administrator\reports\index.cfm, line: 501 "
    java.lang.NoClassDefFoundError: Could not initialize class sun.awt.SunToolkit
    at java.desktop/sun.awt.AppContext$2.run(AppContext.java:282)
    at java.desktop/sun.awt.AppContext$2.run(AppContext.java:271)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.desktop/sun.awt.AppContext.initMainAppContext(AppContext.java:271)

    ...

    And every time when execute a call to "SpreadsheetAddRow();" will got following error:

     

    "Error","ajp-nio-127.0.0.1-8020-exec-8","02/23/24","10:09:50","efinance","Could not initialize class java.awt.Toolkit The specific sequence of files included or processed is: D:\e-finance-cf11\html\ac\acrep07b.cfm, line: 87 "
    java.lang.NoClassDefFoundError: Could not initialize class java.awt.Toolkit
    at java.desktop/java.awt.Color.<clinit>(Color.java:275)
    at org.apache.poi.hssf.util.HSSFColor$HSSFColorPredefined.<init>(HSSFColor.java:114)
    at org.apache.poi.hssf.util.HSSFColor$HSSFColorPredefined.<clinit>(HSSFColor.java:56)
    at org.apache.poi.hssf.model.InternalWorkbook.createExtendedFormat(InternalWorkbook.java:1381)...

     

    I have my coldfusion 2012 reinstalled (in my Windows 2012R2) but still the same, and this only happening on my production server but not my uat (also Windows 2012R2), hope someone can help, thank you.

     

    Participant
    February 23, 2024

    My ColdFusion release version is 2021, sorry to typo.

    Charlie Arehart
    Community Expert
    Community Expert
    February 1, 2023

    Keith, you don't indicate anything having happened BEFORE this. Would you say "nothing changed"? Or did someone perhaps recently install a new Java on the machine?

     

    I ask because:

    • you go on to wonder whether you should repair "the Java SE Dev Kit app". Did you by any chance just install the latest update for that, which came out Jan 17? (FWIW, I have a blog post from that day with more about that update.)
    • If so, you may being bitten by an aspect of that installer which I blogged about also just last week: the Oracle jdk installer (for Windows, macOS, and Linux) now uninstalls prior JDKs that were installed with the installer.
    • Since your CF error message refers to C:\Program Files\Java\jdk-11.0.17, can you confirm first if that folder does exist? Or is there now only a C:\Program Files\Java\jdk-11?
    • And if the latter is true, then because your error is with cfdocument (which is driven entirely by CF and nothing else), I wonder: have you yet tried to restart CF since implementing that JVM update? I'm not saying you should. I'm saying that if you try and CF won't restart, it almost certainly proves this is the problem.
    • And in that case, you o(or someone there) should open your coldfusion jvm.config file (likely c:\coldfusion2018\cfusion\bin\jvm.config) and edit its non-commented line for java.home, to change its reference to that jdk-11.0.17 folder to instead be that jdk-11 folder--again, if and only if you confirm that is now the name of the JDK's folder, as above.
    • To be extra safe, you should always make a copy of that file before editing it, so you can revert to it if things don't work. But I will repeat: if you leave the file as is and restart CF and it won't start, then reverting to the backup copy won't work, because CF would not start even BEFORE you changed it

     

    I hope all that makes sense. I recommend you read all that very carefully before you try anything. Again, I am just making an educated guess.

     

    If you would rather do that work with a guiding hand, or if somehow the problem is NOT what I propose initially, then if you want a guiding hand to look into the problem further, I am available for remote consulting, and you can learn more about my approach, rate, satisfaction guarantee, and more at carehart.org/consulting.

     

    Or certainly feel free to reply here and I or others may have different thoughts to share. (I've not yet heard of anyone having this specific problem, but I can say that others reported a very SIMILAR problem back in 2014, and the replies there suggest people felt the problem was the "auto-updating" of the JVM that used to happen with the JRE. Java 11 no longer has a JRE, so we don't have THAT "auto-updating" problem. But this one I disucss above is basically a new variant of it...and I've been afraid that the change by Oracle would come to harm folks who were not expecting it. That's why I wrote the post, and if this is a new behavior, I'll want to add mention of this error to that post I wrote.

     

    Let's see how things pan out for you.

    /Charlie (troubleshooter, carehart. org)
    Participating Frequently
    February 2, 2023

    Thank you very much for the reply. Let me take a look into your suggestions and gather some more information. I'll report back my findings to see if they are new to your research or if it aligns what you've already reported.

    Charlie Arehart
    Community Expert
    Community Expert
    February 7, 2023

    Any new info, Keith?

    /Charlie (troubleshooter, carehart. org)