We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Words.Aspose for Java crashes on RHEL Linux when converting Word Doc to TIF

We are attempting to open a Word Doc and convert it to TIF using Aspose.Words for Java with little luck.

Code Snippet:

/* Convert the document */
Document wordDoc = new Document(serverFilePath);
								
String convertedfileExtension = ".TIF";
					
String convertedFilename = "12345678" + convertedfileExtension;
					
String convertedServerPath = "/home/user/" + convertedFilename;

/* Attempt to convert the document to the destination format  */
try {
	if (convertedfileExtension.equals(".TIF")) {
		ImageSaveOptions options = new ImageSaveOptions(SaveFormat.TIFF);
		options.setTiffCompression(TiffCompression.CCITT_4);
		options.setResolution(300);
						
		wordDoc.save(convertedServerPath, options);
	}
...

This code is executed from a fat Jar File. When executing it on the RHEL server, it crashes with the below stacktrace:

Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.util.ServiceConfigurationError: javax.imageio.spi.ImageReaderSpi: Provider com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReaderSpi could not be instantiated: java.lang.IllegalArgumentException: vendorName == null!
        at java.util.ServiceLoader.fail(ServiceLoader.java:224)
        at java.util.ServiceLoader.access$100(ServiceLoader.java:181)
        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:377)
        at java.util.ServiceLoader$1.next(ServiceLoader.java:445)
        at javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(IIORegistry.java:210)
        at javax.imageio.spi.IIORegistry.<init>(IIORegistry.java:138)
        at javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:159)
        at javax.imageio.ImageIO.<clinit>(ImageIO.java:65)
        at asposewobfuscated.zzYC.zzZs(Unknown Source)
        at asposewobfuscated.zzYC.zzT(Unknown Source)
        at asposewobfuscated.zzYC.<init>(Unknown Source)
        at asposewobfuscated.zzR4.zzX(Unknown Source)
        at asposewobfuscated.zzR4.zzZ(Unknown Source)
        at asposewobfuscated.zz0.zzZ(Unknown Source)
        at asposewobfuscated.zzC.zzZ(Unknown Source)
        at asposewobfuscated.zzG.zzZ(Unknown Source)
        at asposewobfuscated.zzC.zzZ(Unknown Source)
        at asposewobfuscated.zzG.zzZ(Unknown Source)
        at asposewobfuscated.zzC.zzZ(Unknown Source)
        at asposewobfuscated.zz2.zzZ(Unknown Source)
        at asposewobfuscated.zzC.zzZ(Unknown Source)
        at asposewobfuscated.zz2.zzZ(Unknown Source)
        at asposewobfuscated.zzC.zzZ(Unknown Source)
        at asposewobfuscated.zzG.zzZ(Unknown Source)
        at asposewobfuscated.zzC.zzZ(Unknown Source)
        at asposewobfuscated.zzG.zzZ(Unknown Source)
        at asposewobfuscated.zzC.zzZ(Unknown Source)
        at asposewobfuscated.zzG.zzZ(Unknown Source)
        at asposewobfuscated.zzC.zzZ(Unknown Source)
        at asposewobfuscated.zzZU.zzZ(Unknown Source)
        at asposewobfuscated.zzC.zzZ(Unknown Source)
        at asposewobfuscated.zzG.zzZ(Unknown Source)
        at asposewobfuscated.zzR4.zzZ(Unknown Source)
        at com.aspose.words.zzZ14.zzZoa(Unknown Source)
        at com.aspose.words.zzZ14.zzZ(Unknown Source)
        at com.aspose.words.zzZOJ.zzIN(Unknown Source)
        at com.aspose.words.zzZOJ.zzX(Unknown Source)
        at com.aspose.words.zzZOJ.zzZ(Unknown Source)
        at com.aspose.words.zzZI3.zzZ(Unknown Source)
        at com.aspose.words.Document.zzZ(Unknown Source)
        at com.aspose.words.Document.zzZ(Unknown Source)
        at com.aspose.words.Document.save(Unknown Source)
        at com.curtisswright.documentconversion.ConvertStagedDocuments.main(ConvertStagedDocuments.java:148)
        ... 5 more
Caused by: java.lang.IllegalArgumentException: vendorName == null!
        at javax.imageio.spi.IIOServiceProvider.<init>(IIOServiceProvider.java:76)
        at javax.imageio.spi.ImageReaderWriterSpi.<init>(ImageReaderWriterSpi.java:231)
        at javax.imageio.spi.ImageReaderSpi.<init>(ImageReaderSpi.java:212)
        at com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReaderSpi.<init>(CLibJPEGImageReaderSpi.java:80)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        at java.lang.Class.newInstance(Class.java:374)
        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:373)
        ... 45 more

We are using a Linux server with Red Hat Enterprise Linux Server release 6.6 (Santiago) and Oracle Java JDK 1.7.40.
We are using aspose-words-17.8-jdk16.jar for the TIF conversion.

We have tried explicitly adding the following fields to our Manifest without luck:
Specification-Title
Specification-Version
Specification-Vendor
Implementation-Title
Implementation-Version
Implementation-Vendor

@scott.kresge,

Have you tried the latest version of Aspose.Words for Java i.e. 17.9?

In case the problem still remains, please ZIP and attach your input Word document you are getting this problem with here for testing. We will investigate the issue on our end and provide you more information.

@awais.hafeez,

We updated to 17.9 this morning and it still fails with the same error. Attached is a zip containing a document that fails. It appears that only documents with images in them fail. Unfortunately, all of the documents that we will need to convert will have some sort of image in them. test_document.zip (180.4 KB)

@scott.kresge,

Please install JAI to correctly render to TIFF images with Aspose.Words for Java:

System Requirements
Installing the native JAI and ImageIO

@awais.hafeez,

We did follow the steps for Installing native JAI on Linux. The library will not allow TIF conversion without these. It returns a specific error if they are not installed.

Per the provided instructions we have placed:
jai_codec.jar, jai_core.jar, jai_imageio.jar, clibwrapper_jiio.jar, and mlibwrapper_jai.jar under $JAVA_HOME/jre/lib/ext/
libclib_jiio.so and libmlib_jai.so under $JAVA_HOME/jre/lib/amd64/

We used the libraries from the Aspose site. They are the ones that are failing.

@scott.kresge,

After an initial test with Aspose.Words for Java 17.9, we were unable to reproduce this issue on our end. We tested by configuring JAI (see Installing Native JAI and ImageIO on Linux) on a fresh Ubuntu 12.04 LTS (i386) VM. Our test Java version was java-7-oracle (32-bit 1.7). What Java version are you currently using?

@awais.hafeezm

We are using Oracle Java 1.7.40 64 bit.

@scott.kresge,

We will prepare the required platform to simulate the environment as that of yours. As soon as everything is setup, we will test your scenario and post the results here for your kind reference. We apologize for any inconvenience.

@scott.kresge,

We have tested your scenario over 64-bit Ubuntu 16.04.3 LTS by using Oracle Java 1.7.40 (64-bit) but I am afraid we are still unable to reproduce this issue with Aspose.Words for Java 17.9 on our end. Can you please try creating a standalone Java console application and list the steps here for our reference to reproduce the same issue on our end? Thanks for your cooperation.

@awais.hafeez,

I have created a standalone java console application. It contains only the Aspose.Words 17.9 dependency. This simple program still fails convert a Word Doc to Tiff on our server. I attempted to attach is a zip of the jar, our test document, and the Java code behind it. It will not upload.

Below is our Java version and paths to the JAI libraries. Please review and let us know if we are missing anything.

$ java -version
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

$ cd /usr/lib/jvm/jdk1.7.0_40/jre/lib/amd64
[user amd64]$ ls -ltr
total 39032
-rwxr-xr-x. 1 root root    49167 Aug 25  2013 libprism-es2.so
-rwxr-xr-x. 1 root root 25801344 Aug 25  2013 libjfxwebkit.so
-rwxr-xr-x. 1 root root   236498 Aug 25  2013 libjfxmedia.so
-rwxr-xr-x. 1 root root   247568 Aug 25  2013 libjavafx-iio.so
-rwxr-xr-x. 1 root root   411640 Aug 25  2013 libjavafx-font.so
-rwxr-xr-x. 1 root root  1373712 Aug 25  2013 libgstreamer-lite.so
-rwxr-xr-x. 1 root root   465256 Aug 25  2013 libgstplugins-lite.so
-rwxr-xr-x. 1 root root   205366 Aug 25  2013 libglass.so
-rwxr-xr-x. 1 root root   152593 Aug 25  2013 fxplugins.so
-rwxr-xr-x. 1 root root    52543 Aug 25  2013 fxavcodecplugin-53.so
-rwxr-xr-x. 1 root root    52298 Aug 25  2013 fxavcodecplugin-52.so
-rwxr-xr-x. 1 root root      677 Aug 27  2013 jvm.cfg
drwxr-xr-x. 2 root root     4096 Aug 27  2013 xawt
-rwxr-xr-x. 1 root root    65437 Aug 27  2013 libverify.so
-rwxr-xr-x. 1 root root   488371 Aug 27  2013 libt2k.so
-rwxr-xr-x. 1 root root   256462 Aug 27  2013 libsunec.so
-rwxr-xr-x. 1 root root   417386 Aug 27  2013 libsplashscreen.so
-rwxr-xr-x. 1 root root    51461 Aug 27  2013 libsaproc.so
-rwxr-xr-x. 1 root root    15803 Aug 27  2013 libnpt.so
-rwxr-xr-x. 1 root root   110009 Aug 27  2013 libnet.so
-rwxr-xr-x. 1 root root   910964 Aug 27  2013 libmlib_image.so
-rwxr-xr-x. 1 root root   270706 Aug 27  2013 libjdwp.so
-rwxr-xr-x. 1 root root    79429 Aug 27  2013 libJdbcOdbc.so
-rwxr-xr-x. 1 root root     7013 Aug 27  2013 libjawt.so
-rwxr-xr-x. 1 root root    25798 Aug 27  2013 libjava_crw_demo.so
-rwxr-xr-x. 1 root root    77390 Aug 27  2013 libj2pkcs11.so
-rwxr-xr-x. 1 root root    44661 Aug 27  2013 libj2gss.so
-rwxr-xr-x. 1 root root   502188 Aug 27  2013 libfontmanager.so
-rwxr-xr-x. 1 root root   207475 Aug 27  2013 libdcpr.so
-rwxr-xr-x. 1 root root   777284 Aug 27  2013 libawt.so
-rwxr-xr-x. 1 root root    16029 Aug 27  2013 libattach.so
-rwxr-xr-x. 1 root root   123434 Aug 27  2013 libzip.so
-rwxr-xr-x. 1 root root   148049 Aug 27  2013 libunpack.so
-rwxr-xr-x. 1 root root    28103 Aug 27  2013 libsctp.so
-rwxr-xr-x. 1 root root    91178 Aug 27  2013 libnio.so
-rwxr-xr-x. 1 root root    45842 Aug 27  2013 libmanagement.so
-rwxr-xr-x. 1 root root   397414 Aug 27  2013 libkcms.so
-rwxr-xr-x. 1 root root     7350 Aug 27  2013 libjsound.so
-rwxr-xr-x. 1 root root    81058 Aug 27  2013 libjsoundalsa.so
-rwxr-xr-x. 1 root root    10940 Aug 27  2013 libjsig.so
-rwxr-xr-x. 1 root root    11630 Aug 27  2013 libjsdt.so
-rwxr-xr-x. 1 root root   263985 Aug 27  2013 libjpeg.so
-rwxr-xr-x. 1 root root    20318 Aug 27  2013 libjfr.so
-rwxr-xr-x. 1 root root   219639 Aug 27  2013 libjava.so
-rwxr-xr-x. 1 root root     7746 Aug 27  2013 libjaas_unix.so
-rwxr-xr-x. 1 root root    14946 Aug 27  2013 libj2pcsc.so
-rwxr-xr-x. 1 root root    49525 Aug 27  2013 libinstrument.so
-rwxr-xr-x. 1 root root   174807 Aug 27  2013 libhprof.so
-rwxr-xr-x. 1 root root    22342 Aug 27  2013 libdt_socket.so
drwxr-xr-x. 2 root root     4096 Aug 27  2013 headless
-rwxr-xr-x. 1 root root   205080 Aug 27  2013 libnpjp2.so
-rwxr-xr-x. 1 root root    82977 Aug 27  2013 libjavaplugin_jni.so
-rwxr-xr-x. 1 root root   157531 Aug 27  2013 libdeploy.so
drwxr-xr-x. 2 root root     4096 Aug 27  2013 server
drwxr-xr-x. 2 root root     4096 Sep 10 03:18 jli
**-rwxr-xr-x. 1 root root  3059428 Sep 12 11:47 libmlib_jai.so**
**-rwxr-xr-x. 1 root root  1254944 Sep 12 11:50 libclib_jiio.so**

$ cd /usr/lib/jvm/jdk1.7.0_40/jre/lib/ext
[user ext]$ ls -ltr
total 4280
-rw-r--r--. 1 root root   15943 Aug 27  2013 sunec.jar
-rw-r--r--. 1 root root  238472 Aug 27  2013 sunpkcs11.jar
-rw-r--r--. 1 root root    8934 Aug 27  2013 dnsns.jar
-rw-r--r--. 1 root root  198348 Aug 27  2013 sunjce_provider.jar
-rw-r--r--. 1 root root   68756 Aug 27  2013 zipfs.jar
-rw-r--r--. 1 root root     581 Aug 27  2013 meta-index
-rw-r--r--. 1 root root 1024028 Aug 27  2013 localedata.jar
-**rwxr-xr-x. 1 root root  203110 Sep 12 11:46 jai_codec.jar**
**-rwxr-xr-x. 1 root root 1431422 Sep 12 11:46 jai_core.jar**
**-rwxr-xr-x. 1 root root   38495 Sep 12 11:46 mlibwrapper_jai.jar**
**-rwxr-xr-x. 1 root root   61979 Sep 12 11:50 clibwrapper_jiio.jar**
**-rwxr-xr-x. 1 root root 1063957 Sep 12 11:50 jai_imageio.jar**

I created FileConversionDemo.jar. Since I can’t upload the attachment. The Java code is to follow.
This runnable jar file takes two parameters:

  1. Directory of the input/output file (i.e. /home/user/)
  2. File to convert (i.e. testdocument.docx)

Results:

[user asposedemo]$ java -jar FileConversionDemo.jar /home/user/asposedemo/ DEMODOC.DOCX
Successfully loaded licenses.
Successfully found File '/home/nimsap1/asposedemo/DEMODOC.DOCX'.
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.util.ServiceConfigurationError: javax.imageio.spi.ImageInputStreamSpi: Provider com.sun.media.imageioimpl.stream.ChannelImageInputStreamSpi could not be instantiated: **java.lang.IllegalArgumentException: vendorName == null!**
        at java.util.ServiceLoader.fail(ServiceLoader.java:224)
        at java.util.ServiceLoader.access$100(ServiceLoader.java:181)
        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:377)
        at java.util.ServiceLoader$1.next(ServiceLoader.java:445)
        at javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(IIORegistry.java:210)
        at javax.imageio.spi.IIORegistry.<init>(IIORegistry.java:138)
        at javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:159)
        at javax.imageio.ImageIO.<clinit>(ImageIO.java:65)
        at asposewobfuscated.zzYC.zzZs(Unknown Source)
        at asposewobfuscated.zzYC.zzT(Unknown Source)
        at asposewobfuscated.zzYC.zzT(Unknown Source)
        at asposewobfuscated.zzYC.zzK(Unknown Source)
        at asposewobfuscated.zzNX.zzZY(Unknown Source)
        at com.aspose.words.zzDI.zzaS(Unknown Source)
        at com.aspose.words.zzDI.zzfo(Unknown Source)
        at com.aspose.words.zzDG.zzZ(Unknown Source)
        at com.aspose.words.zzAE.zzH(Unknown Source)
        at com.aspose.words.zzAE.zzZ(Unknown Source)
        at com.aspose.words.zzCD.zzZ(Unknown Source)
        at com.aspose.words.zzCD.zzZ(Unknown Source)
        at com.aspose.words.zzZMP.zzX(Unknown Source)
        at com.aspose.words.zzZMP.zzY(Unknown Source)
        at com.aspose.words.zzYXU.getSize(Unknown Source)
        at com.aspose.words.zzYXU.zzZiK(Unknown Source)
        at com.aspose.words.zzYXT.getWidth(Unknown Source)
        at com.aspose.words.zzYXV.zzrR(Unknown Source)
        at com.aspose.words.zzYYS.getWidth(Unknown Source)
        at com.aspose.words.zzZM5.zzVX(Unknown Source)
        at com.aspose.words.zzZM5.zzVY(Unknown Source)
        at com.aspose.words.zzZM0.zzW(Unknown Source)
        at com.aspose.words.zzZM8.zzS(Unknown Source)
        at com.aspose.words.zzZM7.zzZ(Unknown Source)
        at com.aspose.words.zzVX.zzZ(Unknown Source)
        at com.aspose.words.zzYZ7.zzZ(Unknown Source)
        at com.aspose.words.zzXF.zztb(Unknown Source)
        at com.aspose.words.zzXF.zzY(Unknown Source)
        at com.aspose.words.zzZ8G.zzZvQ(Unknown Source)
        at com.aspose.words.zzZ8G.zzT(Unknown Source)
        at com.aspose.words.zzZ7S.zzx(Unknown Source)
        at com.aspose.words.zzYX9.zzRE(Unknown Source)
        at com.aspose.words.zz9E.zzXv(Unknown Source)
        at com.aspose.words.zz9F.zz5E(Unknown Source)
        at com.aspose.words.zzZN8.zzZ(Unknown Source)
        at com.aspose.words.Document.updatePageLayout(Unknown Source)
        at com.aspose.words.Document.zzXx(Unknown Source)
        at com.aspose.words.Document.zz6u(Unknown Source)
        at com.aspose.words.zzZOD.zzZ(Unknown Source)
        at com.aspose.words.zzZHX.zzZ(Unknown Source)
        at com.aspose.words.Document.zzZ(Unknown Source)
        at com.aspose.words.Document.zzZ(Unknown Source)
        at com.aspose.words.Document.save(Unknown Source)
        at asposedemo.Demo.main(Demo.java:83)
        ... 5 more
Caused by: java.lang.IllegalArgumentException: vendorName == null!
        at javax.imageio.spi.IIOServiceProvider.<init>(IIOServiceProvider.java:76)
        at javax.imageio.spi.ImageInputStreamSpi.<init>(ImageInputStreamSpi.java:90)
        at com.sun.media.imageioimpl.stream.ChannelImageInputStreamSpi.<init>(ChannelImageInputStreamSpi.java:37)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        at java.lang.Class.newInstance(Class.java:374)
        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:373)
        ... 54 more

@awais.hafeez,

I create a new Eclipse project named asposedemo with package asposedemo.
Inside the package is Demo.java and Aspose.Words.lic.
I created a libs folder with aspose-words-17.9-jdk16.jar file.
I added the Aspose jar to the build path.

Demo.java Contents:
package asposedemo;

import java.io.File;
import java.io.InputStream;

import com.aspose.words.Document;
import com.aspose.words.ImageSaveOptions;
import com.aspose.words.License;
import com.aspose.words.SaveFormat;
import com.aspose.words.TiffCompression;

public class Demo {

	public static void main(String[] args) {
		String filePath = null;
		String fileName = null;
		
		/* Validate Arguments */
		try {
			if (args.length == 2) {
				filePath = args[0].toString();
				fileName = args[1].toString();
			} else {
				throw new Exception();
			}
		} catch (Exception e) {
			System.out.println("Invalid Number of Command Line Arguments provided (expecting 3 arguments and received " + args.length + ")." );
			System.out.println("Argument 1: File Path");
			System.out.println("Argument 2: File Name");
			System.out.println("Exiting...");
			System.exit(1);
		}
		
		/* Load and verify the Aspose.Words License */
		License license = new License();
		String licenseFile = "Aspose.Words.lic";

		try {
			InputStream is = Demo.class.getResourceAsStream(licenseFile);
			license.setLicense(is);
		} catch (Exception le) {
			System.out.println("Error loading specified license file '" + licenseFile + "' with Exception" + le);
			System.out.println("Exiting...");
			System.exit(1);
		}
		
		/* Exit if the Library is not licensed to avoid conversion of only the first X pages */
		if (!license.isLicensed()) {

		    System.out.println("Error Aspose.Words is not Licensed!");
			System.out.println("Exiting...");
			System.exit(1);
		} else {
			System.out.println("Successfully loaded licenses.");
		}
		
		
		try {
			String serverFilePath = filePath + fileName;
			
			boolean exists = validateFile(serverFilePath);
			if (!exists) {
				throw new Exception("File '" + serverFilePath + "' does not exist.");
			} else {
				System.out.println("Successfully found File '" + serverFilePath + "'.");
			}
			
			/* Convert the document */
			Document wordDoc = new Document(serverFilePath);
			
			String convertedFilename = fileName.substring(0, fileName.lastIndexOf('.')) + ".TIF";
			
			String convertedServerPath = filePath + convertedFilename;
			
			try {

				ImageSaveOptions options = new ImageSaveOptions(SaveFormat.TIFF);
				options.setTiffCompression(TiffCompression.CCITT_4);
				options.setResolution(300);
				
				wordDoc.save(convertedServerPath, options);
				
				System.out.println("Converted " + serverFilePath + " to " + convertedServerPath +".");
								
			} catch(Exception e) {
				throw new Exception("Failed to convert Document " + serverFilePath + " from Word Doc to .TIF with error " + e.toString() + "!");
			}
	
			
		} catch (Exception e){
			System.out.println("Error occurred when processing File '" + fileName + "' Message:" + e);
		}
	}
	
	public static boolean validateFile(String filePath) {
		boolean exists = false;
		
		// Check that file is available.
		File file = new File(filePath);
		if (file.exists() || !file.isDirectory()) { 
			exists = true;
		}
		
		return exists;
	}

}

I then create a runnable jar file using Ant. The build.xml is below:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="create_run_jar" name="Create Runnable Jar for Project asposedemo with Jar-in-Jar Loader">
    <!--this file was created by Eclipse Runnable JAR file Export Wizard-->
    <!--ANT 1.7 is required-->
    <!--define folder properties-->
    <property name="dir.buildfile" value="."/>
    <property name="dir.workspace" value="${dir.buildfile}/.."/>
    <property name="dir.jarfile" value="C:/temp"/>
    <target name="create_run_jar">
        <jar destfile="${dir.jarfile}/FileConversionDemo.jar">
            <manifest>
            	<attribute name="Implementation-Vendor" value="Company"/>
            	<attribute name="Implementation-Title" value="Aspose Demo"/>
            	<attribute name="Implementation-Version" value="1.0"/>
            	<attribute name="Specification-Vendor" value="Company"/>
            	<attribute name="Specification-Title" value="Aspose Demo"/>
            	<attribute name="Specification-Version" value="1.0"/>
                <attribute name="Main-Class" value="org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader"/>
                <attribute name="Rsrc-Main-Class" value="asposedemo.Demo"/>
                <attribute name="Class-Path" value="."/>
                <attribute name="Rsrc-Class-Path" value="./ aspose-words-17.9-jdk16.jar"/>
            </manifest>
            <zipfileset src="jar-in-jar-loader.zip"/>
            <fileset dir="${dir.buildfile}/bin"/>
            <zipfileset dir="${dir.buildfile}/libs" includes="aspose-words-17.9-jdk16.jar"/>
        </jar>
    </target>
</project>

Next I upload the Jar file to the server and try to run it using the Word Doc originally provided.

@scott.kresge,

Thanks for the additional information. Do you only observe this exception with one particular document (234299552.DOCX) or every document you try to convert to TIFF causes the same exception on your end? Do you have any other machine you can test the same scenario on? Also, if you are unable to upload your project here, please ZIP and upload your test project to Dropbox and share the download link here for further investigation.

@awais.hafeez,

We observe this behavior with any document that contains an image (i.e. JPEG, PNG, etc.). All of the documents that we need to convert follow the same template. The last page will always be an image. The document I provided to you was just a test document we created to give you a sample to work with. I will work on trying to get you a copy of the project. The demo project is extremely simple. See attached screenshot.

Capture.PNG (10.6 KB)

@awais.hafeez,

Can you provide me a email address I can send the files to? We can’t use Dropbox. We have a secure file transfer protocol we can use to get you the zip of the project.

@awais.hafeez,

We have tried this on multiple servers with the same issue. We have also tried OpenJDK as an alternate Java and still see the problem. We have tried 64bit and 32bit Java and it still fails with both. We are running out of things to try on our end. Do you have any suggestions? Can you review where we placed the JAI libraries and how we are building the Jar file? The project we planned on using this for is currently in UAT and this is holding up our testing currently.

@scott.kresge,

Please send your Project and runnable JAR to the following email:

@awais.hafeez,

You should have received a download email with a zip named FileConversionDemo.zip. Please let us know if you need anything further. I can provide files through email that are larger than the 3MB file upload size in the forum.

@scott.kresge,

We have received FileConversionDemo.zip. We are working over your query and will get back to you soon.

@scott.kresge,

We tested the scenario and have managed to reproduce the same problem on our end. For the sake of any correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSJAVA-1658. Our product team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.

@scott.kresge,

Regarding WORDSJAVA-1658, our product team has completed the work on your issue and has come to a conclusion that this issue and the undesired behavior you are observing is actually not a bug in Aspose.Words for Java. So, we will close this issue as ‘Not a Bug’.

This issue is not even related to Unix based systems. The same issue is reproducible on Windows.

The main problem is Eclipse’s jarinjarloader. We found a few mentions of this problem:

https://stackoverflow.com/a/18495658/517806,
https://stackoverflow.com/a/16495807/517806, https://github.com/geoHeil/jai-packaging-problem,
https://github.com/nguyenq/tess4j/issues/12,
https://thierrywasyl.wordpress.com/2009/07/24/jai-how-to-solve-vendorname-null-exception/

We have tested all of them and none of them solves this particular problem.

We found only one working solution so far i.e. avoid using “fat jar”.

Please create a “simple” jar instead and add “Aspose Words for Java” and “JAI” JARs to the classpath.