Going from Coldfusion to Lucee (creating a text on image)
I just used that code from Lucee documention, and I get an Error

				img.DrawText("I love lucee",55,120,style);

The error is

Lucee Error (java.lang.InternalError)
Message java.lang.reflect.InvocationTargetException
Stacktrace The Error Occurred in
/var/www/C020/site/index/captcha_generate.cfm: line 55

53: img=imageNew("",300,300,“RGB”,"##bf4f36");
54: style={size=“40”,style=“BOLD”};
55: img.DrawText(“I love lucee”,55,120,style);
56: cfimage(action=“writeToBrowser”,source=img);
called from /var/www/C020/site/admin/lettre_admin.cfm: line 84


Java Stacktrace lucee.runtime.exp.NativeException: java.lang.reflect.InvocationTargetException
at java.desktop/sun.font.FontManagerFactory$ Source)
at java.base/ Method)
at java.desktop/sun.font.FontManagerFactory.getInstance(Unknown Source)
at java.desktop/java.awt.Font.getFont2D(Unknown Source)
at java.desktop/java.awt.Font.defaultLineMetrics(Unknown Source)
at java.desktop/java.awt.Font.getLineMetrics(Unknown Source)

Linux debian 10
php 7.3
apache 2.4

There is some related issue in Jira LDEV-2619,LDEV-2643

1 Like

I do not understand your question ?
Just try :
This the exact code in Lucee documentation.
image.drawText() :: Lucee Documentation
I just copy/paste and try. And error.
Thanks for help.

Yes, I understood your question, in the Link.
I think, it is exactly the same issue.
What is the solution today ?

Thanks you.

read thru the jira tasks, the solution is provided there

The suggestion I found in jira, is
As suggested by @sbleon I’ve created/edited the file /opt/lucee/tomcat/bin/ and added the following JVM system property to run Javas AWT in headless mode:

export JAVA_OPTS="-Djava.awt.headless=true"

Restarted Lucee and the issue went away.

I do not dare to open and modify that file,
Can I open with bloc-notes add this line after a ; (semi-column)
and save and replace that file ? (the restart Lucee)

Thanks for advise.

This has been solved with font installation on linux debian.
See thread : Bug with CFCHART - #4 by kabutotx
All functions needed the MS font had the same problem. Solved now.