Free Support Forum - groupdocs.com

Getting NullPointerException in Linux Ubuntu


#1

Hi. I’m trying to evaluate your Java Conversion Library. And it seems to work in Windows, but in Linux OS I’ve got exception in every example both toPdf and toPng conversion. This is the simple code:

Config config = new Config();
ConversionHandler conversionHandler = new ConversionHandler(config);
ImageSaveOptions imageSaveOptions = new ImageSaveOptions();
imageSaveOptions.setSaveFileType(ImageSaveOptions.PNG);

//Optional parameters
imageSaveOptions.setSaveName(“converted_page”);
imageSaveOptions.setSavePath(config.getFileSavePath());
imageSaveOptions.setWidth(600);
imageSaveOptions.setHeight(800);
//New parameter
imageSaveOptions.setAsListItems(true);


try {

ArrayList list = conversionHandler.convertToImage(“123.ppt”, imageSaveOptions);


} catch (InternalException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
This code is working in Windows OS, but when I run the same sample in Linux I get the exception:
Exception in thread “main” java.lang.ExceptionInInitializerError
at com.groupdocs.conversion.internal.c.a.s.ms.pbdb106a0.p6a2feef8.cG.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.ms.pbdb106a0.p6a2feef8.cG.(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.ms.pbdb106a0.p6a2feef8.cG.(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.cB.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.Xv.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.Xm.(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.Xm.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.Ji.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.Ji.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.IK.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.IK.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.IK.do(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.IK.(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.nY.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.nY.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.nY.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.x.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.cX.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.nh.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.nh.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.nh.getThumbnail(Unknown Source)
at L.a(Unknown Source)
at O.toImage(Unknown Source)
at ag.a(Unknown Source)
at com.groupdocs.conversion.handler.ConversionHandler.convertToImage(Unknown Source)
at com.groupdocs.conversion.handler.ConversionHandler.convertToImage(Unknown Source)
at converter.Converter.main(Converter.java:31)
Caused by: java.lang.NullPointerException
at com.groupdocs.conversion.internal.c.a.s.ms.pbdb106a0.p6a2feef8.p.do(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.ms.pbdb106a0.p6a2feef8.cG.c(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.ms.pbdb106a0.p6a2feef8.cG.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.ms.pbdb106a0.p6a2feef8.p.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.ms.pbdb106a0.p6a2feef8.p.(Unknown Source)
… 27 more

Can you please help me where to look for an error? (this happens with your Demo files attached to the examples, exactly in ppt)

#2
Hello,

Thank you for your request.

Seems, that the problem depends from the missed Windows fonts on your Linux OS . Please investigate this article for how to install the TrueType fonts via terminal or manually .

If this will not help you , then please describe more details about your Linux environment.

We will wait for your results.

-------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#3

Hi! I’ve installed all the fonts via command sudo apt-get install msttcorefonts as described in your documentations. Isn’t it enough? Maybe its Calibri missing ?




#4
Hello again,

Basically, our library should throw a warning with missed fonts to the console log. So please recheck the console log or share it (full version) with us. Also please try to delete the fonts cache via this command:

sudo fc-cache -fv

We have checked our sample with our demo .ppt file on Linux OS and it works well, as you can see on a screenshot. But previously we had the same issue and after adding the fonts , the issue is gone.

----------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#5

This is the whole output I can see from the code sample in first post :


License path: null
Apr 06, 2016 5:50:32 PM PV a
SEVERE: Invalid license file, starting up evaluation mode.
Save path: /data/documents
Storage path: /data/documents
Exception in thread “main” java.lang.ExceptionInInitializerError
at com.groupdocs.conversion.internal.c.a.s.ms.pbdb106a0.p6a2feef8.cG.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.ms.pbdb106a0.p6a2feef8.cG.(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.ms.pbdb106a0.p6a2feef8.cG.(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.cB.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.Xv.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.Xm.(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.Xm.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.Ji.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.Ji.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.IK.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.IK.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.IK.do(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.IK.(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.nY.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.nY.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.nY.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.x.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.cX.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.nh.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.nh.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.nh.getThumbnail(Unknown Source)
at L.a(Unknown Source)
at O.toImage(Unknown Source)
at ag.a(Unknown Source)
at com.groupdocs.conversion.handler.ConversionHandler.convertToImage(Unknown Source)
at com.groupdocs.conversion.handler.ConversionHandler.convertToImage(Unknown Source)
at com.osnewhorizon.FileConverter.Converter.main(Converter.java:41)
Caused by: java.lang.NullPointerException
at com.groupdocs.conversion.internal.c.a.s.ms.pbdb106a0.p6a2feef8.p.do(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.ms.pbdb106a0.p6a2feef8.cG.c(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.ms.pbdb106a0.p6a2feef8.cG.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.ms.pbdb106a0.p6a2feef8.p.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.s.ms.pbdb106a0.p6a2feef8.p.(Unknown Source)
… 27 more

#6
Hello,

In such case , could you please share with us next :

- your OS version
- JVM version
- maven version
- if you made any changes in our sample then specify the changes.

We will wait for your details.

---------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#7

Sorry, another one little question, are your Font finding function works recursively? I.e. if I’ve put fonts in usr/share/fonts/fonts it will find them ?


#8
Hello,

Unfortunately, no , you should put the fonts to the root of usr/share/fonts folder. And please don't forget delete fonts cache after moving their.

----------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#9

OOhhhhh, that was the problem! By default msttcorefont installer installs fonts under several sub-directories in usr/share/fonts so I needed to transfer all of the fonts manually to the high level dir. But everything seems to work now, at least on your file samples. Will continue testing with my files. Thank you very much for your help, appreciate it a lot!


#10

Glad to hear that.


If you will have more questions please feel free to contact us.

--------

Best regards,

Evgen Efimov


http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+