eXist-db / exist

eXist Native XML Database and Application Platform
https://exist-db.org
GNU Lesser General Public License v2.1
421 stars 179 forks source link

RenderX XEP in exist 5.0.0 #3001

Closed erneut closed 2 years ago

erneut commented 5 years ago

Hello

I installed 5.0.0 and tried to do basic test of RenderX XEP. Unfortunately I didn't manage to do it. Best error log that I got is:

exerr:ERROR com.renderx.xep.FormatterImpl [at line 4, column 13]

Test file: xquery version "3.1"; let $fo := doc('/db/apps/rx/resources/test.xml') let $config := util:expand(doc("/db/apps/rx/resources/xep.xml")) let $pdf := xslfo:render($fo, "application/pdf", (), $config) return response:stream-binary($pdf, "media-type=application/pdf", ".pdf")

I used this setup guide https://en.wikibooks.org/wiki/XQuery/Generating_PDF_from_XSL-FO_files#Notes_on_installing_RenderX_XSL-FO_Processors Version 4.7.1 worked ok, but not 5. No "special" configuration was used. Only default settings of exist and xep.

It looks like exist doesn't load needed jars, although I've copied them into $EXIST_HOME/lib/ and $EXIST_HOME/lib/user (just in case). Still no effect. I used grep to find some info in $EXIST_HOME/logs, but this also gave me nothing.

Can you give me some hint? How to check does exist load depending jars? Or how to get more verbosity in logs?

Thank you very much.

eXist: 5.0.0 5a27d10 Java: openjdk version "11.0.4" 2019-07-16 OS: Ubuntu 18.04 64bit Installation: exist-distribution-5.0.0-unix.tar.bz2 conf.xml: line 964 changed to:

adamretter commented 5 years ago

As well as copying the jar files into 'lib' you will need to add them to the XML file (s) in the etc folder whose name corresponds to the script that you use to start eXist. This is mostly likely startup.xml

erneut commented 5 years ago

Thank you. That helped

kbrown01 commented 4 years ago

As an alternative, you could install RenderX's EnMasse (or WinMasse on Windows) which gives a SOAP interface to the formatter. Note, this can be run on any machine, it is not even required to be on the eXist server at all. EnMasse provides a SOAP port to submit your FO and get back PDF (or alternate formats). Then it is as easy as building a SOAP message and sending it to the EnMasse server.

xquery version "3.0";
declare namespace fo = "http://www.w3.org/1999/XSL/Format";

(: web address for the EnMasse server :)
let $xepsoap := 'http://www.yourserver.com:6577/fairy'
(: The base for any relative references (if any) -- cannot be empty and does not need to exist at all on the formatting server, just a path to resolve relative references :)
let $in0 := 'c:/foo.xml'
(: The base64 encoded XSL FO :)
let $in1 := util:base64-encode(serialize(doc('/db/EIDO/data/edit/_scratch/sample.fo')/fo:root))

let $soapMessage := <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:fairy="http://www.yourserver.com:6577/fairy"> 
    <SOAP-ENV:Header/> 
    <SOAP-ENV:Body> 
        <fairy:format SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
            <in0>{$in0}</in0> 
            <in1>{$in1}</in1> 
        </fairy:format> 
    </SOAP-ENV:Body> 
</SOAP-ENV:Envelope>

let $xepout := httpclient:post(xs:anyURI($xepsoap),$soapMessage,false(),<headers/>)
return $xepout//formatReturn/string()

In this sample code, it returns base64 encoded PDF but you get the idea, you can use with response-stream-binary just like your example.

This can be used in very high performance environments because EnMasse can scale to speak to RenderX XEP in many threads in multiple JVMs, cores, and even different machines.

adamretter commented 4 years ago

@erneut did you get this working?

erneut commented 4 years ago

Sorry for late response.

As I said your first advice helped me. I managed to set up RenderX XEP on exist 5.0.

On Enmasse: Yeah, that also works.

jeanpaulrehr commented 4 years ago

I'm updating this for those who come along with the same error, as I did. The two XEP jar files (as indicated in XEP documentation: xep.jar and xt.jar) need to be added to the startup configuration XML document. But there are several of those config documents in /etc/ used variously by different startup methods: startup.xml and launcher.xml. To be safe one should add the jar entries to each file. This is the only change to the usual XEP configuration steps.

If XEP is providing further functionality in other jars that must be loaded by eXist then they should be added to the same location and added to the same file as the others above.

kbrown01 commented 4 years ago

Jean-Paul: Can you be specific on which two JARs? One is obviously xep.jar, but what is the other JAR?

jeanpaulrehr commented 4 years ago

I updated my comment for clarity.

kbrown01 commented 2 years ago

Just a note to augment my comments above. RenderX will be releasing InGrid (Intelligent Grid) formatter next month. This is a complete rewrite of the EnMasse product described above from Python to Java and will have both SOAP and REST interfaces. This allows for removing all of the JARs required for accessing RenderX. One can just send in FO (or XML+XSL link) and get back results you can use/store or send to client. It will also support ZIP input so you can build a ZIP container with required components (XML, XSLs, images) all locally referenced. InGrid will unzip, format and return result to client.