Hi, so far I have only used MyFaces and currently I am trying to use the ADF-Faces Components with it.
The impression I had about using Tiles with ADF and MyFaces was that I should use the Tiles Servlet because ADF uses its own ViewHandler which would collide with the MyFaces JspTilesViewHandler I used before. When I was reading Adam's way of setting an alternate ViewHandler in a context-param I had the idea of using the MyFaces JspTilesViewHandlerImpl in a similar way for my JSP-based application. It works quite well though I encountered a ClassCastException in the UIXComponentTag class where a UIXComponent is needed in the setProperties Method. So I put an "if(component instanceof UIXComponent)" inside this Method and it worked. Now the reason for this posting is this: Am I going in the right direction here? Are there any side-effects with using the MyFaces ViewHandler inside an ADF context? Or maybe there is a different way of getting the advantages of the MyFacesViewHandler (e.g. direct usage of tiles-definitions in navigation rules)? Maybe anyone here has already used the combination of JSPs, MyFaces, Tiles, ADF and can give some advice. M.Soulier -----Ursprüngliche Nachricht----- Von: Adam Winer [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 21. März 2006 06:50 An: MyFaces Discussion Betreff: Re: java.lang.NullPointerException during render phase when using ADF and MyFaces Tomahwak components together Murray, You need to install the FaceletViewHandler using: <context-param> <param-name>oracle.adf.view.faces.ALTERNATE_VIEW_HANDLER</param-name> <param-value>com.sun.facelets.FaceletViewHandler</param-value> </context-param> in WEB-INF/web.xml, not in faces-config.xml. Also, not that it's related to this issue, you need to install the ADF Faces Filter. Check out the config posted in the other thread for all the details. -- Adam On 3/20/06, Murray Brandon <[EMAIL PROTECTED]> wrote: > Apologies if this topic has been done to death in the group as I've just > joined. > I'm sure it's something to do with my configuration of web.xml or > faces-config.xml, but what? > Either the AdfRenderingContext isn't attached to the thread or > getProperties() is returning null. > I'm using the dump of ADF attached to the myfaces site (ie. > adf-faces-impl-ea20-SNAPSHOT). > I don't think it is trying to render any of the ADF tags (same null > pointer if I comment out the ADF tags), > this is on render of tomahawk/myfaces tags. > > Any help appreciated! > > Regards, Murray > ======================================================================== > === > > SEVERE: Error Rendering View[/main.xhtml] > java.lang.NullPointerException > at > oracle.adfinternal.view.faces.uinode.FacesRenderingContext.setRenderingP > roperty(FacesRenderingContext.java:157) > at > oracle.adfinternal.view.faces.ui.RenderedNodeRenderingContext.setPropert > y(RenderedNodeRenderingContext.java:162) > at > oracle.adfinternal.view.faces.ui.RootRenderingContext.init(RootRendering > Context.java:81) > at > oracle.adfinternal.view.faces.uinode.FacesRenderingContext.<init>(FacesR > enderingContext.java:106) > at > oracle.adfinternal.view.faces.uinode.FacesRenderingContext.createRenderi > ngContext(FacesRenderingContext.java:79) > at > oracle.adfinternal.view.faces.uinode.UINodeRendererBase.getRenderingCont > ext(UINodeRendererBase.java:89) > at > oracle.adfinternal.view.faces.uinode.FacesRenderingContext.getRenderingC > ontext(FacesRenderingContext.java:66) > at > oracle.adfinternal.view.faces.uinode.FacesRenderingContext.getRenderingC > ontext(FacesRenderingContext.java:52) > at > oracle.adfinternal.view.faces.renderkit.htmlBasic.UINodeRenderer.getRend > eringContext(UINodeRenderer.java:79) > at > oracle.adfinternal.view.faces.renderkit.htmlBasic.UINodeRenderer.encodeB > egin(UINodeRenderer.java:38) > at > javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:5 > 12) > at > com.sun.facelets.FaceletViewHandler.encodeRecursive(FaceletViewHandler.j > ava:555) > at > com.sun.facelets.FaceletViewHandler.encodeRecursive(FaceletViewHandler.j > ava:562) > at > com.sun.facelets.FaceletViewHandler.encodeRecursive(FaceletViewHandler.j > ava:562) > at > com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:4 > 57) > at > org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:367 > ) > at > javax.faces.webapp.FacesServlet.service(FacesServlet.java:138) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica > tionFilterChain.java:252) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt > erChain.java:173) > at > org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFil > ter.java:130) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica > tionFilterChain.java:202) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt > erChain.java:173) > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv > e.java:213) > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv > e.java:178) > at > org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator > Base.java:432) > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java > :126) > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java > :105) > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. > java:107) > at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1 > 48) > at > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:86 > 9) > at > org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.proc > essConnection(Http11BaseProtocol.java:667) > at > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint > .java:527) > at > org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollow > erWorkerThread.java:80) > at > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool > .java:684) > at java.lang.Thread.run(Thread.java:595) > > > From FacesRenderingContext.java: > > protected void setRenderingProperty(Object key, Object value) > { > _adfRenderingContext.getProperties().put(key, value); > } > > > web.xml > > <?xml version='1.0' encoding='UTF-8'?> > > <!DOCTYPE web-app PUBLIC > "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" > "http://java.sun.com/dtd/web-app_2_3.dtd"> > > > <web-app> > : > : > <context-param> > <param-name>facelets.LIBRARIES</param-name> > > <param-value>/WEB-INF/facelet/aui.taglib.xml;/WEB-INF/facelet/tomahawk.t > aglib.xml;/WEB-INF/facelet/af.taglib.xml</param-value> > </context-param> > > <context-param> > <param-name>javax.faces.STATE_SAVING_METHOD</param-name> > <param-value>client</param-value> > </context-param> > > <context-param> > <param-name>facelets.DEVELOPMENT</param-name> > <param-value>true</param-value> > </context-param> > > <context-param> > <param-name>javax.faces.DEFAULT_SUFFIX</param-name> > <param-value>.xhtml</param-value> > </context-param> > > <context-param> > <param-name>com.sun.faces.validateXml</param-name> > <param-value>false</param-value> > <description> > Set this flag to true if you want the JavaServer Faces > Reference Implementation to validate the XML in your > faces-config.xml resources against the DTD. Default > value is false. > </description> > </context-param> > > <context-param> > <param-name>com.sun.faces.verifyObjects</param-name> > <param-value>true</param-value> > <description> > Set this flag to true if you want the JavaServer Faces > Reference Implementation to verify that all of the > application > objects you have configured (components, converters, > renderers, and validators) can be successfully created. > Default value is false. > </description> > </context-param> > > <!-- Faces Servlet --> > <servlet> > <servlet-name>Faces Servlet</servlet-name> > <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> > <load-on-startup> 1 </load-on-startup> > </servlet> > > <!-- Faces Servlet Mapping --> > <servlet-mapping> > <servlet-name>Faces Servlet</servlet-name> > <url-pattern>*.jsf</url-pattern> > </servlet-mapping> > > <security-constraint> > <!-- This security constraint illustrates how JSP pages > with JavaServer Faces components can be protected from > being accessed without going through the Faces Servlet. > The security constraint ensures that the Faces Servlet will > be used or the pages will not be processed. --> > <display-name>Restrict access to JSP pages</display-name> > <web-resource-collection> > <web-resource-name> > Restrict access to JSP pages > </web-resource-name> > <url-pattern>/greeting.xhtml</url-pattern> > <url-pattern>/response.xhtml</url-pattern> > </web-resource-collection> > <auth-constraint> > <description> > With no roles defined, no access granted > </description> > </auth-constraint> > </security-constraint> > > > <!-- XXXXXXXXXXXXXXXXXXXXXX Apache MyFaces XXXXXXXXXXXXXXXXXXXXXXXX > --> > <filter> > <filter-name>MyFacesExtensionsFilter</filter-name> > > <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter- > class> > <init-param> > <param-name>maxFileSize</param-name> > <param-value>20m</param-value>> <description>Set the > size limit for uploaded files. > Format: 10 - 10 bytes > 10k - 10 KB > 10m - 10 MB > 1g - 1 GB > </description> > </init-param> > </filter> > > <!-- extension mapping for adding <script/>, <link/>, and other > resource tags to JSF-pages --> > <filter-mapping> > <filter-name>MyFacesExtensionsFilter</filter-name> > <servlet-name>Faces Servlet</servlet-name> > </filter-mapping> > > <!-- extension mapping for serving page-independent resources > (javascript, stylesheets, images, etc.) --> > <filter-mapping> > <filter-name>MyFacesExtensionsFilter</filter-name> > <url-pattern>/faces/myFacesExtensionResource/*</url-pattern> > </filter-mapping> > > > <!-- XXXXXXXXXXXXXXXXXXXXXX Oracle ADF faces XXXXXXXXXXXXXXXXXXXXXX > --> > <context-param> > <param-name>oracle.adf.view.faces.ALTERNATE_VIEW_HANDLER > </param-name> > <param-value>com.sun.facelets.FaceletViewHandler > </param-value> > </context-param> > > <context-param> > <param-name>facelets.VIEW_MAPPINGS</param-name> > <param-value>*.xhtml</param-value> > </context-param> > > <servlet-mapping> > <servlet-name>Faces Servlet</servlet-name> > <url-pattern>/faces/*</url-pattern> > </servlet-mapping> > </web-app> > > > > faces-config.xml: > > <?xml version="1.0"?> > > > <!DOCTYPE faces-config PUBLIC > "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN" > "http://java.sun.com/dtd/web-facesconfig_1_0.dtd"> > > <faces-config> > > <application> > <view-handler>com.sun.facelets.FaceletViewHandler</view-handler> > </application> > > <application> > <locale-config> > <default-locale>en_UK</default-locale> > </locale-config> > </application> > > <application> > <default-render-kit-id> > oracle.adf.core > </default-render-kit-id> > </application> > > </faces-config> > >