500 Error when using org.basex.modules.fop.FOP
Monday, 25 January 2016 · 3 messages · last reply 26 Jan 2016
CS
Chris Speare25 Jan 2016 16:11 #
I've been working with Apache FOP for converting XML (held on a BaseX instance) to PDF. Currently this involves saving nodes from the BaseX database to pass into a local FopFactory - not ideal. Have tried to pull one of the documents out and get a 500 error, then tried referencing direct files - which also errors:
import module namespace fop = 'org.basex.modules.fop.FOP';
let $xml := db:open('billing_run_435')/CommercialDocument[@id="203545"] - if returned does show xml
let $xsl := xslt:transform('/home/chris/Downloads/xml/billing_invoice_241040.xml', '/etc/xmlmapper/pdf_invoice.fo') - hard coded for debugging
return $xmlFrom the log:
Version: BaseX 8.3.1
Java: Oracle Corporation, 1.7.0_25
OS: Linux, amd64
Stack Trace:
java.lang.NullPointerException
at org.basex.query.func.xslt.XsltTransform.transform(XsltTransform.java:110)
at org.basex.query.func.xslt.XsltTransform.transform(XsltTransform.java:59)
at org.basex.query.func.xslt.XsltTransform.item(XsltTransform.java:37)
at org.basex.query.expr.ParseExpr.value(ParseExpr.java:64)
at org.basex.query.QueryContext.value(QueryContext.java:423)
at org.basex.query.expr.gflwor.Let$LetEval.next(Let.java:187)
at org.basex.query.expr.gflwor.GFLWOR$1.next(GFLWOR.java:95)
at org.basex.query.MainModule$1.next(MainModule.java:114)
at org.basex.query.func.StandardFunc.cache(StandardFunc.java:404)
at org.basex.query.func.xquery.XQueryEval.eval(XQueryEval.java:129)
at org.basex.query.func.xquery.XQueryEval.eval(XQueryEval.java:59)
at org.basex.query.func.xquery.XQueryEval.iter(XQueryEval.java:44)
at org.basex.query.func.fn.FnSerialize.item(FnSerialize.java:22)
at org.basex.query.expr.ParseExpr.iter(ParseExpr.java:43)
at org.basex.query.QueryContext.iter(QueryContext.java:412)
at org.basex.query.expr.IterMap$1.next(IterMap.java:42)
at org.basex.query.MainModule$1.next(MainModule.java:114)
at org.basex.query.func.StandardFunc.cache(StandardFunc.java:404)
at org.basex.query.func.xquery.XQueryEval.eval(XQueryEval.java:129)
at org.basex.query.func.xquery.XQueryEval.eval(XQueryEval.java:59)
at org.basex.query.func.xquery.XQueryEval.iter(XQueryEval.java:44)
at org.basex.query.expr.TypeCheck.iter(TypeCheck.java:87)
at org.basex.query.QueryContext.iter(QueryContext.java:412)
at org.basex.query.expr.If.iter(If.java:128)
at org.basex.query.MainModule.iter(MainModule.java:110)
at org.basex.query.QueryContext.iter(QueryContext.java:351)
at org.basex.http.restxq.RestXqResponse.create(RestXqResponse.java:55)
at org.basex.http.restxq.RestXqModule.process(RestXqModule.java:101)
at org.basex.http.restxq.RestXqFunction.process(RestXqFunction.java:109)
at org.basex.http.restxq.RestXqServlet.run(RestXqServlet.java:44)
at org.basex.http.BaseXServlet.service(BaseXServlet.java:64)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)Both '/home/chris/Downloads/xml/billing_invoice_241040.xml' and '/etc/xmlmapper/pdf_invoice.fo' exist as I use them in a local java fopfactory which processes them fine.
The information contained in the email and any files transmitted with it is confidential and intended for the addressee only. If you have received this email in error please accept our apologies and notify the originator. Any disclosure, copying, distribution or any other use of this communication is strictly prohibited and may be unlawful. We reserve the right to monitor and intercept communications for lawful business purposes.
Wireless Innovation Ltd , Unit D2, Churcham Business Park, Churcham, Gloucestershire, GL2 8AX, Great Britain.
Company Registration Number 5240202, Place of Registration Companies House Cardiff.
CG
Christian Grün26 Jan 2016 08:49 #
Quoted text · Chris Speare · 7 lines
> import module namespace fop = 'org.basex.modules.fop.FOP'; > let $xml := db:open('billing_run_435')/CommercialDocument[@id="203545"] - if > returned does show xml > let $xsl := > xslt:transform('/home/chris/Downloads/xml/billing_invoice_241040.xml', > '/etc/xmlmapper/pdf_invoice.fo') - hard coded for debugging > return $xml
Please note that the argument of
xslt:transform must be an XSL stylesheet, it cannot be an .fo file.Quoted text · Chris Speare · 4 lines
> java.lang.NullPointerException > at > org.basex.query.func.xslt.XsltTransform.transform(XsltTransform.java:110) > at
Do you also get this error in other BaseX instances, such as e.g. the GUI? Could you possibly provide me with a reproducible example?
Christian
Quoted text · Chris Speare · 57 lines
> org.basex.query.func.xslt.XsltTransform.transform(XsltTransform.java:59) > at > org.basex.query.func.xslt.XsltTransform.item(XsltTransform.java:37) > at org.basex.query.expr.ParseExpr.value(ParseExpr.java:64) > at org.basex.query.QueryContext.value(QueryContext.java:423) > at org.basex.query.expr.gflwor.Let$LetEval.next(Let.java:187) > at org.basex.query.expr.gflwor.GFLWOR$1.next(GFLWOR.java:95) > at org.basex.query.MainModule$1.next(MainModule.java:114) > at org.basex.query.func.StandardFunc.cache(StandardFunc.java:404) > at org.basex.query.func.xquery.XQueryEval.eval(XQueryEval.java:129) > at org.basex.query.func.xquery.XQueryEval.eval(XQueryEval.java:59) > at org.basex.query.func.xquery.XQueryEval.iter(XQueryEval.java:44) > at org.basex.query.func.fn.FnSerialize.item(FnSerialize.java:22) > at org.basex.query.expr.ParseExpr.iter(ParseExpr.java:43) > at org.basex.query.QueryContext.iter(QueryContext.java:412) > at org.basex.query.expr.IterMap$1.next(IterMap.java:42) > at org.basex.query.MainModule$1.next(MainModule.java:114) > at org.basex.query.func.StandardFunc.cache(StandardFunc.java:404) > at org.basex.query.func.xquery.XQueryEval.eval(XQueryEval.java:129) > at org.basex.query.func.xquery.XQueryEval.eval(XQueryEval.java:59) > at org.basex.query.func.xquery.XQueryEval.iter(XQueryEval.java:44) > at org.basex.query.expr.TypeCheck.iter(TypeCheck.java:87) > at org.basex.query.QueryContext.iter(QueryContext.java:412) > at org.basex.query.expr.If.iter(If.java:128) > at org.basex.query.MainModule.iter(MainModule.java:110) > at org.basex.query.QueryContext.iter(QueryContext.java:351) > at > org.basex.http.restxq.RestXqResponse.create(RestXqResponse.java:55) > at org.basex.http.restxq.RestXqModule.process(RestXqModule.java:101) > at > org.basex.http.restxq.RestXqFunction.process(RestXqFunction.java:109) > at org.basex.http.restxq.RestXqServlet.run(RestXqServlet.java:44) > at org.basex.http.BaseXServlet.service(BaseXServlet.java:64) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) > > Both '/home/chris/Downloads/xml/billing_invoice_241040.xml' and > '/etc/xmlmapper/pdf_invoice.fo' exist as I use them in a local java > fopfactory which processes them fine. > > > > The information contained in the email and any files transmitted with it is > confidential and intended for the addressee only. If you have received this > email in error please accept our apologies and notify the originator. Any > disclosure, copying, distribution or any other use of this communication is > strictly prohibited and may be unlawful. We reserve the right to monitor and > intercept communications for lawful business purposes. > > > > Wireless Innovation Ltd , Unit D2, Churcham Business Park, Churcham, > Gloucestershire, GL2 8AX, Great Britain. > > Company Registration Number 5240202, Place of Registration Companies House > Cardiff. > >
CS
Chris Speare26 Jan 2016 11:28 #
Ah thanks Christian I didn't see that it could only be XLST made the assumption as it was FOP it would be an fo file - I'll have to read up on XSLT for PDF and see about converting my document. This was through the http interface running a query directly, so I'll have to play about with the speed of exporting the nodes I'm interested in as files (all documents from a database with some nodes as additional documents - seems quite speedy) then pass them through FOP vs the XQuery route.
Thanks for the pointer
Quoted text · Christian Grün · 79 lines
On 26/01/16 07:49, Christian Grün wrote: >> import module namespace fop = 'org.basex.modules.fop.FOP'; >> let $xml := db:open('billing_run_435')/CommercialDocument[@id="203545"] - if >> returned does show xml >> let $xsl := >> xslt:transform('/home/chris/Downloads/xml/billing_invoice_241040.xml', >> '/etc/xmlmapper/pdf_invoice.fo') - hard coded for debugging >> return $xml > Please note that the argument of xslt:transform must be an XSL > stylesheet, it cannot be an .fo file. > > >> java.lang.NullPointerException >> at >> org.basex.query.func.xslt.XsltTransform.transform(XsltTransform.java:110) >> at > Do you also get this error in other BaseX instances, such as e.g. the > GUI? Could you possibly provide me with a reproducible example? > > Christian > > >> org.basex.query.func.xslt.XsltTransform.transform(XsltTransform.java:59) >> at >> org.basex.query.func.xslt.XsltTransform.item(XsltTransform.java:37) >> at org.basex.query.expr.ParseExpr.value(ParseExpr.java:64) >> at org.basex.query.QueryContext.value(QueryContext.java:423) >> at org.basex.query.expr.gflwor.Let$LetEval.next(Let.java:187) >> at org.basex.query.expr.gflwor.GFLWOR$1.next(GFLWOR.java:95) >> at org.basex.query.MainModule$1.next(MainModule.java:114) >> at org.basex.query.func.StandardFunc.cache(StandardFunc.java:404) >> at org.basex.query.func.xquery.XQueryEval.eval(XQueryEval.java:129) >> at org.basex.query.func.xquery.XQueryEval.eval(XQueryEval.java:59) >> at org.basex.query.func.xquery.XQueryEval.iter(XQueryEval.java:44) >> at org.basex.query.func.fn.FnSerialize.item(FnSerialize.java:22) >> at org.basex.query.expr.ParseExpr.iter(ParseExpr.java:43) >> at org.basex.query.QueryContext.iter(QueryContext.java:412) >> at org.basex.query.expr.IterMap$1.next(IterMap.java:42) >> at org.basex.query.MainModule$1.next(MainModule.java:114) >> at org.basex.query.func.StandardFunc.cache(StandardFunc.java:404) >> at org.basex.query.func.xquery.XQueryEval.eval(XQueryEval.java:129) >> at org.basex.query.func.xquery.XQueryEval.eval(XQueryEval.java:59) >> at org.basex.query.func.xquery.XQueryEval.iter(XQueryEval.java:44) >> at org.basex.query.expr.TypeCheck.iter(TypeCheck.java:87) >> at org.basex.query.QueryContext.iter(QueryContext.java:412) >> at org.basex.query.expr.If.iter(If.java:128) >> at org.basex.query.MainModule.iter(MainModule.java:110) >> at org.basex.query.QueryContext.iter(QueryContext.java:351) >> at >> org.basex.http.restxq.RestXqResponse.create(RestXqResponse.java:55) >> at org.basex.http.restxq.RestXqModule.process(RestXqModule.java:101) >> at >> org.basex.http.restxq.RestXqFunction.process(RestXqFunction.java:109) >> at org.basex.http.restxq.RestXqServlet.run(RestXqServlet.java:44) >> at org.basex.http.BaseXServlet.service(BaseXServlet.java:64) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) >> >> Both '/home/chris/Downloads/xml/billing_invoice_241040.xml' and >> '/etc/xmlmapper/pdf_invoice.fo' exist as I use them in a local java >> fopfactory which processes them fine. >> >> >> >> The information contained in the email and any files transmitted with it is >> confidential and intended for the addressee only. If you have received this >> email in error please accept our apologies and notify the originator. Any >> disclosure, copying, distribution or any other use of this communication is >> strictly prohibited and may be unlawful. We reserve the right to monitor and >> intercept communications for lawful business purposes. >> >> >> >> Wireless Innovation Ltd , Unit D2, Churcham Business Park, Churcham, >> Gloucestershire, GL2 8AX, Great Britain. >> >> Company Registration Number 5240202, Place of Registration Companies House >> Cardiff. >> >>
The information contained in the email and any files transmitted with it is confidential and intended for the addressee only. If you have received this email in error please accept our apologies and notify the originator. Any disclosure, copying, distribution or any other use of this communication is strictly prohibited and may be unlawful. We reserve the right to monitor and intercept communications for lawful business purposes.
Wireless Innovation Ltd , Unit D2, Churcham Business Park, Churcham, Gloucestershire, GL2 8AX, Great Britain.
Company Registration Number 5240202, Place of Registration Companies House Cardiff.
Written for BaseX 8.3. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery