lundi 4 mai 2015

HTML to PDF converter using FOP

I am trying to create PDF file from HTML in database. Yet I am getting error and I've been fighting with it for some time, but still cannot find any answer.

Everything worked pretty well until I packed my program into EAR (core application is within jar file). So, I have changed my code to reflect it (I mean using method getClassLoader().getResourceAsStream

My HtmlToPdf.class

public class HtmlToPdf {

    public File htmlStringToXhtml(String input) throws IOException {
        //Getting and parsin html file to Xml
        File tmpFile = File.createTempFile("html-tmp-", ".html");
        FileUtils.writeStringToFile(tmpFile, input, "ISO-8859-2");
        FileInputStream inputFile = new FileInputStream(tmpFile);
        InputStream inputStylesheet = this.getClass().getClassLoader().getResourceAsStream("stylesheet/xhtml2fo.xsl");
        Tidy tidy = new Tidy();
        tidy.setInputEncoding("ISO-8859-2");
        Document xmlDocument = tidy.parseDOM(inputFile, null);

        //Parsing xml to FO
        Document foDocument = xmlToFo(xmlDocument, inputStylesheet);

        OutputStream out = null;
        File outputFile = File.createTempFile("pdf-tmp-", ".pdf");
        try {
            FopFactory fopFactory = FopFactory.newInstance();
            DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
            InputStream inputFontConfing = this.getClass().getClassLoader().getResourceAsStream("/stylesheet/fonts/fonts.xsl");
            Configuration cfg = cfgBuilder.build(inputFontConfing);
            fopFactory.setUserConfig(cfg);

            FOUserAgent foUserAgent = fopFactory.newFOUserAgent();


            out = new BufferedOutputStream(new FileOutputStream(outputFile));

            Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
            TransformerFactory factory = TransformerFactory.newInstance();
            Transformer transformers = factory.newTransformer(); // identity
                                                                    // transformer

            Source source = new DOMSource(foDocument);

            Result res = new SAXResult(fop.getDefaultHandler());

            transformers.transform(source, res);

            FormattingResults foResults = fop.getResults();
            System.out.println("Generated " + foResults.getPageCount() + " pages in total.");
        } catch (Exception e1) {
            // TODO Auto-generated catch block
            ((Throwable) e1).printStackTrace();

        } finally {
            out.close();
            tmpFile.deleteOnExit();
            outputFile.deleteOnExit();

        }

        return outputFile;

    }

    private static Document xmlToFo(Document document, InputStream inputStylesheet) {

        DOMSource xmlDomSource = new DOMSource(document);
        DOMResult domResult = new DOMResult();

        Transformer transformer = getTransformer(inputStylesheet);

        try {
            transformer.transform(xmlDomSource, domResult);
        } catch (TransformerException e) {
            e.printStackTrace();
        }

        return (Document) domResult.getNode();

    }

    private static Transformer getTransformer(InputStream inputStylesheet) {
        TransformerFactory transformerFacory = TransformerFactory.newInstance();
        DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();

        documentFactory.setNamespaceAware(true);

        try {
            DocumentBuilder documentBuilder = documentFactory.newDocumentBuilder();
            Document xslDoc = documentBuilder.parse(inputStylesheet);
            DOMSource xmlDomSource = new DOMSource(xslDoc);

            return transformerFacory.newTransformer(xmlDomSource);

        } catch (ParserConfigurationException e) {
            e.printStackTrace();
            return null;
        } catch (SAXException e) {
            e.printStackTrace();
            return null;
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        } catch (TransformerConfigurationException e) {
            e.printStackTrace();
            return null;
        }

    }

}

Error I am getting:

19:22:00,041 ERROR [stderr] (http-localhost-127.0.0.1-8383-1) ; SystemID: file:///C:/Users/mc111024/jboss-as-7.1.0.Final/bin/dummy.xsl

19:22:00,041 ERROR [stderr] (http-localhost-127.0.0.1-8383-1) javax.xml.transform.TransformerException: org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. 

19:22:00,042 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2341)

19:22:00,043 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2202)

19:22:00,043 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1276)

19:22:00,043 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:673)

19:22:00,044 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1192)

19:22:00,044 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1170)

19:22:00,045 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at pl.itdirection.pg.merp.util.pdfgenerator.HtmlToPdf.xmlToFo(HtmlToPdf.java:101)

19:22:00,045 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at pl.itdirection.pg.merp.util.pdfgenerator.HtmlToPdf.htmlStringToXhtml(HtmlToPdf.java:49)

19:22:00,046 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at pl.itdirection.pg.merp.util.pdfgenerator.FileTypeOperator.createPdfFromContractFile(FileTypeOperator.java:32)

19:22:00,046 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at pl.itdirection.pg.merp.bean.PdfCreatorBean.createPdfFromContractContent(PdfCreatorBean.java:22)

19:22:00,047 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

19:22:00,047 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

19:22:00,047 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

19:22:00,048 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at java.lang.reflect.Method.invoke(Method.java:606)

19:22:00,048 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)

19:22:00,049 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

19:22:00,049 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374)

19:22:00,050 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:127)

19:22:00,050 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:135)

19:22:00,051 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36)

19:22:00,051 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

19:22:00,052 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)

19:22:00,052 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36)

19:22:00,052 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

19:22:00,053 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)

19:22:00,053 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

19:22:00,054 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:84)

19:22:00,054 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

19:22:00,055 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)

19:22:00,055 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

19:22:00,056 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

19:22:00,056 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)

19:22:00,056 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

19:22:00,057 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)

19:22:00,057 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

19:22:00,058 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228)

19:22:00,058 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304)

19:22:00,059 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190)

19:22:00,059 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

19:22:00,060 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.ejb3.remote.EJBRemoteTransactionPropogatingInterceptor.processInvocation(EJBRemoteTransactionPropogatingInterceptor.java:80)

19:22:00,060 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

19:22:00,061 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)

19:22:00,061 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

19:22:00,061 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)

19:22:00,062 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

19:22:00,062 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)

19:22:00,063 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

19:22:00,063 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)

19:22:00,064 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

19:22:00,064 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

19:22:00,064 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)

19:22:00,065 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.ejb3.remote.LocalEjbReceiver.processInvocation(LocalEjbReceiver.java:179)

19:22:00,065 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:173)

19:22:00,066 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:43)

19:22:00,066 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:175)

19:22:00,067 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:92)

19:22:00,067 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:175)

19:22:00,068 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)

19:22:00,068 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)

19:22:00,068 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)

19:22:00,069 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at com.sun.proxy.$Proxy81.createPdfFromContractContent(Unknown Source)

19:22:00,069 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at pl.itdirection.pg.merp.controller.PersonContractService.createPdf(PersonContractService.java:239)

19:22:00,070 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at pl.itdirection.pg.merp.controller.PersonContractService$Proxy$_$$_WeldClientProxy.createPdf(PersonContractService$Proxy$_$$_WeldClientProxy.java)

19:22:00,070 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

19:22:00,071 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

19:22:00,071 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

19:22:00,072 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at java.lang.reflect.Method.invoke(Method.java:606)

19:22:00,072 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:155)

19:22:00,073 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)

19:22:00,073 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)

19:22:00,073 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211)

19:22:00,074 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525)

19:22:00,074 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502)

19:22:00,075 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)

19:22:00,075 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)

19:22:00,076 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)

19:22:00,076 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)

19:22:00,077 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

19:22:00,077 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

19:22:00,078 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

19:22:00,078 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)

19:22:00,079 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

19:22:00,079 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

19:22:00,079 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at pl.itdirection.pg.merp.filter.SessionFilter.doFilter(SessionFilter.java:38)

19:22:00,080 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

19:22:00,080 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

19:22:00,081 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at pl.itdirection.pg.merp.filter.CrossOriginResourceSharingFilter.doFilter(CrossOriginResourceSharingFilter.java:48)

19:22:00,081 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

19:22:00,082 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

19:22:00,082 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at pl.itdirection.pg.merp.filter.PermissionFilter.doFilter(PermissionFilter.java:48)

19:22:00,083 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

19:22:00,083 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

19:22:00,083 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

19:22:00,084 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

19:22:00,084 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)

19:22:00,085 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154)

19:22:00,085 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

19:22:00,086 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

19:22:00,086 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

19:22:00,086 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

19:22:00,087 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

19:22:00,087 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

19:22:00,088 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

19:22:00,088 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at java.lang.Thread.run(Thread.java:745)

19:22:00,089 ERROR [stderr] (http-localhost-127.0.0.1-8383-1) Caused by: org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. 

19:22:00,089 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.xerces.dom.ParentNode.internalInsertBefore(ParentNode.java:355)

19:22:00,090 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.xerces.dom.ParentNode.insertBefore(ParentNode.java:283)

19:22:00,090 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.xerces.dom.CoreDocumentImpl.insertBefore(CoreDocumentImpl.java:393)

19:22:00,091 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.xerces.dom.NodeImpl.appendChild(NodeImpl.java:236)

19:22:00,091 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.xml.utils.DOMBuilder.append(DOMBuilder.java:139)

19:22:00,092 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.xml.utils.DOMBuilder.characters(DOMBuilder.java:409)

19:22:00,092 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.xml.serializer.ToXMLSAXHandler.characters(ToXMLSAXHandler.java:542)

19:22:00,092 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.xalan.templates.ElemTextLiteral.execute(ElemTextLiteral.java:217)

19:22:00,093 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:395)

19:22:00,093 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:177)

19:22:00,094 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2336)

19:22:00,094 ERROR [stderr] (http-localhost-127.0.0.1-8383-1)   ... 103 more

Link to XSL-stylesheet I am using (It worked as long it was not packed in EAR/JAR): http://ift.tt/1IGzcvJ

Aucun commentaire:

Enregistrer un commentaire