PDF渲染插件问题

时间:2018-03-05 15:18:55

标签: pdf grails grails-plugin

我正在处理需要生成PDF文件的Grails应用程序。我们正在使用Grails Rendering Plugin(https://gpc.github.io/rendering/guide/single.html)。

直到现在才开始工作,但在生成PDF时我们遇到了一个问题:

ERROR:  'NOT_FOUND_ERR: An attempt is made to reference a node in a context where it does not exist.'
10:52:53.752 [http-bio-8080-exec-76] ERROR StackTrace - Full Stack Trace:
org.xhtmlrenderer.util.XRRuntimeException: Can't load the XML resource (using TRaX transformer). org.w3c.dom.DOMException: NOT_FOUND_ERR: An attempt is made to reference a node in a context where it does not exist.
        at org.xhtmlrenderer.resource.XMLResource$XMLResourceBuilder.createXMLResource(XMLResource.java:191) ~[core-renderer-R8.jar:na]
        at org.xhtmlrenderer.resource.XMLResource.load(XMLResource.java:75) ~[core-renderer-R8.jar:na]
        at org.xhtmlrenderer.resource.XMLResource$load.call(Unknown Source) ~[na:na]
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) [groovy-all-2.4.4.jar:2.4.4]
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) [groovy-all-2.4.4.jar:2.4.4]
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) [groovy-all-2.4.4.jar:2.4.4]
        at grails.plugin.rendering.document.XhtmlDocumentService.createDocument(XhtmlDocumentService.groovy:52) [XhtmlDocumentService.class:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_80]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_80]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_80]
        at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_80]
        at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210) [groovy-all-2.4.4.jar:2.4.4]
        at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59) [groovy-all-2.4.4.jar:2.4.4]
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52) [groovy-all-2.4.4.jar:2.4.4]
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154) [groovy-all-2.4.4.jar:2.4.4]
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166) [groovy-all-2.4.4.jar:2.4.4]
        at grails.plugin.rendering.document.XhtmlDocumentService.createDocument(XhtmlDocumentService.groovy:40) [XhtmlDocumentService.class:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_80]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_80]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_80]
        at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_80]

...

Caused by: javax.xml.transform.TransformerException: org.w3c.dom.DOMException: NOT_FOUND_ERR: An attempt is made to reference a node in a context where it does not exist.
        at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:755) ~[na:1.7.0_80]
        at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:359) ~[na:1.7.0_80]
        at org.xhtmlrenderer.resource.XMLResource$XMLResourceBuilder.createXMLResource(XMLResource.java:189) ~[core-renderer-R8.jar:na]
        ... 203 common frames omitted

我不理解错误,因为用于生成PDF的模板文件没有任何变化。此外,一切都在本地部署上正常工作。它只在Linux机器上部署时失败。

我的猜测是messages.properties文件(用于PDF)出了问题。我们试图改变编码和换行符,但似乎没有什么可以做的..

我不知道我在这里失踪了什么。

0 个答案:

没有答案