Skip to main content
Inspiring
October 25, 2022
Answered

CFHTMLTOPDF Fails Under 2021/Update 5 After Upgrading Java to 11.0.17

  • October 25, 2022
  • 2 replies
  • 3118 views

CF Version: 2021,0,05,330109

Java Version: 11.0.17

 

This is the same error I reported last year here, but the solution of changing the order the services are started in no longer works. The issue actually returned after upgrading Java and not necessarily after the move to 2021/5. However, the release notes for 2021/5 mention several bug fixes related to PDF generation, so I have to wonder if one of these is to blame.

 

Here are the last 2 lines in the CF server log after starting the services:

 

"Error","Thread-33","10/24/22","15:39:58","","Read timed out 127.0.0.1:8993/PDFgServlet/"
"Error","ajp-nio-127.0.0.1-8020-exec-2","10/24/22","16:02:17","","Registration error for service manager : .127.0.0.1:8993/PDFgServlet/.Reason: SERVER ERROR"

 

We also noticed this in the PDF logs - the first entry was under Java 11.0.16.1 and was successful:

 

127.0.0.1 - - [24/Oct/2022:13:39:38 +0000] "POST /PDFgServlet/ HTTP/1.1" 200 22100 "-" "Apache-HttpClient/4.5.13 (Java/11.0.16.1)"

127.0.0.1 - - [24/Oct/2022:16:03:11 +0000] "POST /PDFgServlet/ HTTP/1.1" 500 489 "-" "Apache-HttpClient/4.5.13 (Java/11.0.17)"

 

Thoughts?

 

Thanks,

Eric

This topic has been closed for replies.
Correct answer ej401

I work with Eric and he's out of the office for a bit so picking up where he left off.  I'm the admin of the CF system.  When run like what you have the inbuilt Java is 11.0.1 and the command through a directed Java with the --list-config pulls back the Java version it's set to run against so 11.0.16.0 or 11.0.17.0 depending on what we have it set to for testing.

 

When the Jetty is using the 11.0.17.0 it loads and looks to be running fine but throws 500 errors when commands are setn to it.

 

Can you go into your ColdFusion2021\cfusion\jetty\lib folder and see what version your Jetty is from looking at the jar info?  For example ours is jetty-client-9.4.31.v20200723.jar.  Apparently depending on when you got the install media for CF2021 it installs different versions of Jetty and Java with it.  Hence we have the Java 11.0.1.0 because we isntalled the original Gold images years ago.  I'm wondering if this is an issue with ours possibly also because of this having older Jetty versions.


We did some more testing and the only way CFHTMLTOPDF will work for us under Java 11.0.17 is if we point CF to Java 11.0.17 and the jetty config variable (ax.nl.current.vm) to the VM under the CF21 directory - i.e., [server root]\ColdFusion2021\jre\bin\javaw.exe, which is currently 11.0.1. 

 

We are going to leave it at that.

 

Thanks for everyone's help with this,

-Eric

2 replies

Inspiring
July 21, 2023

I recently upgraded to ColdFusion 2021 Update 9 and I am experiencing a similar issue. When setting the java version in the jetty lax file to any version greater than Java Version: 11.0.16.1 I get a server error.

 

Putting it back to 11.0.16.1 resolves the issue. I am a bit concerned that I cannot run a more secure version of Java. From a security stand point, how serious is this?

 

2nd issue I just came across is that cfhtmltopdf no longer outputs the "Calibri" font. It just displays blank text. Switching to "Arial" works. Any idea what would have changed?

BKBK
Community Expert
October 25, 2022

Could you please share a sample of the code causing the error?

ej401Author
Inspiring
October 25, 2022

@BKBK 

 

Even the simplest example causes the error:

 

<cfhtmltopdf><h1>test</h1></cfhtmltopdf>

 

The error and stack trace are also similar to the error we reported last year:

 

Error occurred while generating PDF.

Reason: SERVER ERROR

 

coldfusion.document.webkit.PDFgErrorHandler$ServiceManagerConversionException: Error occurred while generating PDF.
	at coldfusion.document.webkit.PDFgErrorHandler.handleConversionError(PDFgErrorHandler.java:190)
	at coldfusion.document.webkit.HttpPDFRequestHandler.requestPDFGeneration(HttpPDFRequestHandler.java:178)
	at coldfusion.tagext.htmltopdf.HtmlToPdfTag.processPDFgRequest(HtmlToPdfTag.java:1149)
	at coldfusion.tagext.htmltopdf.HtmlToPdfTag.handlePDFgConversionRequest(HtmlToPdfTag.java:1301)
	at coldfusion.tagext.htmltopdf.HtmlToPdfTag.convertToPDF(HtmlToPdfTag.java:1236)
	at coldfusion.tagext.htmltopdf.HtmlToPdfTag.doEndTag(HtmlToPdfTag.java:1414)

 

In the CF Admin, the PDF service validates (see attached).

 

-Eric

BKBK
Community Expert
October 26, 2022

@BKBK @Priyank Shrivastava. 

 

Thanks for all of the tips guys. Ultimately, we found that the Java version specified in the jetty config file was the issue: ColdFusion2021\cfusion\jetty\jetty.lax (LAX.NL.CURRENT.VM setting).

 

When we changed the jdk reference from 11.0.17 back to 11.0.16 and restarted the services, the pdf conversion started to work again. The PDFgServlet "registered" line was also added to the CF server log after our first conversion attempt (which has always been the case for us - it was never added automatically just from a server restart).

 

When you all tested with Java 11.0.17, are you sure that the jetty config file was not still pointing to 11.0.16? We are now looking to see if the version of jetty CF2021 is using is compatible with Java 11.0.17.

 

Thanks,

Eric


@ej401 , in answer to your questions:

  1. I did verify - in the ColdFusion Administrator - that CF 2021 Update 5 is indeed using Java 11.0.17. That's the very first thing I do after installing Java.
  2.  LAX.NL.CURRENT.VM setting (in ColdFusion2021\cfusion\jetty\jetty.lax): C:\\ColdFusion2021\\jre\\bin\\javaw.exe