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.

Wed Jun 29, 2022 8:04 am

java -jar spiredoc.jar dummy.docx
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.NoClassDefFoundError: sun.security.x509.X509CertImpl
at com.spire.doc.Document.<clinit>(Unknown Source)
at com.ibm.port.scanner.SpireDoc.main(SpireDoc.java:29)
... 5 more
Caused by: java.lang.ClassNotFoundException: sun.security.x509.X509CertImpl
at java.net.URLClassLoader.findClass(URLClassLoader.java:610)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:945)
at java.lang.ClassLoader.loadClass(ClassLoader.java:890)
at java.lang.ClassLoader.loadClass(ClassLoader.java:873)
... 7 more

java -version
java version "1.8.0_311"
Java(TM) SE Runtime Environment (build 8.0.7.0 - pap6480sr7-20211025_01(SR7))
IBM J9 VM (build 2.9, JRE 1.8.0 AIX ppc64-64-Bit Compressed References 20211022_15212 (JIT enabled, AOT enabled)
OpenJ9 - 6abb372
OMR - b898db9
IBM - 2f2c48b)
JCL - 20210930_01 based on Oracle jdk8u311-b11

Works ok on Windows Java 8
java -version
java version "1.8.0_271"
Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.271-b09, mixed mode)

Spire Doc jar being used: spire.doc.free-5.2.0.jar

john.lee
 
Posts: 4
Joined: Wed Jun 29, 2022 5:18 am

Thu Jun 30, 2022 5:49 am

Hello John,

Thanks for your inquiry.

I searched in our bug track system for this exception and found that we resolved it in previous releases. But since we only maintain the free version from time to time, the update frequency is low. So most likely this fix was not added to the free version.
I recommend you to download our latest commercial version for testing and verification. If this issue persists, please provide us with your test code and documents (if any). You can upload them here or send them to us via mail (support@e-iceblue.com). Thank you for your understanding and assistance.
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Thu Jun 30, 2022 10:07 pm

Hi,
Tried to use latest commercial version of Spiredoc but looks like it has dependency on Xserver. We will use SpireDoc in batch and we cannot run with Xserver.
The trial code I have written is simple. Just this piece of code Document document = new Document(fileName);
Without Xserver it just hangs I presume trying to connect to Xserver.
Xlib: connection to "localhost:10.0" refused by server
Xlib: PuTTY X11 proxy: unable to connect to forwarded X server: Network error: Connection refused

Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.awt.AWTError: Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:79)
at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:140)
at java.security.AccessController.doPrivileged(AccessController.java:682)
at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:88)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:333)
at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:114)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:93)
at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:145)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:333)
at java.awt.Toolkit$2.run(Toolkit.java:871)
at java.awt.Toolkit$2.run(Toolkit.java:866)
at java.security.AccessController.doPrivileged(AccessController.java:682)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:865)
at com.spire.doc.packages.sprazr.spr??(Unknown Source)
at com.spire.doc.packages.sprvgv.<clinit>(Unknown Source)
at com.spire.doc.packages.sprqpv.spr??(Unknown Source)
at com.spire.doc.Background.<init>(Unknown Source)
at com.spire.doc.Document.spr??(Unknown Source)
at com.spire.doc.Document.<init>(Unknown Source)
at com.spire.doc.Document.<init>(Unknown Source)
at com.ibm.port.scanner.SpireDoc.main(SpireDoc.java:29)

John Lee

john.lee
 
Posts: 4
Joined: Wed Jun 29, 2022 5:18 am

Fri Jul 01, 2022 10:29 am

Hi John,

Thanks for your reply.

Spire.Doc doesn't depend on XServer, but based on the bug tracking information you provided, it seems to be the opposite. I tested but I could not reproduce it locally. I think it might be a problem that occurs in a special environment, and we didn't notice it. To help us reproduce and investigate this issue, could you please provide some of your testing steps? Including how to set up a test environment similar to yours (it would be better if there is a related tutorial). Thanks in advance for your assistance.
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Sun Jul 03, 2022 9:35 pm

Do you have access to AIX? It is easy to reproduce. Just use putty to ssh to LPAR and run the simple code. Some Java graphics component
in AWT package is being referenced so it will try to use XServer to start graphics component.
Thanks.
John Lee

john.lee
 
Posts: 4
Joined: Wed Jun 29, 2022 5:18 am

Mon Jul 04, 2022 10:23 am

Hi John,

I cannot access to AIX as we do not have that OS. I've tried searching the web for tutorials on installing this system, but to no avail. Since my native language is not English, it was also a big obstacle for me. Please forgive my sluggishness.
But I got a possible solution from my colleagues. When you run a java project, add an argument to the command to ignore java's search for graphical components. Here are the reference commands and hope it works.
Code: Select all
java -Djava.awt.headless=true -jar YourProjectName.jar
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Mon Jul 04, 2022 10:05 pm

Hi
It is working with -Djava.awt.headless=true. Any chance the free version will get upgraded to fix x509 error?
We can close this. Thanks for your help.
John Lee

john.lee
 
Posts: 4
Joined: Wed Jun 29, 2022 5:18 am

Tue Jul 05, 2022 8:31 am

Hi John,

Glad to know the solution works.

Regarding the free version, I'm sorry that we only maintain it from time to time. So I can't tell whether and when it will be fixed in the free version. Hope you can understand.
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Return to Spire.Doc