I am seeing this text in a stack trace when implementing my trial license for PDF :
2013-10-07 12:29:13,258->License Stream is : java.io.FileInputStream@3d8f5954
2013-10-07 12:29:35,614->Root Cause:ExceptionConverter: java.io.IOException: The document has no pages.
2013-10-07 12:29:35,616->Unable to record canonical: errorText:ExceptionConverter: java.io.IOException: The document has no pages.
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is ExceptionConverter: java.io.IOException: The document has no pages.
First, why does getClass().getResourceAsStream() not find the Pdf license as it does in the Word product?
When I change the code to use the FileInputStream, it does find the license, but I still get this error.
FileInputStream fis = new FileInputStream("/Users/john.olmstead/Aspose.Pdf.lic");
InputStream stream = getClass().getResourceAsStream("Aspose.Pdf.lic");
BridgeLogger.info("License Stream is : "+ fis );
com.aspose.pdf.License license = new com.aspose.pdf.License();
license.setLicense( fis );
Before you ask, the license file Aspose.Pdf.lic IS on the classpath.
Thank You;
John Olmstead
john.olmstead@possible.com
Hi John,
Thanks for contacting support.
I have tested the scenario where I have used the following code snippet to load one of my license files with Aspose.Pdf for .NET 4.2.1 and I am unable to notice any problem. Can you please share the license file so that we can test the scenario at our end. We are sorry for this inconvenience.
[Java]
com.aspose.pdf.License newjavalic = new com.aspose.pdf.License();
newjavalic.setLicense(new java.io.FileInputStream(“C:\Aspose.Total.Java.lic”));
This is the Java product, not the .net product I’m working with. The Aspose.Pdf.lic file is the temporary license file downloaded from the quote for the java product. Perhaps this is not the correct license file being downloaded???
John Olmstead
HTML2Word:
This is the Java product, not the .net product I'm working with. The Aspose.Pdf.lic file is the temporary license file downloaded from the quote for the java product. Perhaps this is not the correct license file being downloaded?????
Hi John,
The code snippet which I have shared above is related to Aspose.Pdf for Java. In case the license file was not valid or not related to Aspose.Pdf for Java, you would have got the error message that "license file is not valid for this product".
Hi John,
Thanks for sharing the license file.
I have tested the scenario using Aspose.Pdf for Java 4.2.1 where I have used the license file which you have shared and I am unable to notice any problem. The PDF file is properly being generated without any evaluation watermark.
Hi John,
I have tested the scenario where I have used the earlier shared code snippet in Juno Eclipse project running over Windows 7(X64), where I have JDK 1.7 (X64) installed and I am unable to notice any problem. The PDF file is properly being generated. However when I have further searched about the issue “java.lang.UnsupportedClassVersionError: Bad version number in .class file” I have come to know that these kind of issues occur when compiling the application with one version of JDK and the location where the compiled application is deployed, a different version of JDK is installed. You may visit the following links for further information
http://www.mkyong.com/java/javalangunsupportedclassversionerror-bad-version-number-in-class-file/
http://stackoverflow.com/questions/2466828/java-lang-unsupportedclassversionerror-bad-version-number-in-class-file
We are really sorry for your inconvenience.