Free Support Forum - aspose.com

Linux: Unable to convert Visio Diagram to JPEG

Hello!


I am able to convert the attached Visio diagram to a PNG locally on my Mac, however, am not able to once the code is deployed out to our Linux server.

The error is as follows:
java.lang.IllegalStateException: Cannot find resource {0}.
at com.aspose.diagram.a.c.q.a(Unknown Source) ~[aspose-diagram-2.0.0.jar:2.0.0.0]
at com.aspose.diagram.a.d.bb.i(Unknown Source) ~[aspose-diagram-2.0.0.jar:2.0.0.0]
at com.aspose.diagram.a.d.bb.g(Unknown Source) ~[aspose-diagram-2.0.0.jar:2.0.0.0]
at com.aspose.diagram.a.d.bb.d(Unknown Source) ~[aspose-diagram-2.0.0.jar:2.0.0.0]
at com.aspose.diagram.a.d.bd.a(Unknown Source) ~[aspose-diagram-2.0.0.jar:2.0.0.0]
at com.aspose.diagram.a.d.bd.a(Unknown Source) ~[aspose-diagram-2.0.0.jar:2.0.0.0]
at com.aspose.diagram.a.d.bd.a(Unknown Source) ~[aspose-diagram-2.0.0.jar:2.0.0.0]
at com.aspose.diagram.hr.(Unknown Source) ~[aspose-diagram-2.0.0.jar:2.0.0.0]
at com.aspose.diagram.es.a(Unknown Source) ~[aspose-diagram-2.0.0.jar:2.0.0.0]
at com.aspose.diagram.es.a(Unknown Source) ~[aspose-diagram-2.0.0.jar:2.0.0.0]
at com.aspose.diagram.es.a(Unknown Source) ~[aspose-diagram-2.0.0.jar:2.0.0.0]
at com.aspose.diagram.es.a(Unknown Source) ~[aspose-diagram-2.0.0.jar:2.0.0.0]
at com.aspose.diagram.kb.a(Unknown Source) ~[aspose-diagram-2.0.0.jar:2.0.0.0]
at com.aspose.diagram.kb.a(Unknown Source) ~[aspose-diagram-2.0.0.jar:2.0.0.0]
at com.aspose.diagram.Diagram.a(Unknown Source) ~[aspose-diagram-2.0.0.jar:2.0.0.0]
at com.aspose.diagram.Diagram.save(Unknown Source) ~[aspose-diagram-2.0.0.jar:2.0.0.0]

The resource missing is not in the error message. Any tips?

Code:
Diagram diagram = new Diagram(inputStream);

ImageSaveOptions imageSaveOptions = new ImageSaveOptions(4);
imageSaveOptions.setPageIndex(0);

// Create a temporary file to hold the image
File tempFile = File.createTempFile(ThumbnailServiceUtil.TEMP_FILE_NAME + “_vsd”, “.png”);
FileOutputStream outputStream = new FileOutputStream(tempFile);

// Save the thumbnail image to the tempFile
diagram.save(outputStream, imageSaveOptions);

Thanks!
Hi Staci,

Thank you for contacting support. We've noticed that you are using an old version of Aspose.Diagram for Java 2.0.0 in the provided details. Please try using the latest version of Aspose.Diagram for Java 2.2.0 and let us know how it goes on your side. Please refer to the download page:
http://www.aspose.com/community/files/72/java-components/diagram-java/default.aspx

In case, it fails with the latest version, then please provide us the environment details where you are facing this problem, i.e. Mac Operating System (version), IDE (Eclipse, Netbeans etc.), Application type, JDK version. We'll investigate this issue at our end and guide you accordingly. This will help us to replicate the problem on our side.

Hello!


I’m currently using your Maven repository in my Maven project to import the 2.2.0 version of aspose-diagram.

I’m getting the following error when running the code in my first comment:
java.lang.NoClassDefFoundError: com/ice/jni/registry/RegistryKey
at com.aspose.diagram.a.d.bb.a(Unknown Source)
at com.aspose.diagram.a.d.bb.c(Unknown Source)
at com.aspose.diagram.a.d.bb.(Unknown Source)
at com.aspose.diagram.a.d.bb.(Unknown Source)
at com.aspose.diagram.hs.(Unknown Source)
at com.aspose.diagram.et.a(Unknown Source)
at com.aspose.diagram.et.a(Unknown Source)
at com.aspose.diagram.et.a(Unknown Source)
at com.aspose.diagram.et.a(Unknown Source)
at com.aspose.diagram.et.a(Unknown Source)
at com.aspose.diagram.kc.a(Unknown Source)
at com.aspose.diagram.kc.a(Unknown Source)
at com.aspose.diagram.Diagram.a(Unknown Source)
at com.aspose.diagram.Diagram.save(Unknown Source)
… more
Caused by: java.lang.ClassNotFoundException: com.ice.jni.registry.RegistryKey
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
… 44 more

Dependency is set up in my pom.xml as follows:
com.aspose
aspose-diagram
2.2.0
compile

If I switch the version to 2.1.0 in my pom file, the error does not occur and the image is generated appropriately. If I replace the 2.2.0 jar from your maven repo with the one downloaded from your link http://www.aspose.com/community/files/72/java-components/diagram-java/default.aspx, the image is successfully generated again (on my Mac, have not re-tested my original issue on Linux yet).

I think there is an issue with the aspose-diagram lib your Maven repo for v2.2.0.

As mentioned in my previous post, the 2.2.0 jar from your Maven repo was not working properly.


So, I updated our jar to 2.2.0 using the version from http://www.aspose.com/community/files/72/java-components/diagram-java/entry567774.aspx.

I’m still getting the same error on our Linux server with the code posted in my first post (running within a Java Spring web application):
java.lang.IllegalStateException: Cannot find resource {0}.
at com.aspose.diagram.a.c.q.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.a.d.bb.i(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.a.d.bb.g(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.a.d.bb.d(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.a.d.bd.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.a.d.bd.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.a.d.bd.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.hs.(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.et.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.et.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.et.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.et.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.kc.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.kc.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.Diagram.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.Diagram.save(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]

Java version:
java version "1.7.0_45"
Java™ SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot™ 64-Bit Server VM (build 24.45-b08, mixed mode)

OS info:
CentOS release 6.5
x86_64

It seems that perhaps your code is choking on missing fonts and is searching in “/usr/share/fonts”, “/usr/local/share/fonts”, “/usr/X11R6/lib/X11/fonts” directories? We do not have fonts installed on that server.

Hi Staci,


Thank you for providing us the details. I’m working to setup an environment and it will take a little time. I shall get back to you in a couple of days.

Sounds good, thanks!!

Hi Staci,

Thank you for being patient.
Staci:
I'm currently using your Maven repository in my Maven project to import the 2.2.0 version of aspose-diagram.

I'm getting the following error when running the code in my first comment:
java.lang.NoClassDefFoundError: com/ice/jni/registry/RegistryKey
at com.aspose.diagram.a.d.bb.a(Unknown Source)
at com.aspose.diagram.a.d.bb.c(Unknown Source)
at com.aspose.diagram.a.d.bb.(Unknown Source)
at com.aspose.diagram.a.d.bb.(Unknown Source)
at com.aspose.diagram.hs.(Unknown Source)
at com.aspose.diagram.et.a(Unknown Source)
at com.aspose.diagram.et.a(Unknown Source)
at com.aspose.diagram.et.a(Unknown Source)
at com.aspose.diagram.et.a(Unknown Source)
at com.aspose.diagram.et.a(Unknown Source)
at com.aspose.diagram.kc.a(Unknown Source)
at com.aspose.diagram.kc.a(Unknown Source)
at com.aspose.diagram.Diagram.a(Unknown Source)
at com.aspose.diagram.Diagram.save(Unknown Source)
... more
Caused by: java.lang.ClassNotFoundException: com.ice.jni.registry.RegistryKey
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 44 more

Dependency is set up in my pom.xml as follows:
com.aspose
aspose-diagram
2.2.0
compile
We managed to replicate this error message. We have logged this problem under ticket id DIAGRAMJAVA-50100 in our issue tracking system. Your request has also been linked to this. We'll keep you informed regarding any available updates.
Staci:
I'm still getting the same error on our Linux server with the code posted in my first post (running within a Java Spring web application):
java.lang.IllegalStateException: Cannot find resource {0}.
at com.aspose.diagram.a.c.q.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.a.d.bb.i(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.a.d.bb.g(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.a.d.bb.d(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.a.d.bd.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.a.d.bd.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.a.d.bd.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.hs.(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.et.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.et.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.et.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.et.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.kc.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.kc.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.Diagram.a(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]
at com.aspose.diagram.Diagram.save(Unknown Source) ~[aspose-diagram-2.2.0.jar:2.2.0.0]

Java version:
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

OS info:
CentOS release 6.5
x86_64

It seems that perhaps your code is choking on missing fonts and is searching in "/usr/share/fonts", "/usr/local/share/fonts", "/usr/X11R6/lib/X11/fonts" directories? We do not have fonts installed on that server.
We have tested your sample code on a Ubuntu 13.10. It's working fine. Please install Microsoft basic fonts using this command "sudo apt-get install ttf-mscorefonts-installer" and test again. We hope, this helps.

The issues you have found earlier (filed as DIAGRAMJAVA-50100) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.