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

java.lang.NoClassDefFoundError: coldfusion/image/Image

New Here ,
Mar 21, 2024 Mar 21, 2024

I am reciveing the error

java.lang.NoClassDefFoundError: coldfusion/image/Image

when using the cfhtmltopdf tag 

I have tried

<cfhtmltopdf>
#variableContainingCleanedHTML#
</cfhtmltopdf>

I tried writing the HTML to a file and trying to convert it to PDF that way, same error.
 <cffile action="write" file="#expandpath('.')#/Certificate_#form.certNumber#.html" output="#variableContainingCleanedHTML#"> <!--- this worked --->
<!--- fails here --->
    <cfhtmltopdf
        source="#expandpath('.')#/Certificate_#form.certNumber#.html"
        destination="#expandpath('.')#/Certificate_#form.certNumber#.pdf"
    />
TOPICS
Advanced techniques
6.6K
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
Explorer ,
Mar 22, 2024 Mar 22, 2024

I got the same error after installing CF2021 Update 13:

 

Partial log from coldfusion-error.log:

 

SEVERE: Servlet.service() for servlet [CfmServlet] in context with path [] threw exception [ROOT CAUSE:
coldfusion.runtime.EventHandlerException: Event handler exception.

Caused by: java.lang.NoClassDefFoundError: coldfusion/image/Image

 

I had to reinstall the update, then it started working again.

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 ,
Mar 22, 2024 Mar 22, 2024

Given that reinstalling the update fixed things, it would imply there was a failure during the update, or during the process of cf updating packages on the restart after the update. In the latter case, it may be that reinstalling only some failed package update would have sufficed. 

 

As that may be what happened to James (or others who find this), and to help confirm if reinstalling either might be expected to work for them, let me elaborate.

 

1) As for the update, some may know that there's an update log in the cfusion/hf-updates folder, within the folder name for the update you applied. In that folder, it's a file with a very long name (not the hotfix-file list.log), which reflects the day and time the update was attempted. And there may be more than one such file, if you attempt to install multiple times. (There would also be an uninstall log, if you attempted that.) 

 

And in such a log file will be a table tracking the number of successes and fatalerrors in the update, which is found about 70-100 lines from the top. If that reports other than 0 fatalerrors or nonfatalerrors, there was an error in the update. There can be many reasons for that, some of which are not clear from other error lines in that log. I've done blog posts and presentations on dealing with update errors. I'll come back and add links later.

 

2) But even if there are 0 fatalerrors, when an update entails package updates (some do, some don't as indicated in a table at the bottom of the update's technote), then those package updates are applied on the next cf restart (which the update itself will trigger).

 

And the status of those package updates will be tracked in cf's logs, such as the coldfusion-out.log or coldfusion-error.log. You need to find in these logs the timeframe of the cf restart that happened when you applied the update (which time is indicated in the update install log discussed above, again even just in the name of that log file).

 

If the post update restart triggered cf to attempt to update any packages, you should see indications of it uninstalling and then reinstalling the affected packages during this next cf restart.

 

3) James, do you see anything of interest in any of the above logs at the time you applied the update? If the update log itself worked, maybe you'll see that during the first restart maybe only SOME package failed to install.

 

And Sireex, though you've reinstalled the update, you should still have the logs from your first attempt. It could be of value for others if you might confirm seeing anything like I've proposed above (or not).

 

4) As for installing or reinstalling package updates, that can be done (without need of reinstalling the entire update). That can be done either in the cf admin (the "package manager" page, new since cf2021--and NOT the "packaging and deployment" which is much older), or using the command line cfpm tool (also added in cf2021 and documented extensively by Adobe). 

 

Hope that may help someone. 


/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
Explorer ,
Mar 22, 2024 Mar 22, 2024

I checked logs from that date, there were rows like this in coldfusion-out.log :

Error [ajp-nio-127.0.0.1-8020-exec-10] - coldfusion/image/Image The specific sequence of files included or processed is: 

 

Update logs had no errors, and the only errors in coldfusion-error.log were like this:

 

Caused by: java.lang.NoClassDefFoundError: coldfusion/image/Image

Caused by: java.lang.ClassNotFoundException: coldfusion.image.Image not found by pdf [51]

 

We still haven't updated out production servers to update 13, so we'll see how that goes.

 

 

 

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 ,
Mar 22, 2024 Mar 22, 2024
quote

I am reciveing the error

java.lang.NoClassDefFoundError: coldfusion/image/Image

when using the cfhtmltopdf tag 

 

By @James32764395oysv

 

Say what?

What happens wnen you run the following test?

<cfscript>
imageObj = createobject("java","coldfusion.image.Image");
writedump(imageObj);	
</cfscript>
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 ,
Jun 20, 2024 Jun 20, 2024

Had a similar error with cfpdf after a CF2023 upgrade that included an upgrade to the PDF package:

java.lang.NoClassDefFoundError: coldfusion/image/Image at coldfusion.tagext.pdf.PDFTag.setImage

Downgrading to the previous PDF package version stopped this error occurring, and it didn't return after upgrading to the new version again.

 

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 ,
Jun 20, 2024 Jun 20, 2024

Glad to hear that helped you, Chris. And FWIW that's what I'd proposed in March, above, when Sireex said instead that he had reinstalled the entire update.

 

In your case, it was indeed the pdf package (since your error message refers to "pdftag"), while for Sam (the op here) and Sireex it would seem to be the htmltopdf package instead.

 

We never heard back from Sam whether anything helped, but perhaps your observation (and mine) may help folks with what could be a simpler solution (also, package updates usually don't require a cf restart, like reinstalling the update would). 


/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
Explorer ,
Aug 26, 2024 Aug 26, 2024

I started receiving this error after the last update as well.  In my case, it seems to be triggered when trying to use something like this:
cfpdf action="addWatermark"
From the comments it sounds like downgrading to the previous PDF package fixes the issue, but I'm not sure what would be involved with that.

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
Explorer ,
Aug 26, 2024 Aug 26, 2024

Interestingly it is ONLY the addWatermark action that is having issues.  The rest of the CFPDF generation stuff seems to be perfectly fine.

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 ,
Aug 26, 2024 Aug 26, 2024

You can downgrade/upgrade packages via the package manager in the CF admin or via command line: https://helpx.adobe.com/au/coldfusion/using/coldfusion-package-manager.html

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 ,
Aug 27, 2024 Aug 27, 2024
LATEST
quote

I started receiving this error after the last update as well.  In my case, it seems to be triggered when trying to use something like this:
cfpdf action="addWatermark"

By @tonym64063353

 

It is unlikely  that <cfpdf action="addWatermark"> is the cause of the issue you saw. I have just tested the tag. it works as expected. My ColdFusion build is 2023.0.09.330677.

 

You can do the test yourself. Save the following code as addWatermark.cfm 

 

<cfset sourcefile="#expandPath('test.pdf')#">
<cfset destfile="#expandPath('test_watermark.pdf')#">

<cfpdf action="addwatermark" source="#sourcefile#"  
  destination="#destfile#" 
  image="image.jpg"
  pages="1"
  overwrite="yes">
  
  Watermark added.

 

I have attached the files - image.jpg and test.pdf - that I used. Place them within the same directory as addWatermark.cfm.

 

Launch the CFM file in a browser. Then ColdFusion should generate the watermarked file, test_watermark.pdf, within the same directory. The attached test_watermark.pdf was the result of my test.

 

Let me repeat another test which I suggested earlier:

<cfscript>
imageObj = createobject("java","coldfusion.image.Image");
writedump(imageObj);	
</cfscript>

It is the most obvious test, given the exception 

java.lang.NoClassDefFoundError: coldfusion/image/Image

Yet no one has picked up on the suggestion.

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 ,
Aug 26, 2024 Aug 26, 2024

Can any of you (who are experiencing the sort of problems here) consider what I'd written as the 2nd point of my March 22 comment above?

 

In brief, check if your update log ends with any indication of package updates to be performed. And if so, then in the coldfusion-out.log of the next startup (after the update), are there indications of package updates being done? And are there any errors there? If so, that could be where your problem begins. 

 

And even if there are no errors there, can you confirm that the package versions being installed match the update you applied? For instance, if you applied update 13 (of cf2021), does it show applying updates for update 14, etc? That would be another problem. 


/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