com.aspose.cells.CellsException: Error when parse license stream

Hi,

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?

Thanks

Hi,


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:

License lic = new License();
lic.setLicense(“C://Aspose.Total.Product.Family.lic”);

This can also be achieved using Streams as follow:

FileInputStream fstream=new FileInputStream(“C://Aspose.Total.Product.Family.lic”);

 //Instantiate the License class
 License license=new License();

 //Set the license through the stream object
 license.setLicense(fstream);

Please let us know if we can be of any additional help.

Thanks and Best Regards

("/tmp/Aspose/Aspose.Total.Java.lic"); - the useful path in my case because of Linux.

fStream didn't wotk - the same error...

Hi,


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.

Thanks & Best Regards,

yes, I have used it before with Aspose.Words. I’ve sent you a license file.

Hi,


Thank you for providing the information. I will get back to you after testing it at my end.

Thank you for using Aspose.Total for Java

Hi,


I have tried your provided licence file with the following lines of code at my end, and could not reproduce the issue.

License lic = new License();
lic.setLicense("//home//Kashif//workspace//TestLicence//Aspose.Total.Java.lic");
Workbook workbook = new Workbook();
workbook.save("//home//Kashif//try.xlsx");

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?

Thanks for using Aspose Products

double slash won’t work either, same error

Hi,

I have a question for you.

Are you using all the required libraries by Aspose.Cells for Java?

These are different for different JDK(s).

For JDK 1.6 and later versions, these are following.

  1. bcprov-jdk16-146.jar
  2. dom4j-1.6.1.jar
  3. stax2-api-3.0.2.jar
  4. woodstox-core-asl-4.1.1.jar

You can find these libraries from the Major Release:

Aspose.Cells for Java 7.2.0



Please add them in your classpath and see if it resolves your issue.

Hi,


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.

Thanks


kashif.iqbal:
Hi,

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.

Thanks


the reading is OK

The error pops up here:

license.setLicense(fstream);

mshakeel.faiz:
Hi,

I have a question for you.

Are you using all the required libraries by Aspose.Cells for Java?

These are different for different JDK(s).

For JDK 1.6 and later versions, these are following.

  1. bcprov-jdk16-146.jar
  2. dom4j-1.6.1.jar
  3. stax2-api-3.0.2.jar
  4. woodstox-core-asl-4.1.1.jar

You can find these libraries from the Major Release:

Aspose.Cells for Java 7.2.0



Please add them in your classpath and see if it resolves your issue.


Have you cross checked the above jar files if they are properly included in your project alongwith aspose.cells.x.x jar file?

Thanks

Sure, I installed all above, 1.4 version

Hi,


Can you please provide us with your source java file? I am looking into it and this will help us further investigate the issue.

Thanks for your continuous feedback and cooperation

the class is simple as that:

import com.aspose.cells.*;
import java.util.Iterator;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;


public class xxCells {


public static void Sav(String p_file_path) throws Exception
{

License license = new License();
license.setLicense("//tmp//tmp1//Aspose.Total.Java.lic");

}



}

Hi,


Can you please tell us the version of Linux that you are using?

Thanks

Hi,


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:

DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();

DocumentBuilder builder = builderFactory.newDocumentBuilder();

document = builder.parse(stream);

Please let us know whether the code can work with the XML in the lic file or any other common XML file.


Thank you.

17 posts were split to a new topic: Error occurs after packaging python code to exe