0

I am setting a JSF include dynamically from a bean: <ui:include src="#{criteriaBean.criteriaPage}" /> and it works just fine if the criteria page is located on the root of the WebContent of the project.

For maintenance purposes, I want to have these include files in their own folder.

However, if I try to put the content into a folder, either on the root of WebContent or inside of WEB-INF, update the criteriaBean so the path looks correct there, and try to load the page, I am getting javax.faces.view.facelets.TagAttributeException stating that the path is invalid.

I have even tried not using the bean and hard coding a value to test with: <ui:include src="/WEB-INF/rptCriteria/test.xhtml" /> and with <ui:include src="/rptCriteria/test.xhtml" />, but I get the same error.

Ideally, I would like the WEB-INF folder to work.

Any ideas what I could be missing?

Here is the full stack trace:

10:09:11,585 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/SAAS].[Faces Servlet]] (http-/0.0.0.0:8888-5) JBWEB000236: Servlet.service() for servlet Faces Servlet threw exception: javax.faces.view.facelets.TagAttributeException: /reportCriteria.xhtml @23,65 <ui:include src="/WEB-INF/rptCriteria/notDefined.xhtml"> Invalid path : /WEB-INF/rptCriteria/notDefined.xhtml
at com.sun.faces.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:125) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:116) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
at com.sun.faces.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.java:106) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:178) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:395) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:366) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:111) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:187) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:187) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:320) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:379) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:358) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:155) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:164) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:902) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:99) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.1.19-redhat-1.jar:2.1.19-redhat-1]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [jboss-jsf-api_2.1_spec-2.1.19.1.Final-redhat-1.jar:2.1.19.1.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at gov.irs.saas.filter.SaasFilter.doFilter(SaasFilter.java:132) [classes:]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
Ruminator
  • 129
  • 3
  • 13
  • Should work. Look at the example from : http://stackoverflow.com/questions/4792862/how-to-include-another-xhtml-in-xhtml-using-jsf-2-0-facelets. Can you show us the project structure? – Ioan Jun 20 '14 at 14:13
  • @loan - sorry, moving from Apache Wicket to JSF, so I'm not sure what you mean by a project map. – Ruminator Jun 20 '14 at 14:15
  • Sorry, I meant the project structure. Can you show us the entire stacktrace ? – Ioan Jun 20 '14 at 14:16
  • @loan I added the stack trace – Ruminator Jun 20 '14 at 14:23
  • It looks like it might be due to Eclipse not saving the `xhtml` files as `UTF-8`. I changed the default encoding to `UTF-8` for `xhtml` and restarted Eclipse. This seems to have worked, but I had also tried a lot of other things. I will be attempting to recreate this with another project having the same issue on Monday. – Ruminator Jun 20 '14 at 20:24

1 Answers1

0

The root issue seems to be tied to the fact that Eclipse did not have a default encoding set for xhtml files. Even though the individual files started with <?xml version="1.0" encoding="UTF-8" /> - when the files were deployed to JBoss EAP 6.1, there were issues.

I updated Eclipse (Window -> Preferences -> General + Content Types + Text) to ensure that all of the xhtml files had a default encoding set to UTF-8, and after restarting Eclipse and redeploying to code, the exception went away and everything works as expected now.

This was validated on another machine as well.

Ruminator
  • 129
  • 3
  • 13