0

I've got a weird one on a JBoss 7.2.2 instance. The webapp works flawlessly in Tomcat 7.x JSF 2.2.

javax.servlet.ServletException: /WEB-INF/template.xhtml @10,38 Attribute 'src', 'file' or 'page' is required

Here is the "faulty" template (WEB-INF/template.xhtml).

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">

    <h:head>
      <title><ui:insert name="title">My Web App</ui:insert></title>

As far as I know <ui:insert> supports only the name attribute I suspect a namespace collision but am clueless...

And here is the full stack trace

javax.servlet.ServletException: /WEB-INF/template.xhtml @10,38 <ui:insert> Attribute 'src', 'file' or 'page' is required
     javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
     org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71)

JBWEB000071: root cause

javax.faces.view.facelets.FaceletException: /WEB-INF/template.xhtml @10,38 <ui:insert> Attribute 'src', 'file' or 'page' is required
     com.sun.faces.facelets.tag.AbstractTagLibrary$UserComponentHandlerFactory.createHandler(AbstractTagLibrary.java:309)
     com.sun.faces.facelets.tag.AbstractTagLibrary.createTagHandler(AbstractTagLibrary.java:676)
     com.sun.faces.facelets.tag.CompositeTagLibrary.createTagHandler(CompositeTagLibrary.java:184)
     com.sun.faces.facelets.compiler.TagUnit.createFaceletHandler(TagUnit.java:120)
     com.sun.faces.facelets.compiler.TextUnit.createFaceletHandler(TextUnit.java:117)
     com.sun.faces.facelets.compiler.CompilationUnit.getNextFaceletHandler(CompilationUnit.java:115)
     com.sun.faces.facelets.compiler.NamespaceUnit.createFaceletHandler(NamespaceUnit.java:82)
     com.sun.faces.facelets.compiler.CompilationUnit.getNextFaceletHandler(CompilationUnit.java:115)
     com.sun.faces.facelets.compiler.CompilationUnit.createFaceletHandler(CompilationUnit.java:106)
     com.sun.faces.facelets.compiler.CompilationManager.createFaceletHandler(CompilationManager.java:373)
     com.sun.faces.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:441)
     com.sun.faces.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:403)
     com.sun.faces.facelets.compiler.Compiler.compile(Compiler.java:124)
     com.sun.faces.facelets.impl.DefaultFaceletFactory.createFacelet(DefaultFaceletFactory.java:319)
     com.sun.faces.facelets.impl.DefaultFaceletFactory.access$100(DefaultFaceletFactory.java:92)
     com.sun.faces.facelets.impl.DefaultFaceletFactory$1.newInstance(DefaultFaceletFactory.java:159)
     com.sun.faces.facelets.impl.DefaultFaceletFactory$1.newInstance(DefaultFaceletFactory.java:157)
     com.sun.faces.facelets.impl.DefaultFaceletCache$1.newInstance(DefaultFaceletCache.java:79)
     com.sun.faces.facelets.impl.DefaultFaceletCache$1.newInstance(DefaultFaceletCache.java:74)
     com.sun.faces.util.ExpiringConcurrentCache$1.call(ExpiringConcurrentCache.java:99)
     java.util.concurrent.FutureTask.run(FutureTask.java:262)
     com.sun.faces.util.ExpiringConcurrentCache.get(ExpiringConcurrentCache.java:114)
     com.sun.faces.facelets.impl.DefaultFaceletCache.getFacelet(DefaultFaceletCache.java:117)
     com.sun.faces.facelets.impl.DefaultFaceletCache.getFacelet(DefaultFaceletCache.java:58)
     com.sun.faces.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:256)
     com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:378)
     com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:358)
     com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199)
     com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:155)
     com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
     com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87)
     com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:164)
     com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:902)
     com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:99)
     com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
     com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
     javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
     org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71)
Alain Pannetier
  • 9,315
  • 3
  • 41
  • 46
  • 1
    Tomcat as being a barebones servletcontainer doesn't ship with JSF, so you have to bundle it (and JSTL) manually in webapp. However, JBoss AS is a fullfledged Java EE application server already ships with JSF (and JSTL) bundled. Any webapp-provided ones would only result in conflicts. Are you aware of this? Possibly related/duplicate: http://stackoverflow.com/q/8081234 – BalusC Jun 14 '16 at 10:19
  • Thanks Ballusc. Yes, I'm aware of this and I've run several tests before porting the tomcat webapp. Some from your collection of JSF answers. The only difference I noticed is that I needed to explicitly declare the JSF servlet in web.xml (but I always had the jars included). So now that you reminded me of this, I looked into JBoss modules and it looks like it supports only JSF 2.1. ls ../modules/system/layers/base/com/sun/jsf-impl/main jsf-impl-2.1.19-redhat-2.jar. So I guess it's time to [upgrade](http://stackoverflow.com/questions/17085717/upgrade-jsf-mojarra-in-jboss-as-eap-wildfly) – Alain Pannetier Jun 14 '16 at 11:06

1 Answers1

0

Thanks to BalusC's comment I had a look at the JSF modules in JBoss and it was clear that AS 7.2.2 comes with Mojara 2.1.19 only (not 2.2.x - of which I was using a number of facelets features).

So I followed his upgrade howto as well as this one on JBossDeveloper and my JBoss 7.2.2 now supports JSF 2.2.13.

And with this, the webapp works in the same way as in Tomcat with the same jars (in the war in Tomcat's case).

Community
  • 1
  • 1
Alain Pannetier
  • 9,315
  • 3
  • 41
  • 46