dev@jsftemplating.java.net

Re: JSFTemplating: I keep getting "com.sun.jsftemplating.layout.LayoutDefinitionException"

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Thu, 28 Sep 2006 10:24:31 -0700

This problem is b/c both facelets and JSFTemplating are installed in
your application and both are trying to handle the request. This
exception should be non-fatal in JSFTemplating and is warning you that
it didn't recognize the page you requested (because it was a Facelets
page). The ViewHandler should then delegate to another ViewHandler (the
faces ViewHandler) and the page should display (unless there are other
errors).

To answer your question... the LayoutDefinitionManager instances are
created automatically (by the LayoutDefinitionManger class itself). Only
one LDM is needed per file format (2 are currently supported). A custom
LDM can be provided via the servlet initParam:
"LayoutDefinitionManagerImpl" .. this is *not* required or even
recommended. Bot JSFTemplating file formats are supported
out-of-the-box. The LDM instances are responsible for implementing a
method called "accepts(String)" which is used to see if the LDM can
handle a particular "viewId". The .faces requests that you are sending
are not handled by either LDM b/c they are Facelets pages, not
JSFTemplating pages.

It would be interesting to write an LDM that handled Facetlets pages...
that doesn't exist today, though, and would likely be a significant
effort. You would also lose most of the benefits of Facelets (although
you'd gain all the benefits of JSFTemplating -- many of which are
identical benefits to Facelets).

Ken

Todd Patrick wrote:
> How do I create a LayoutDefinitionManager?
>
> I've been looking at the JavaDocs at
> https://jsftemplating.dev.java.net/nonav/javadoc/index.html and this is
> somewhat confusing.
>
> Thanks,
>
> --Todd
>
>
> com.sun.jsftemplating.layout.LayoutDefinitionException: No
> LayoutDefinitionManager available for 'eaigft/eaigft.faces'. This may
> mean the file cannot be found, or is unrecognizable.
> at
> com.sun.jsftemplating.layout.LayoutDefinitionManager.getLayoutDefinition
> Manager(LayoutDefinitionManager.java:251)
> at
> com.sun.jsftemplating.layout.LayoutDefinitionManager.getLayoutDefinition
> (LayoutDefinitionManager.java:208)
> at
> com.sun.jsftemplating.layout.LayoutViewRoot.getLayoutDefinition(LayoutVi
> ewRoot.java:227)
> at
> com.sun.jsftemplating.layout.LayoutViewHandler.createView(LayoutViewHand
> ler.java:128)
> at
> com.sun.facelets.FaceletViewHandler.createView(FaceletViewHandler.java:7
> 82)
> at
> com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:1
> 64)
> at
> com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
> at
> com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
> at
> javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
> tionFilterChain.java:237)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
> erChain.java:157)
> at
> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(Filt
> erChainProxy.java:264)
> at
> org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterS
> ecurityInterceptor.java:107)
> at
> org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(Filte
> rSecurityInterceptor.java:72)
> at
> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(Filt
> erChainProxy.java:274)
> at
> org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTransl
> ationFilter.java:110)
> at
> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(Filt
> erChainProxy.java:274)
> at
> org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter
> (AnonymousProcessingFilter.java:125)
> at
> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(Filt
> erChainProxy.java:274)
> at
> org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilt
> er(SecurityContextHolderAwareRequestFilter.java:81)
> at
> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(Filt
> erChainProxy.java:274)
> at
> org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessin
> gFilter.java:217)
> at
> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(Filt
> erChainProxy.java:274)
> at
> org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:108)
> at
> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(Filt
> erChainProxy.java:274)
> at
> org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(Reme
> mberMeProcessingFilter.java:142)
> at
> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(Filt
> erChainProxy.java:274)
> at
> org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(H
> ttpSessionContextIntegrationFilter.java:191)
> at
> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(Filt
> erChainProxy.java:274)
> at
> org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:1
> 48)
> at
> org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java
> :90)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
> tionFilterChain.java:186)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
> erChain.java:157)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
> e.java:214)
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
> ntext.java:104)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
> 20)
> at
> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardCon
> textValve.java:198)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
> e.java:152)
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
> ntext.java:104)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
> 20)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
> :137)
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
> ntext.java:104)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
> :118)
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
> ntext.java:102)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
> 20)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
> java:109)
> at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
> ntext.java:104)
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
> 20)
> at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
> at
> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:79
> 9)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC
> onnection(Http11Protocol.java:705)
> at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:57
> 7)
> at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
> .java:683)
> at java.lang.Thread.run(Thread.java:595)
>
> -----Original Message-----
> From: Todd Patrick [mailto:Todd.Patrick_at_dtn.com]
> Sent: Thursday, September 28, 2006 9:54 AM
> To: dev_at_jsftemplating.dev.java.net
> Subject: JSFTemplating: I keep getting
> "com.sun.jsftemplating.layout.LayoutDefinitionException"
>
> I think I am close, but I keep returning the exception:
>
> com.sun.jsftemplating.layout.LayoutDefinitionException
>
> My .xhtml page is:
>
> <!DOCTYPE layoutDefinition SYSTEM "/jsftemplating/layout.dtd"> <html
> xmlns="http://www.w3.org/1999/xhtml"
> xmlns:ui="http://java.sun.com/jsf/facelets"
> xmlns:h="http://java.sun.com/jsf/html"
> xmlns:f="http://java.sun.com/jsf/core"
> xmlns:rave="http://www.sun.com/web/ui">
> <ui:composition template="/common/template.xhtml">
>
> <ui:define name="title">Petro Admin: EAI/GFT</ui:define>
>
> <ui:define name="body">
> <layoutDefinition>
> <layout>
> <component type="staticText" id="hello">
> <option name="value"
> value="Hello World!" />
> </component>
> </layout>
> </layoutDefinition>
> </ui:define>
> </ui:composition>
> </html>
>
> I tried using just straight rave components in the page such as:
>
> <rave:staticText text="Hello World!" />
>
> But that throws the same exception.
>
> Thoughts?
>
> Thanks,
>
> --Todd
>