Expand my Community achievements bar.

SOLVED

generatePDFOutput

Avatar

Level 4

I am trying to merge a PDF and XML to make an interactive PDF document. The next step will be to apply the RE key.

For the merge data I created a standalone JAVA class as a package. The jsp is able to call the package, but I retrieve an error on line 74  doc = outputService.generatePDFOutput(inputPDF, inputXML, option);

 

Error: (First few lines)

 

03.11.2014 14:59:40.523 *ERROR* [0:0:0:0:0:0:0:1 [1414997980341] POST /content/ReaderExtensions/ApplyUsageRights.html HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught SlingException

java.lang.NullPointerException: null
    at apps.readerextensions.components.dummy.readerextensions.mergeData.generatePDFOutput(mergeData.java:82)
    at org.apache.jsp.apps.readerextensions.components.dummy.readerextensions.POST_jsp._jspService(POST_jsp.java:219)
    at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:502)
    at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:449)
    at org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:281)
    at org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$100(JspScriptEngineFactory.java:102)

1 Accepted Solution

Avatar

Correct answer by
Level 10

You need to use stream and store in repository rather than attempting to create file in file system.

View solution in original post

3 Replies

Avatar

Level 4

Thanks for the support. I manage to resolve the issue

Avatar

Correct answer by
Level 10

You need to use stream and store in repository rather than attempting to create file in file system.

Avatar

Level 4

Thanks for the response. I got some time to go over this and have narrow down the issue to the following:

 

1. from a HTTP page I upload a PDF document.

2. From the "Submit" button I call a POST.jsp page. 

3. From the POST.jsp I like to call some custom java classes to be re-used. 

Problem: If I code the storage of the the PDF document  to the repository in the POST.jspI have no problems, but once I move the code to a bundle-java class I receive a java.lang.nulpointerException: null. Why is it that I cannot pass the aemfd.document.document from the POST.jsp to a class file to do all the work for me?

The error stack is the same are is printed above.