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

Free Support Forum - aspose.com

License Initialization Fails for Java Aspose.Pdf

Hello,

Our license information is as follows:

Product - Aspose.Total for Java
LicensedTo - *********
EditionType - Enterprise
SubscriptionExpiry - 20080113
LicenseVersion - 2.0
SerialNumber - Withholding for security reasons. If you specifically require this information please let us know, and we will be happy to provide it.

We have been working with Aspose.Cells (xls) and Aspose.PowerPoint (ppt) for a few months. The following calls work correctly:

File asposeLicenseFile = new File("Aspose.Total.Java.lic");
new com.aspose.slides.License().setLicense(new FileInputStream(asposeLicenseFile));
new com.aspose.cells.License().setLicense(new FileInputStream(asposeLicenseFile));


However, when we try to use the license for Aspose.Pdf (pdf) we get the following error:

File asposeLicenseFile = new File("Aspose.Total.Java.lic");
new com.aspose.pdf.License().setLicense(new FileInputStream(asposeLicenseFile));


Error:

java.lang.Exception: Cannot find black listed licenses resource or black list is invalid. Please report this error to Aspose.

Can you please tell me:

1. Do we have a valid license to use Aspose.Pdf ?
2. If we do not have a valid license, what is the cost for purchasing a license that will enable us to work with Aspose.Pdf ?

Thanks for your help.

--
Viraj Patil
Developer
Ph: (206) 965-8096
Email: viraj.patil@surveyanalytics.com

Thank you for considering Aspose.

Please make sure you are using the latest version of Aspose.Pdf for Java. We have fixed such issue before. If it still won’t work, please send your license to adeel.ahmad@aspose.com and let us test it.

Hello,

Thanks for your reply. The Jan 23 2007 Aspose.Pdf Java library resolved some of the the licensing issues.

We are using ANT for building and deploying our application files. We have a custom task (pdfProcessorTask) which is supposed to generate the necessary PDF files.

The licensing call fails when the pdfProcessorTask is executed. However, everything works file if the PDFProcessor class is run via the command prompt (i.e. java PDFProcessor) or via the Java task.

Here’s our test setup:

public class PDFProcessor {
public PDFProcessor () {

}

public static void main (String args[]) throws Exception {
(new PDFProcessor()).execute();
}

public void execute() throws BuildException {
try {
File asposeLicenseFile = new File(“Aspose.Total.Java.lic”);
System.out.println("File: " + asposeLicenseFile.getName());

com.aspose.slides.License license = new com.aspose.slides.License();
license.setLicense(new FileInputStream(asposeLicenseFile));
System.out.println(“com.aspose.slides.License: Valid”);

com.aspose.cells.License license1 = new com.aspose.cells.License();
license1.setLicense(new FileInputStream(asposeLicenseFile));
System.out.println(“com.aspose.cells.License: Valid”);

com.aspose.pdf.License license2 = new com.aspose.pdf.License();
license2.setLicense(new FileInputStream(asposeLicenseFile));
System.out.println(“com.aspose.pdf.License: Valid”);
} catch (Exception ex) {
System.out.println(“License: Invalid”);
ex.printStackTrace(System.out);
return;
}
}
}

-------------------------------------------------------------------------------------------------------------------
build.xml:



























Output:

run:
[java] File: Aspose.Total.Java.lic
[java] com.aspose.slides.License: Valid
[java] com.aspose.cells.License: Valid
[java] com.aspose.pdf.License: Valid
[pdfProcessorTask] File: Aspose.Total.Java.lic
[pdfProcessorTask] com.aspose.slides.License: Valid
[pdfProcessorTask] com.aspose.cells.License: Valid
[pdfProcessorTask] License: Invalid
[pdfProcessorTask] java.lang.Exception: Cannot find black listed licenses resource or black list is invalid. Please report this error to Aspose.
[pdfProcessorTask] at com.aspose.pdf.License.do(Unknown Source)
[pdfProcessorTask] at com.aspose.pdf.License.if(Unknown Source)
[pdfProcessorTask] at com.aspose.pdf.License.setLicense(Unknown Source)
[pdfProcessorTask] at PDFProcessor.execute(PDFProcessor.java:40)


As you can see, the java task executes correctly (without any licensing exceptions), however the pdfProcessorTask throws a Licensing exception.

Please let me know if you require further details about this issue. Thanks.


Viraj

Hi,

Can you please send me your license file at adeel.ahmad@aspose.com . We will check this issue and let you know soon.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

Hi,

Thanks for sending the documents. I am able to reproduce the error. I have logged this issue# 3139. We will try to fix this as soon as possible.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

Adeel,

Thanks for your quick response. We are very happy with Aspose software and services.

Thanks again and hope to hear from you soon.

--

Viraj

Hi,

I have asked other developers to test this issue thoroughly. We will let you know whenever we find a solution.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

Two developers tested this issue and no error is found. Are you sure you are using the latest version of Aspose.Pdf for Java? Can you please provide the code and let us check it?

Hello Tommy,

Hope you are doing well today. I am pasting the Java code and the build.xml file contents below. If you do not have a copy of our License file, please let me know and I can email that to you as well.

To clarify, we are able execute the PDFProcessor class via the command line (i.e. java PDFProcessor). However when we define a custom task (see taskdef name="pdfProcessorTask" in build.xml) and then try to execute the custom task, that's when the licensing issue occurs.

Please let me know if you require any further information. Thanks for your help.

PDFProcessor.java:

import java.io.*;
import java.util.*;
import java.lang.*;
import java.net.*;
import java.text.*;
import java.lang.Runtime;

import com.aspose.pdf.elements.*;
import org.w3c.dom.*;
import java.util.regex.*;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.taskdefs.MatchingTask;


public class PDFProcessor {
public PDFProcessor () {

}

public static void main (String args[]) throws Exception {
(new PDFProcessor()).execute();
}

public void execute() throws BuildException {
try {
File asposeLicenseFile = new File("Aspose.Total.Java.lic");
System.out.println("File: " + asposeLicenseFile.getName());

com.aspose.slides.License license = new com.aspose.slides.License();
license.setLicense(new FileInputStream(asposeLicenseFile));
System.out.println("com.aspose.slides.License: Valid");

com.aspose.cells.License license1 = new com.aspose.cells.License();
license1.setLicense(new FileInputStream(asposeLicenseFile));
System.out.println("com.aspose.cells.License: Valid");

com.aspose.pdf.License license2 = new com.aspose.pdf.License();
license2.setLicense(new FileInputStream(asposeLicenseFile));
System.out.println("com.aspose.pdf.License: Valid");
} catch (Exception ex) {
System.out.println("License: Invalid");
ex.printStackTrace(System.out);
}
}

}

build.xml:












<javac srcdir="src"
destdir="classes"
debug="on">



















I test it again and I still can’t reproduce this error. Can you please download the Aspose.Pdf for java from our web site again and create a new project to test it?

I am unable to set the license. I am working on a windows application and one one screen I use the component. I put the file in the same folder as the screen. But it fails to find it. Please help.

If needed I can email the file to you.

Aarti

Dear Aarti,

Do you mean your application can’t find the license file? Please use absolute path to test it.

Absolute path works. But I cannot hardcode the path. What is the alternative?

Is this a bug?

I don’t think this is a bug. Can you please try creating a file stream for the license file and then use SetLicense(stream)?

The issue has been resolved. I wanted to post the resolution. When I changed the build action property of the license file to Embedded Resource in VS.NET 2005, it worked. I did not have to convert it into a stream.