Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-26363

Fix FileNotFoundException on document template

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 10.3-SNAPSHOT
    • Fix Version/s: 10.3
    • Component/s: Template Rendering

      Description

      Steps to reproduce:

      • Create a document template in Studio named test_document_template
      • Create the following automation chain:
        - Context.FetchDocument
        - Context.PushDocument
        - Document.GetParent:
            type: Folder
        - Context.SetVar:
            name: descriptionparent
            value: "@{Document[\"dc:description\"]}"
        - Context.PopDocument
        - Document.SetProperty:
            xpath: "dc:description"
            save: "false"
            value: "@{Context[\"descriptionparent\"]}"
        - Context.SetInputAsVar:
            name: mondocument
        - Render.Document:
            template: "template:test_document_template"
            filename: output.ftl
            mimetype: text/xml
            type: ftl
        - Blob.AttachOnDocument:
            document: "@{Context[\"mondocument\"]}"
            save: "true"
            xpath: "file:content"
        
      • Create an event handler linked to the automation chain which:
        • listens to DocumentCreated event
        • is enabled for File document type only
        • is enabled when current document is a mutable document only.
      • Hot reload.
      • Create a Folder with a description.
      • Within the Folder, create a File document.
        => JSF error page appears.
        => Server log:
        
        JAR entry data/templates/test_document_template not found in /home/karin/Nuxeo/distribution/date-based/nuxeo-server-10.3-I20181129_2333-tomcat/nxserver/bundles/ktouchie-SANDBOX-studio-jsf-release-tests-without-branding-without-url-SNAPSHOT.jar
        
                        javax.servlet.ServletException: On requestURL: http://localhost:8080/nuxeo/create_document.faces
        	at org.nuxeo.ecm.platform.ui.web.rest.FancyURLFilter.doFilter(FancyURLFilter.java:140)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        	at org.nuxeo.ecm.platform.web.common.requestcontroller.filter.NuxeoRequestControllerFilter.doFilter(NuxeoRequestControllerFilter.java:134)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        	at org.nuxeo.ecm.platform.ui.web.auth.NuxeoAuthenticationFilter.doFilterInternal(NuxeoAuthenticationFilter.java:631)
        	at org.nuxeo.ecm.platform.ui.web.auth.NuxeoAuthenticationFilter.doFilter(NuxeoAuthenticationFilter.java:427)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        	at org.nuxeo.ecm.platform.web.common.requestcontroller.filter.NuxeoCorsCsrfFilter.doFilter(NuxeoCorsCsrfFilter.java:255)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        	at org.nuxeo.ecm.platform.web.common.exceptionhandling.NuxeoExceptionFilter.doFilter(NuxeoExceptionFilter.java:67)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        	at org.nuxeo.ecm.platform.web.common.encoding.NuxeoEncodingFilter.doFilter(NuxeoEncodingFilter.java:64)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
        	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
        	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
        	at org.apache.catalina.valves.rewrite.RewriteValve.invoke(RewriteValve.java:277)
        	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
        	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
        	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)
        	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
        	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
        	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
        	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
        	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:770)
        	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
        	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        	at java.lang.Thread.run(Thread.java:745)
        Caused by: javax.servlet.ServletException: org.nuxeo.ecm.core.api.NuxeoException: org.nuxeo.ecm.automation.OperationException: Failed to invoke operation Render.Document
        	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
        	at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
        	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
        	at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
        	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
        	at org.nuxeo.elasticsearch.web.sync.UIThreadMarker.doFilter(UIThreadMarker.java:48)
        	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
        	at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        	at org.nuxeo.ecm.platform.web.common.requestcontroller.filter.NuxeoThreadTrackerFilter.doFilter(NuxeoThreadTrackerFilter.java:43)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        	at org.nuxeo.ecm.platform.web.common.requestcontroller.filter.NuxeoStandbyFilter.doFilter(NuxeoStandbyFilter.java:67)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        	at org.nuxeo.ecm.core.management.jtajca.internal.Log4jWebFilter.doFilter(Log4jWebFilter.java:69)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        	at org.nuxeo.ecm.platform.ui.web.rest.FancyURLFilter.doFilter(FancyURLFilter.java:120)
        	... 36 more
        Caused by: javax.faces.el.EvaluationException: org.nuxeo.ecm.core.api.NuxeoException: org.nuxeo.ecm.automation.OperationException: Failed to invoke operation Render.Document
        	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101)
        	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
        	at javax.faces.component.UICommand.broadcast(UICommand.java:315)
        	at org.nuxeo.ecm.platform.ui.web.component.holder.UIValueHolder.broadcast(UIValueHolder.java:95)
        	at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
        	at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
        	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
        	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
        	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
        	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
        	... 61 more
        Caused by: org.nuxeo.ecm.core.api.NuxeoException: org.nuxeo.ecm.automation.OperationException: Failed to invoke operation Render.Document
        	at org.nuxeo.ecm.automation.core.events.EventHandlerRegistry.handleEvent(EventHandlerRegistry.java:134)
        	at org.nuxeo.ecm.automation.core.events.OperationEventListener.handleEvent(OperationEventListener.java:40)
        	at org.nuxeo.ecm.core.event.impl.EventServiceImpl.fireEvent(EventServiceImpl.java:242)
        	at org.nuxeo.ecm.core.api.AbstractSession.notifyEvent(AbstractSession.java:265)
        	at org.nuxeo.ecm.core.api.AbstractSession.createDocument(AbstractSession.java:725)
        	at org.nuxeo.ecm.webapp.contentbrowser.DocumentActionsBean.saveDocument(DocumentActionsBean.java:319)
        	at org.nuxeo.ecm.webapp.contentbrowser.DocumentActionsBean.saveDocument(DocumentActionsBean.java:290)
        	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        	at java.lang.reflect.Method.invoke(Method.java:497)
        	at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
        	at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
        	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
        	at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
        	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
        	at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:79)
        	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
        	at org.nuxeo.ecm.platform.ui.web.util.NuxeoExceptionInterceptor.aroundInvoke(NuxeoExceptionInterceptor.java:80)
        	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
        	at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
        	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
        	at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
        	at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:196)
        	at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:114)
        	at org.nuxeo.ecm.webapp.contentbrowser.DocumentActionsBean_$$_javassist_seam_70.saveDocument(DocumentActionsBean_$$_javassist_seam_70.java)
        	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        	at java.lang.reflect.Method.invoke(Method.java:497)
        	at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335)
        	at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
        	at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
        	at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
        	at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
        	at org.nuxeo.ecm.platform.ui.web.binding.MetaMethodExpression.invoke(MetaMethodExpression.java:140)
        	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
        	... 70 more
        Caused by: org.nuxeo.ecm.automation.OperationException: Failed to invoke operation Render.Document
        	at org.nuxeo.ecm.automation.core.impl.InvokableMethod.invoke(InvokableMethod.java:189)
        	at org.nuxeo.ecm.automation.core.impl.OperationChainCompiler$OperationMethod.invoke(OperationChainCompiler.java:151)
        	at org.nuxeo.ecm.automation.core.impl.OperationChainCompiler$OperationMethod.invoke(OperationChainCompiler.java:158)
        	at org.nuxeo.ecm.automation.core.impl.OperationChainCompiler$OperationMethod.invoke(OperationChainCompiler.java:158)
        	at org.nuxeo.ecm.automation.core.impl.OperationChainCompiler$OperationMethod.invoke(OperationChainCompiler.java:158)
        	at org.nuxeo.ecm.automation.core.impl.OperationChainCompiler$OperationMethod.invoke(OperationChainCompiler.java:158)
        	at org.nuxeo.ecm.automation.core.impl.OperationChainCompiler$OperationMethod.invoke(OperationChainCompiler.java:158)
        	at org.nuxeo.ecm.automation.core.impl.OperationChainCompiler$OperationMethod.invoke(OperationChainCompiler.java:158)
        	at org.nuxeo.ecm.automation.core.impl.OperationChainCompiler$OperationMethod.invoke(OperationChainCompiler.java:158)
        	at org.nuxeo.ecm.automation.core.impl.OperationChainCompiler$CompiledChainImpl.lambda$invoke$0(OperationChainCompiler.java:218)
        	at org.nuxeo.ecm.automation.OperationContext.call(OperationContext.java:326)
        	at org.nuxeo.ecm.automation.OperationContext.callWithChainParameters(OperationContext.java:291)
        	at org.nuxeo.ecm.automation.core.impl.OperationChainCompiler$CompiledChainImpl.invoke(OperationChainCompiler.java:215)
        	at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:115)
        	at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:91)
        	at org.nuxeo.ecm.automation.core.events.EventHandlerRegistry.handleEvent(EventHandlerRegistry.java:130)
        	... 106 more
        	Suppressed: java.lang.Throwable: 
        
        ****** chain ******
        Name: test_automation_chain
        Exception: OperationException
        Caught error: Failed to invoke operation Render.Document
        Caused by: org.nuxeo.ecm.automation.OperationException: Failed to invoke operation Render.Document
        ****** Hierarchy calls ******
        	org.nuxeo.ecm.automation.core.operations.FetchContextDocument
        		org.nuxeo.ecm.automation.core.operations.stack.PushDocument
        			org.nuxeo.ecm.automation.core.operations.document.GetDocumentParent
        				org.nuxeo.ecm.automation.core.operations.SetVar
        					org.nuxeo.ecm.automation.core.operations.stack.PopDocument
        						org.nuxeo.ecm.automation.core.operations.document.SetDocumentProperty
        							org.nuxeo.ecm.automation.core.operations.SetInputAsVar
        								org.nuxeo.ecm.automation.core.rendering.operations.RenderDocument
        
        		at org.nuxeo.ecm.automation.core.trace.TracerFactory.onTrace(TracerFactory.java:198)
        		at org.nuxeo.ecm.automation.core.trace.Tracer.popContext(Tracer.java:73)
        		at org.nuxeo.ecm.automation.core.trace.Tracer.onChainExit(Tracer.java:86)
        		at org.nuxeo.ecm.automation.core.impl.OperationChainCompiler$CompiledChainImpl.lambda$invoke$0(OperationChainCompiler.java:227)
        		... 112 more
        Caused by: org.nuxeo.ecm.platform.rendering.api.RenderingException: java.io.FileNotFoundException: JAR entry data/templates/test_document_template not found in /home/karin/Nuxeo/distribution/date-based/nuxeo-server-10.3-I20181129_2333-tomcat/nxserver/bundles/ktouchie-SANDBOX-studio-jsf-release-tests-without-branding-without-url-SNAPSHOT.jar
        	at org.nuxeo.ecm.platform.rendering.fm.FreemarkerEngine.render(FreemarkerEngine.java:199)
        	at org.nuxeo.ecm.automation.core.rendering.FreemarkerRender.render(FreemarkerRender.java:84)
        	at org.nuxeo.ecm.automation.core.rendering.RenderingService.render(RenderingService.java:51)
        	at org.nuxeo.ecm.automation.core.rendering.operations.RenderDocument.run(RenderDocument.java:68)
        	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        	at java.lang.reflect.Method.invoke(Method.java:497)
        	at org.nuxeo.ecm.automation.core.impl.InvokableMethod.doInvoke(InvokableMethod.java:174)
        	at org.nuxeo.ecm.automation.core.impl.InvokableMethod.invoke(InvokableMethod.java:179)
        	... 121 more
        Caused by: java.io.FileNotFoundException: JAR entry data/templates/test_document_template not found in /home/karin/Nuxeo/distribution/date-based/nuxeo-server-10.3-I20181129_2333-tomcat/nxserver/bundles/ktouchie-SANDBOX-studio-jsf-release-tests-without-branding-without-url-SNAPSHOT.jar
        	at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:142)
        	at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:150)
        	at freemarker.cache.URLTemplateSource.getInputStream(URLTemplateSource.java:117)
        	at freemarker.cache.URLTemplateLoader.getReader(URLTemplateLoader.java:54)
        	at org.nuxeo.ecm.platform.rendering.fm.ResourceTemplateLoader.getReader(ResourceTemplateLoader.java:96)
        	at freemarker.cache.TemplateCache.loadTemplate(TemplateCache.java:547)
        	at freemarker.cache.TemplateCache.getTemplateInternal(TemplateCache.java:439)
        	at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:292)
        	at freemarker.template.Configuration.getTemplate(Configuration.java:2750)
        	at freemarker.template.Configuration.getTemplate(Configuration.java:2599)
        	at org.nuxeo.ecm.platform.rendering.fm.FreemarkerEngine.render(FreemarkerEngine.java:191)
        	... 130 more
        

      The jar does indeed contain the template (see attachment).

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours
                  2h