Exception"Invoke failed" while generating thumbnails from PPTX using Aspose.Slides Java

Hi,

This is a code we have used for some time now but all of a sudden stopped working. Please see the code below:

The code basically gets a PPTX file and creates thumbnails out of the file. It all of a sudden stopped working yesterday. We’ve currently installed the latest version of ASPOSE.SLIDE Java 19.2, we’ve even rolled back to earlier versions, but same issue. See error details below the code.

include_once "../config/core.php";
require __DIR__ . '/../../vendor/autoload.php';
require_once("../../Java.inc");

$asposelicencepath = "licenspath/Aspose.Slides.lic";
//$license = new java("com.aspose.slides.License");
//$licensestream = $license->setLicense("/data/www/slidesorter/aspose/Aspose.Slides.lic");

//Create a stream object containing the license file
  //$fistream=new Java("java.io.FileInputStream","C:\\Aspose.Slides.Java.lic");

$license = new java("com.aspose.slides.License");
$fistream=new Java("java.io.FileInputStream",$asposelicencepath);
$licensestream = $license->setLicense($fistream);

# Instantiate Presentation class that represents the presentation file
$pres = new java('com.aspose.slides.Presentation', '/Users/apache-tomcat-8.5.37/htdocsfiles/LatestDigitalPIs.pptx');
# Access the first slide
$slide = $pres->getSlides()->get_Item(0);
# Create a full scale image
$image = $slide->getThumbnail();
# Save the image to disk in JPEG format
$ImageIO = new java('javax.imageio.ImageIO');


$ImageIO = new java('javax.imageio.ImageIO');
$ImageIO->write($image, 'jpg', "/Users/apache-tomcat-8.5.37/htdocsfiles/ContentBG_tnail.jpg");


Fatal error: Uncaught [[o:Exception]:“java.lang.Exception: Invoke failed: [[c:ImageIO]]->write((i:RenderedImage)[o:BufferedImage], (o:String)[o:String], (o:OutputStream)[o:String]). Cause: java.lang.IllegalArgumentException: argument type mismatch VM: 1.8.0_111@http://java.oracle.com/” at: #-10 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) #-9 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) #-8 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) #-7 java.lang.reflect.Method.invoke(Method.java:498) #-6 php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1068) #-5 php.java.bridge.parser.Request.handleRequest(Request.java:426) #-4 php.java.bridge.parser.Request.handleRequests(Request.java:509) #-3 php.java.bridge.http.ContextRunner.run(ContextRunner.java:143) #-2 php.java.bridge.util.ThreadPool$Delegate.run(ThreadPool.java:60) #-1 php.java.bridge.util.AppThreadPool$Delegate.run(AppThreadPool.java:58) #0 /Users/apache-tomcat-8.5.37/webapps/sl in /Users/j/apache-tomcat-8.5.37/webapps/slidesorter/Java.inc on line 224

@JediJide,

Can you please share source file along with complete environment details so that we may further investigate to help you out.

@JediJide

I have observed the sample code shared by you and there seems no issue in code. From exception message it seems that the issue is related to generation of slide thumbnail related to particular presentation slide. Can you please provide the source presentation as well so that we may investigate that on our end.

Environment:

  • Server: nginx/1.14.0 (Ubuntu 18)
  • PHP/Java Bridge
  • TomCat 8.5.37

Point to note is that this worked up until last week. @Adnan.Ahmad, this happening irrespective of the PPTXs, I even created a two page sample file, same issue persists.

Thanks,

@JediJide,

Can you please try to save image in PNG format. Also please try to change destination image file location. It may be some file system permission issues. I also like to inform that $ImageIO->write() - it is not an Aspose.Slides functionality. It is native java and this exception, is not related to our product.