I'm getting the error when putting this code in my class:
License license = new License(); license.setLicense("/tmp/Aspose/Aspose.Total.Java.lic");
stack:
com.aspose.cells.CellsException: Error when parse license stream. at com.aspose.cells.License.setLicense(Unknown Source) at com.aspose.cells.License.setLicense(Unknown Source) at xxCells.PutAttrList(xxCells:144) Caused by: java.lang.NullPointerException at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:76) ... 3 more
I didn't change original license file. And it worked with Aspose.Words. What can be a problem?
Please provide a useful path to your licence file in your code. For example, if your licence file is located at “C:/Aspose.Total.Product.Family.lic”, your code should look like as below to find the licence file:
Can you tell us if it is your first time using this licence file or you already used this licence file without any problems before?
Another method to get the complete path of your licence file under linux is to Right Click the Licence file, and take its properties, which will show you its complete path.
If the problem still persits, please follow this link to send us your licence file, so that we may look into it.
You can see the attached screenshot of the generated “try.xlsx” file. Can you please replace the single “/” with a double slash “//”, as I have done in my code, and let us know your feedback?
Since the licence file is working at my end, and you have also used it at your end for Aspose.Words, the only issue that remains is of the Path to the licence file. Can you read your licence file in a filestream? If you can read it in a filestream, then there should be no issue in setting the licence. Please test reading your licence file in a filestream object and let us know your feedback. You have to write some statement like:
FileInputStream fstream
= new
FileInputStream(Path to your licence file);
This will tell you if your code can find your licence file or not.
Since the licence file is working at my end, and you have also used it at your end for Aspose.Words, the only issue that remains is of the Path to the licence file. Can you read your licence file in a filestream? If you can read it in a filestream, then there should be no issue in setting the licence. Please test reading your licence file in a filestream object and let us know your feedback. You have to write some statement like:
FileInputStream fstream = new FileInputStream(Path to your licence file);
This will tell you if your code can find your licence file or not.
Which xml parser are you using now? From the
exception stack trace it seems you are using another xerces library instead of
the default one used by JDK. Please check your classpath and remove all other
libraries except those in Aspose.Cells release archive and try your code again. If you
can still find the issue, please change your jdk and try again. Or, please take
the license file as a common XML file and try to parse it by following code: