Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Feb 01, 2023 Feb 01, 2023

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?

2.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Feb 22, 2024 Feb 22, 2024

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

Translate
Community Expert ,
Feb 01, 2023 Feb 01, 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)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 02, 2023 Feb 02, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 07, 2023 Feb 07, 2023

Any new info, Keith?


/Charlie (troubleshooter, carehart. org)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 07, 2023 Feb 07, 2023

We wound up re-installing CF 2018, reapplying update 15 and it is still not working. Interesting we are getting a new error on the same action. We believe it is a product issue with the cfdocument tag because the error comes up when we invoke it. We wound up submitting a ticket to Adobe. Here are the errors we are getting now:

coldfusion-out.log:

Feb 6, 2023 10:44:12 AM Error [ajp-nio-127.0.0.1-8018-exec-4] - Could not initialize class java.awt.Font The specific sequence of files included or processed is: D:\web\sims_qa\ia\index.cfm, line: 184

 

coldfusion-error.log: 

Feb 06, 2023 10:44:12 AM org.apache.catalina.core.StandardHostValve custom
SEVERE: Exception Processing ErrorPage[exceptionType=java.lang.Exception, location=/CFIDE/administrator/templates/errors.jsp]
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.IllegalStateException: Cannot create a session after the response has been committed
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:623)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:489)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:379)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:711)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:578)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:517)
at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:384)
at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:327)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:377)
at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:463)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:889)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1743)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: javax.servlet.ServletException: java.lang.IllegalStateException: Cannot create a session after the response has been committed
at org.apache.jsp.CFIDE.administrator.templates.errors_jsp._jspService(errors_jsp.java:213)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466)
... 23 more
Caused by: java.lang.IllegalStateException: Cannot create a session after the response has been committed
at org.apache.catalina.connector.Request.doGetSession(Request.java:3066)
at org.apache.catalina.connector.Request.getSession(Request.java:2498)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:908)
at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:244)
at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:585)
at org.apache.catalina.core.ApplicationHttpRequest.getSession(ApplicationHttpRequest.java:529)
at org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:130)
at org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryImpl.java:109)
at org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:59)
at org.apache.jsp.CFIDE.administrator.templates.errors_jsp._jspService(errors_jsp.java:107)
... 26 more

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 07, 2023 Feb 07, 2023

Ok, but with all that said, I'll ask (as I did originally) about what is the jvm version cf is using. See the "settings summary" in the cf admin. What version does it report? 


/Charlie (troubleshooter, carehart. org)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 07, 2023 Feb 07, 2023

Also, I've seen people solve that specific error (new in your last post, "Could not initialize class java.awt.Font") with different solutions (not necessarily right for all cases) :

  • If it's missing, add the jvm arg

 

-Djava.awt.headless=true​
  • As you're on windows, you may need to copy a needed msvcp*.dll from the jre/bin of your jvm to your cfusion/bin. If you consider that, take notes to undo it if it doesn't help. 

/Charlie (troubleshooter, carehart. org)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 08, 2023 Feb 08, 2023

Charlie, thank you for your time. I changed the path in the CF Admin to C:/Program Files/Java/jdk-11.0.17 and I got the same error in the coldfusion-error.log but the error in the coldfusion-out.log is now: Feb 8, 2023 07:21:50 AM Error [ajp-nio-127.0.0.1-8018-exec-9] - Could not initialize class java.awt.Toolkit The specific sequence of files included or processed is: D:\web\sims_qa\ia\index.cfm, line: 184. So it changed from 'Font' to 'Toolkit'. I did not try your argument as I'm not sure where to enter the argument. If it is in CF admin let me know what menu I can find it or if it is in a config file what is the file name. Sorry I'm new to the CF environment.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 08, 2023 Feb 08, 2023

Sorry, the threading of this discussion is challenging on a mobile. I'm only now seeing this reply from earlier. 

 

As for how to add that jvm argument, it can be done in the cf admin, in the "settings">"java and jvm" page, and thenits "java args" field. There you will see many already there, and you'd add that one above there.

 

Do be very careful. Don't add it as a new line. And beware that if you make a mistake, cf may not come back up. That's why instead you can make the change by editing cf's jvm.config file, found in the cfusion/bin folder. That has a java.args line where again you could add it. Save a copy of the file, edit it, save it, and restart cf. If anything is amiss, you could easily undo the change and restart cf. 


/Charlie (troubleshooter, carehart. org)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 08, 2023 Feb 08, 2023

Adding the argument did not work and it didn't change anything. I pulled it back out.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 08, 2023 Feb 08, 2023
Java Version11.0.1  
Java VendorOracle Corporation  
Java Vendor URLhttp://java.oracle.com/  
Java HomeD:\ColdFusion2018\jre  
Java File EncodingCp1252  
Java Default Localeen_US 
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 08, 2023 Feb 08, 2023

Keith, you've offered that info as a reply to my comment, where I proposed a JVM arg. Have you tried that? (It does suggest you need not worry about my second suggestion there, about copying a dll.) 


/Charlie (troubleshooter, carehart. org)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 08, 2023 Feb 08, 2023
quote
Java Version 11.0.1  
Java Vendor Oracle Corporation  
Java Vendor URL http://java.oracle.com/  
Java Home D:\ColdFusion2018\jre  
Java File Encoding Cp1252  
Java Default Locale en_US 

By Keith28215694horx



There's a problem right there. The Java that ColdFusion is using is "D:\ColdFusion2018\jre ", and not "C:\Program Files\Java\jdk-11.0.17" as you had expected.

 

As Charlie suggests in one of his bullet-points, you should edit the file D:\ColdFusion2018\cfsion\bin\jvm.config as follows  

 

java.home="C:/Program Files/Java/jdk-11.0.17"

 

if you want ColdFusion to use JDK 11.0.17.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 08, 2023 Feb 08, 2023

I'll give it a try. Thanks for your help.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 08, 2023 Feb 08, 2023

@Keith28215694horx ,

It might have to do with Windows, rather than with ColdFusion or Java. I say this because the errors refer to DLLs.

 

Possible solution: update Windows to the latest version. To do so, follow Start > Settings > Windows Update.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 08, 2023 Feb 08, 2023

No, it didn't work

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 08, 2023 Feb 08, 2023

Which "it"? There have been many suggestions above from BKBK and myself. Just not clear which you mean. 


/Charlie (troubleshooter, carehart. org)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 08, 2023 Feb 08, 2023

Sorry, applying the latest windows updates did not change the situation.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 08, 2023 Feb 08, 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)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 22, 2024 Feb 22, 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.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 22, 2024 Feb 22, 2024

My ColdFusion release version is 2021, sorry to typo.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 22, 2024 Feb 22, 2024

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 23, 2024 Feb 23, 2024
LATEST

It's certainly interesting to hear that worked for you. Thanks for sharing it, and indeed for trying it. 

 

I'd be curious why that would "suddenly" be needed. Does anyone there have a thought on that? Was anything done before the failure?

 

It would also be interesting to hear from @Keith28215694horx, both whether that might work for him, or whether he ever solved his problem some other way. We never heard back from after Feb 8 of last year. I suspect the lack of a clear "answer"--and our requests for more debugging info--were discouraging at the time. 


/Charlie (troubleshooter, carehart. org)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources