Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Mon Apr 22, 2024 11:47 am

Hello,

when I load attached signed docx, I got jdk error

Code: Select all
java.lang.NoSuchMethodError: 'void com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer20010315OmitComments.setWriter(java.io.OutputStream)'


I am loading it using Spire.doc latest (spire.doc-12.4.6). I tried multiple methods for loading, everything works the same.

I am using this jdk version, but the error is the same on almost all of the corretto 11 versions. Looks like xmlsec in jdk does not have a method on Canonicalizer class.

Code: Select all
openjdk 11.0.22 2024-01-16 LTS
OpenJDK Runtime Environment Corretto-11.0.22.7.1 (build 11.0.22+7-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.22.7.1 (build 11.0.22+7-LTS, mixed mode)


Is there a reccomended jdk version for running spire.doc?

Thanks.

Jan

jan.zanda
 
Posts: 30
Joined: Wed Mar 06, 2024 11:30 am

Tue Apr 23, 2024 2:48 am

Hi,

Thanks for your inquiry.
According to the message you mentioned. The Jdk you used is produced by AWS, so are you using Spire.Doc in AWS project?
Our Spire.Doc can run in open jdk8 and above. But for the jdk version of corretto 11, I am not very sure.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Tue Apr 23, 2024 7:21 am

Hi,

no, I am using it standalone, corretto 11 is version of openjdk supported by amazon.

https://docs.aws.amazon.com/corretto/la ... -list.html

I verified it on openjdk11 and I have the same result. Can you please verify it on your side?

Code: Select all
openjdk 11.0.23 2024-04-16
OpenJDK Runtime Environment Homebrew (build 11.0.23+0)
OpenJDK 64-Bit Server VM Homebrew (build 11.0.23+0, mixed mode)

java.lang.NoSuchMethodError: 'void com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer20010315OmitComments.setWriter(java.io.OutputStream)'


Thanks.

jan.zanda
 
Posts: 30
Joined: Wed Mar 06, 2024 11:30 am

Tue Apr 23, 2024 8:46 am

Hi,

Thanks for your feedback.
According to the exception message, it seems that the exception have nothing to do with Spire.Doc, if you don’t use spire.doc, is this exception thrown?
In addition, I don’t find the download link of the jdk you used, could you share the download link. And please offer your system environment, such as Win10 or MacOs. Thanks in advance.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Tue Apr 23, 2024 9:29 am

Here is full spire exception stack:

Code: Select all
java.lang.NoSuchMethodError: 'void com.sun.org.apache.xml.internal.security.c14n.implementations.Canonicalizer20010315OmitComments.setWriter(java.io.OutputStream)'

   at com.spire.doc.packages.sprwdt.spr▊⅙(Unknown Source)
   at com.spire.doc.packages.sprekt.spr├‱(Unknown Source)
   at com.spire.doc.packages.sprekt.spr╆⅙(Unknown Source)
   at com.spire.doc.packages.sprekt.spr┯⅙(Unknown Source)
   at com.spire.doc.packages.sprekt.spr┚⅙(Unknown Source)
   at com.spire.doc.packages.sprekt.spr│⅙(Unknown Source)
   at com.spire.doc.packages.sprwrv.spr※∬—(Unknown Source)
   at com.spire.doc.packages.sprwrv.spr〧∬—(Unknown Source)
   at com.spire.doc.Document.spr‘┑—(Unknown Source)
   at com.spire.doc.Document.spr⑄┍—(Unknown Source)
   at com.spire.doc.Document.spr※┑—(Unknown Source)
   at com.spire.doc.Document.spr⅘┍—(Unknown Source)
   at com.spire.doc.Document.loadFromStream(Unknown Source)



Environment is macOS, windows 11, windows server, linux (everywhere the same exception, no matter if correto or openjdk is used).

OpenJDK I used is for macOS, installed by brew

jan.zanda
 
Posts: 30
Joined: Wed Mar 06, 2024 11:30 am

Tue Apr 23, 2024 9:51 am

Hi,

Thanks for your feedback.
Please offer the following information to help us do further investigation.
1) The code that can reproduce your issue.
2) The input word file, you can attach here or send it via email([email protected]).

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Tue Apr 23, 2024 10:00 am

1)
(useNewEngine is true, but false works the same)
Code: Select all
 //Create Document object
        Document doc = new Document(useNewEngine);
        //Load the file IS
        doc.loadFromStream(file, FileFormat.Auto);


2) Is attached to first post.

Thanks, Jan

jan.zanda
 
Posts: 30
Joined: Wed Mar 06, 2024 11:30 am

Wed Apr 24, 2024 3:05 am

Hi,

Thanks for your feedback.
I tested your scenario with the code and word file you provided, and I reproduced your issue, I have logged it into our bug track system with the ticket number SPIREDOC-10476. Our Dev team will investigate and fix it. Once it is resolved, I’ll inform you in time.
In addition, I tested your scenario with Jdk8、jdk12 and jdk13, no exception is thrown, you can have a try.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Thu Dec 12, 2024 11:27 am

Hello,

I just wanted to add that the same problem occurs on jdk 21, sadly. Is there any progress on this issue? Or workaround?

Thanks,
Jan

jan.zanda
 
Posts: 30
Joined: Wed Mar 06, 2024 11:30 am

Fri Dec 13, 2024 6:19 am

Hello Jan,

Thanks for your feedback.

I apologize that the investigation into issue SPIREDOC-10476 is not yet complete. To better understand whether your environmental issues are consistent with the causes of SPIREDOC-10476, please provide the following detailed information to assist us in our investigation:
1. Your system environment, for example, Windows 10 64-bit.
2. The full version number of your JDK 21, for example, 21.0.5.
3. Did you encounter the same exception when executing doc.loadFromFile(file)? Does this occur with all Word documents or only with certain documents?

We appreciate your assistance and cooperation.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3043
Joined: Wed Jun 27, 2012 8:50 am

Thu Nov 06, 2025 7:43 am

Sorry for late reply. I have not monitored this forum.

1. Your system environment, for example, Windows 10 64-bit.

all of them. Windows server 64 bit multiple version, macOS, linux

2. The full version number of your JDK 21, for example, 21.0.5.

any 21, it is the same on all of them. Your code seems to be using parts of xmlsec from santuario, but at java 21, the internal implementation takes over and there is no CanonicalizerBase.setWriter(outputStream) method.


3. Did you encounter the same exception when executing doc.loadFromFile(file)? Does this occur with all Word documents or only with certain documents?

Just a few, most of them work.

jan.zanda
 
Posts: 30
Joined: Wed Mar 06, 2024 11:30 am

Thu Nov 06, 2025 9:28 am

Hello,

Thank you for your reply.

Could you please provide us with more documents that can help reproduce this issue? This will allow us to verify the fix once it's completed.
Thanks!

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3043
Joined: Wed Jun 27, 2012 8:50 am

Fri Nov 28, 2025 8:04 am

Here are all the problematic files I currently have.
Thanks.

jan.zanda
 
Posts: 30
Joined: Wed Mar 06, 2024 11:30 am

Fri Nov 28, 2025 10:02 am

Hello,

Thank you for providing the additional documents. I have forwarded them to our development team for investigation and resolution.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3043
Joined: Wed Jun 27, 2012 8:50 am

Thu Mar 26, 2026 9:21 am

Hello,

Thank you for your patience. Glad to inform you that our latest version Spire.Doc for Java Version:14.3.5 includes fixes for SPIREDOC-10476 issue, please update and test it.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1533
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.Doc