You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Murray Brandon <mu...@hotmagna.com> on 2006/03/21 05:11:39 UTC

java.lang.NullPointerException during render phase when using ADF and MyFaces Tomahwak components together

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>


AW: java.lang.NullPointerException during render phase when using ADF and MyFaces Tomahwak components together

Posted by Marcel Soulier <ma...@opitz-consulting.de>.
Hi Adam,

sorry that it took me 2 days to reply but I was working on a different project.

Using JSP and MyFaces is kind of a historical thing. I started with JSP and Struts, added Tiles, replaced Struts with MyFaces and now added ADF.
Facelets is something I haven't tried yet.

About the ClassCastException I had:

Right now I can't reproduce it anymore. Might be something else I changed in my application.

But anyway, if the signature of the method "protected final void setProperties(UIComponent component)" allows a UIComponent, I would expect that any casting to UIXComponent would make sure if this is possible first.

M.Soulier


-----Ursprüngliche Nachricht-----
Von: Adam Winer [mailto:awiner@gmail.com] 
Gesendet: Dienstag, 21. März 2006 19:03
An: MyFaces Discussion
Betreff: Re: java.lang.NullPointerException during render phase when using ADF and MyFaces Tomahwak components together

I confess, I haven't tried Tiles with ADF, largely because Facelets templating
is so vastly superior to Tiles (esp. Tiles w/JSF, which is not a good
combination.)

I'm curious about this class-cast exception you're seeing:  why do
you have a UIXComponentTag that isn't using a UIXComponent?
What tag was this?

-- Adam



On 3/21/06, Marcel Soulier <ma...@opitz-consulting.de> wrote:
> 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:awiner@gmail.com]
> 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 <mu...@hotmagna.com> 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>
> >
> >
>
>
>



Re: java.lang.NullPointerException during render phase when using ADF and MyFaces Tomahwak components together

Posted by Adam Winer <aw...@gmail.com>.
I confess, I haven't tried Tiles with ADF, largely because Facelets templating
is so vastly superior to Tiles (esp. Tiles w/JSF, which is not a good
combination.)

I'm curious about this class-cast exception you're seeing:  why do
you have a UIXComponentTag that isn't using a UIXComponent?
What tag was this?

-- Adam



On 3/21/06, Marcel Soulier <ma...@opitz-consulting.de> wrote:
> 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:awiner@gmail.com]
> 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 <mu...@hotmagna.com> 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>
> >
> >
>
>
>

Re: java.lang.NullPointerException during render phase when using ADF and MyFaces Tomahwak components together

Posted by Matt Tyson <ma...@gmail.com>.
I'm seeing this issue using ADF 10.1.3.  I have the default renderer set to
adf's renderer, and when I try to render a t:commandlink inside a facet, I
see the following trace:

java.lang.NullPointerException
        at
oracle.adfinternal.view.faces.uinode.FacesRenderingContext.setRenderingProperty(FacesRenderingContext.java:157)
        at
oracle.adfinternal.view.faces.ui.RenderedNodeRenderingContext.setProperty(RenderedNodeRenderingContext.java:162)
        at
oracle.adfinternal.view.faces.ui.ServletRenderingContext._setContextProperty(ServletRenderingContext.java:309)
        at
oracle.adfinternal.view.faces.ui.ServletRenderingContext.setServletRequest(ServletRenderingContext.java:140)
        at
oracle.adfinternal.view.faces.ui.ServletRenderingContext.setServletRequest(ServletRenderingContext.java:163)
        at
oracle.adfinternal.view.faces.ui.ServletRenderingContext.init(ServletRenderingContext.java:113)
        at
oracle.adfinternal.view.faces.ui.ServletRenderingContext.init(ServletRenderingContext.java:96)
        at
oracle.adfinternal.view.faces.uinode.FacesRenderingContext.<init>(FacesRenderingContext.java:106)
        at
oracle.adfinternal.view.faces.uinode.FacesRenderingContext.createRenderingContext(FacesRenderingContext.java:79)
        at
oracle.adfinternal.view.faces.uinode.UINodeRendererBase.getRenderingContext(UINodeRendererBase.java:89)
        at
oracle.adfinternal.view.faces.uinode.FacesRenderingContext.getRenderingContext(FacesRenderingContext.java:66)
        at
oracle.adfinternal.view.faces.uinode.FacesRenderingContext.getRenderingContext(FacesRenderingContext.java:52)
        at
oracle.adfinternal.view.faces.renderkit.htmlBasic.UINodeRenderer.getRenderingContext(UINodeRenderer.java:79)
        at
oracle.adfinternal.view.faces.renderkit.htmlBasic.UINodeRenderer.encodeEnd(UINodeRenderer.java:56)
        at
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
        at
org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererUtils.java:382)
        at
org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChildren(RendererUtils.java:363)
        at
org.apache.myfaces.shared_impl.renderkit.html.HtmlGroupRendererBase.encodeEnd(HtmlGroupRendererBase.java:75)
        at
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)

Looks like the adf renderer needs a faces context that isn't there.
-- 
View this message in context: http://www.nabble.com/java.lang.NullPointerException-during-render-phase-when-using-ADF-and-MyFaces-Tomahwak-components-together-tf1315507.html#a8043311
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: java.lang.NullPointerException during render phase when using ADF and MyFaces Tomahwak components together

Posted by Adam Winer <ad...@oracle.com>.
Murray Brandon wrote:
> Partially solved:
> 
> The problem is if you define adf core render kit as the default default
> render kit, some of the tomahawk/myfaces/facelets components have no
> rendering context (not sure which component, cos the exception helpfully
> does not tell me), hence the null pointer.

Exactly where was this NullPointerException?  We automatically incorporate
all the BASIC_HTML renderkit renderers, which is where the tomahawk
and myfaces renderers go.  What I can imagine is that our override of
<h:form> rendering is perhaps causing problems...  (We override h:form
to get client-side validation and partial-page rendering working.)

>     <application>
>         <default-render-kit-id>
>             oracle.adf.core
>         </default-render-kit-id>
>     </application>
> 
> However, if I don't define oracle.adf.core as the default render kit, I
> get real ADF components in the component tree but they don't render:
> 
> eg. component is:
> oracle.adf.view.faces.component.core.input.CoreChooseDate,
> renderer=oracle.adf.Date toString=CoreChooseDate[UINodeFacesBean,
> id=idp1]
> 
> The error is:
> 
> 	Mar 23, 2006 11:36:12 PM
> oracle.adf.view.faces.component.UIXComponentBase _getRendererImpl
> 	WARNING: Could not find renderer for
> CoreChooseDate[UINodeFacesBean, id=idp1], rendererType = oracle.adf.Date

Yes, exactly.  We need our renderers. :)

> I commented out the facelets view handler in faces-config.xml and added
> the following to web.xml
> (I can't seem to see the url http://tinyurl.com/dac6y for the example
> web.xml)
> 
>     <context-param>  
>  
> <param-name>oracle.adf.view.faces.ALTERNATE_VIEW_HANDLER</param-name>
>         <param-value>com.sun.facelets.FaceletViewHandler</param-value>
>     </context-param>
> 
> Can I define the ADF render kit just for the ADF components I want to
> use?

Nope.  We need the whole thing (there's some services
registered at the render kit level, for one).

> I presume the alternative is to define a render kit for the MyFaces
> components I want to use?

I don't think that's the issue here, because we do aggregate
in BASIC_HTML.

> Also, if I have the ADF jars in my WEB-INF/lib folder in the tree, I
> get:
> 
> java.lang.IllegalStateException: Duplicate id : _id0. Child could not be
> added.
> 
> The ADF jars are below:
> adf-faces-api-ea20-SNAPSHOT.jar
> adf-faces-api-ea20-SNAPSHOT-mock.jar
> adf-faces-build-ea20-SNAPSHOT.jar
> adf-faces-impl-ea20-SNAPSHOT.jar
> 
> Not exactly sure what the mock and build ones are for, but I left them
> in the .war anyway.

Not needed for runtime - mock is just for testing, build
is for building.

The exception listed below seems like an entirely Facelets
issue (doesn't seem ADF or MyFaces related.)  *seems*, but
maybe isn't.

-- Adam


> ===============< phase RENDER_RESPONSE(6)>===========
> Mar 24, 2006 2:14:34 AM com.sun.facelets.FaceletViewHandler renderView
> FINE: Rendering View: /main.xhtml
> Mar 24, 2006 2:14:34 AM com.sun.facelets.FaceletViewHandler
> getRenderedViewId
> FINE: ActionId -> ViewId: /main.xhtml -> /main.xhtml
> Mar 24, 2006 2:14:34 AM com.sun.facelets.FaceletViewHandler buildView
> FINE: Building View: /main.xhtml
> Mar 24, 2006 2:14:34 AM com.sun.facelets.tag.jsf.ComponentHandler apply
> FINE: /main.xhtml @12,23 <a:scopeTracker> Component[/main.xhtml#0]
> Found, marking children for cleanup
> Mar 24, 2006 2:14:34 AM com.sun.facelets.tag.jsf.ComponentHandler apply
> FINE: /main.xhtml @23,47 <ui:debug> Component[/main.xhtml#1] Created:
> com.sun.facelets.tag.ui.UIDebug
> Mar 24, 2006 2:14:34 AM com.sun.facelets.FaceletViewHandler
> handleRenderException
> SEVERE: Error Rendering View[/main.xhtml]
> java.lang.IllegalStateException: Duplicate id : _id0. Child could not be
> added.
>         at
> javax.faces.component._ComponentChildrenList.checkAddAllowed(_ComponentC
> hildrenList.java:95)
>         at
> javax.faces.component._ComponentChildrenList.add(_ComponentChildrenList.
> java:76)
>         at
> com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:17
> 5)
>         at
> com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandl
> er.java:47)
>         at
> com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:4
> 9)
>         at
> com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandl
> er.java:47)
>         at
> com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
>         at
> com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:40
> 8)
>         at
> com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:4
> 42)
>         at
> oracle.adfinternal.view.faces.application.ViewHandlerImpl.renderView(Vie
> wHandlerImpl.java:159)
>         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
> oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(
> AdfFacesFilterImpl.java:279)
>         at
> oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(Ad
> fFacesFilterImpl.java:248)
>         at
> oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFace
> sFilterImpl.java:172)
>         at
> oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java
> :80)
>         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.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFil
> ter.java:93)
>         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.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
> oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(
> AdfFacesFilterImpl.java:279)
>         at
> oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(Ad
> fFacesFilterImpl.java:248)
>         at
> oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFace
> sFilterImpl.java:172)
>         at
> oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java
> :80)
>         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)
> 
> Any help appreciated as this is driving me up the wall.  Sorry to spam
> both groups but I really don't know if my issue is Facelet related or
> MyFaces related.
> 
> Regards, Murray
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@facelets.dev.java.net
> For additional commands, e-mail: users-help@facelets.dev.java.net
> 


RE: java.lang.NullPointerException during render phase when using ADF and MyFaces Tomahwak components together

Posted by Murray Brandon <mu...@hotmagna.com>.
Partially solved:

The problem is if you define adf core render kit as the default default
render kit, some of the tomahawk/myfaces/facelets components have no
rendering context (not sure which component, cos the exception helpfully
does not tell me), hence the null pointer.

    <application>
        <default-render-kit-id>
            oracle.adf.core
        </default-render-kit-id>
    </application>

However, if I don't define oracle.adf.core as the default render kit, I
get real ADF components in the component tree but they don't render:

eg. component is:
oracle.adf.view.faces.component.core.input.CoreChooseDate,
renderer=oracle.adf.Date toString=CoreChooseDate[UINodeFacesBean,
id=idp1]

The error is:

	Mar 23, 2006 11:36:12 PM
oracle.adf.view.faces.component.UIXComponentBase _getRendererImpl
	WARNING: Could not find renderer for
CoreChooseDate[UINodeFacesBean, id=idp1], rendererType = oracle.adf.Date

I commented out the facelets view handler in faces-config.xml and added
the following to web.xml
(I can't seem to see the url http://tinyurl.com/dac6y for the example
web.xml)

    <context-param>  
 
<param-name>oracle.adf.view.faces.ALTERNATE_VIEW_HANDLER</param-name>
        <param-value>com.sun.facelets.FaceletViewHandler</param-value>
    </context-param>

Can I define the ADF render kit just for the ADF components I want to
use?
I presume the alternative is to define a render kit for the MyFaces
components I want to use?

I tried adding some code below to faces-config.xml but it made no
difference to the render.

  <render-kit>
    <render-kit-id>oracle.adf.core</render-kit-id>
    <renderer>
      <component-family>oracle.adf.Output</component-family>
      <renderer-type>oracle.adf.Formatted</renderer-type>
 
<renderer-class>oracle.adfinternal.view.faces.renderkit.core.xhtml.Outpu
tFormattedRenderer</renderer-class>
    </renderer>
    <renderer>
      <component-family>oracle.adf.Choose</component-family>
      <renderer-type>oracle.adf.Date</renderer-type>
 
<renderer-class>oracle.adfinternal.view.faces.renderkit.core.xhtml.Choos
eDateRenderer</renderer-class>
    </renderer>
    <renderer>
      <component-family>oracle.adf.Input</component-family>
      <renderer-type>oracle.adf.Text</renderer-type>
 
<renderer-class>oracle.adfinternal.view.faces.renderkit.core.xhtml.Input
TextRenderer</renderer-class>
    </renderer>
    <renderer>
      <component-family>oracle.adf.SelectInput</component-family>
      <renderer-type>oracle.adf.Date</renderer-type>
 
<renderer-class>oracle.adfinternal.view.faces.renderkit.core.xhtml.Selec
tInputDateRenderer</renderer-class>
    </renderer>
    <renderer>
      <component-family>oracle.adf.Object</component-family>
      <renderer-type>oracle.adf.Separator</renderer-type>
 
<renderer-class>oracle.adfinternal.view.faces.uinode.UINodeRendererBase<
/renderer-class>
    </renderer>
    <renderer>
      <component-family>oracle.adf.Command</component-family>
      <renderer-type>oracle.adf.Link</renderer-type>
 
<renderer-class>oracle.adfinternal.view.faces.renderkit.core.xhtml.Comma
ndLinkRenderer</renderer-class>
    </renderer>
    <renderer>
      <component-family>oracle.adf.Panel</component-family>
      <renderer-type>oracle.adf.Group</renderer-type>
 
<renderer-class>oracle.adfinternal.view.faces.renderkit.core.xhtml.Panel
GroupRenderer</renderer-class>
    </renderer>
  </render-kit>
    
Also, if I have the ADF jars in my WEB-INF/lib folder in the tree, I
get:

java.lang.IllegalStateException: Duplicate id : _id0. Child could not be
added.

The ADF jars are below:
adf-faces-api-ea20-SNAPSHOT.jar
adf-faces-api-ea20-SNAPSHOT-mock.jar
adf-faces-build-ea20-SNAPSHOT.jar
adf-faces-impl-ea20-SNAPSHOT.jar

Not exactly sure what the mock and build ones are for, but I left them
in the .war anyway.

===============< phase RENDER_RESPONSE(6)>===========
Mar 24, 2006 2:14:34 AM com.sun.facelets.FaceletViewHandler renderView
FINE: Rendering View: /main.xhtml
Mar 24, 2006 2:14:34 AM com.sun.facelets.FaceletViewHandler
getRenderedViewId
FINE: ActionId -> ViewId: /main.xhtml -> /main.xhtml
Mar 24, 2006 2:14:34 AM com.sun.facelets.FaceletViewHandler buildView
FINE: Building View: /main.xhtml
Mar 24, 2006 2:14:34 AM com.sun.facelets.tag.jsf.ComponentHandler apply
FINE: /main.xhtml @12,23 <a:scopeTracker> Component[/main.xhtml#0]
Found, marking children for cleanup
Mar 24, 2006 2:14:34 AM com.sun.facelets.tag.jsf.ComponentHandler apply
FINE: /main.xhtml @23,47 <ui:debug> Component[/main.xhtml#1] Created:
com.sun.facelets.tag.ui.UIDebug
Mar 24, 2006 2:14:34 AM com.sun.facelets.FaceletViewHandler
handleRenderException
SEVERE: Error Rendering View[/main.xhtml]
java.lang.IllegalStateException: Duplicate id : _id0. Child could not be
added.
        at
javax.faces.component._ComponentChildrenList.checkAddAllowed(_ComponentC
hildrenList.java:95)
        at
javax.faces.component._ComponentChildrenList.add(_ComponentChildrenList.
java:76)
        at
com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:17
5)
        at
com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandl
er.java:47)
        at
com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:4
9)
        at
com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandl
er.java:47)
        at
com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
        at
com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:40
8)
        at
com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:4
42)
        at
oracle.adfinternal.view.faces.application.ViewHandlerImpl.renderView(Vie
wHandlerImpl.java:159)
        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
oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(
AdfFacesFilterImpl.java:279)
        at
oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(Ad
fFacesFilterImpl.java:248)
        at
oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFace
sFilterImpl.java:172)
        at
oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java
:80)
        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.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFil
ter.java:93)
        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.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
oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(
AdfFacesFilterImpl.java:279)
        at
oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(Ad
fFacesFilterImpl.java:248)
        at
oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFace
sFilterImpl.java:172)
        at
oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java
:80)
        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)

Any help appreciated as this is driving me up the wall.  Sorry to spam
both groups but I really don't know if my issue is Facelet related or
MyFaces related.

Regards, Murray


AW: java.lang.NullPointerException during render phase when using ADF and MyFaces Tomahwak components together

Posted by Marcel Soulier <ma...@opitz-consulting.de>.
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:awiner@gmail.com] 
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 <mu...@hotmagna.com> 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>
>
>



Re: java.lang.NullPointerException during render phase when using ADF and MyFaces Tomahwak components together

Posted by Adam Winer <aw...@gmail.com>.
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 <mu...@hotmagna.com> 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>
>
>

Re: Anyone got a working ADF + MyFaces Tomahwak setup?

Posted by Rogers Reilly <ro...@s-rod.com>.
Murray Brandon wrote:

>If so, can you please shoot me a copy of your web.xml and
>faces-config.xml files?
>Thanks!
>
>
>
>  
>
note- I'm using Facelets, Spring, Shale as well.

faces-config.xml (relevant parts)

<faces-config >
    <application>
        <default-render-kit-id>
              oracle.adf.core
        </default-render-kit-id>
     </application>
</faces-config>



web.xml (includes some stuff you don't need)


<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" 
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  <display-name>display</display-name>
 
  <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</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>oracle.adf.view.faces.ALTERNATE_VIEW_HANDLER</param-name>
    <param-value>com.sun.facelets.FaceletViewHandler</param-value>
   </context-param>
   <context-param>
        <param-name>facelets.DEVELOPMENT</param-name>
        <param-value>true</param-value>
   </context-param>
   <context-param>
        <param-name>facelets.BUFFER_SIZE</param-name>
        <param-value>8192</param-value>
   </context-param>
  <context-param>
        <param-name>facelets.LIBRARIES</param-name>
       
 <param-value>/WEB-INF/facelet/taglib/jb-custom.taglib.xml;/WEB-INF/facelet/taglib/sandbox.taglib.xml;/WEB-INF/facelet/taglib/shale-core.taglib.xml</param-value>
   </context-param>
  
   <!--  for custom JSON Shale remoting -->
   <context-param>
          <param-name>
            org.apache.shale.remoting.OTHER_RESOURCES
          </param-name>
         <param-value>
            /json/*:org.jb.plat.util.JSF.JSONMethodBindingProcessor
          </param-value>
    </context-param>
  
  
  <filter>
      <filter-name>shale</filter-name>
      <filter-class>
        org.apache.shale.faces.ShaleApplicationFilter
      </filter-class>
    </filter>
    <filter-mapping>
      <filter-name>shale</filter-name>
      <url-pattern>*.xhtml</url-pattern>
    </filter-mapping>
  <context-param>
      <param-name>contextConfigLocation</param-name>
      
<param-value>/WEB-INF/spring/applicationContext.xml,/WEB-INF/hibernate/applicationContext-hibernate.xml,/WEB-INF/spring/baseball.xml</param-value>
  </context-param>
  <listener>
      
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  <filter>
      <filter-name>sessionFilter</filter-name>
      
<filter-class>org.jb.plat.util.OpenSessionInViewFilter_autoflush</filter-class>
      <init-param>
            <param-name>sessionFactoryBeanName</param-name>
            <param-value>sessionFactory</param-value>
        </init-param>
  </filter>
           
  <filter-mapping>
      <filter-name>sessionFilter</filter-name>
      <url-pattern>/*</url-pattern>
  </filter-mapping>
 
 
  <listener>
    
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
  </listener>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping>
 
  <filter>
    <filter-name>adfFaces</filter-name>
    <filter-class>oracle.adf.view.faces.webapp.AdfFacesFilter</filter-class>
  </filter>

  <filter-mapping>
    <filter-name>adfFaces</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
  </filter-mapping>
 
 
 
  <servlet>
      <servlet-name>resources</servlet-name>
      
<servlet-class>oracle.adf.view.faces.webapp.ResourceServlet</servlet-class>
   </servlet>

   <servlet-mapping>
        <servlet-name>resources</servlet-name>
        <url-pattern>/adf/*</url-pattern>
    </servlet-mapping>
 
     <filter>
        <filter-name>MyFacesExtensionsFilter</filter-name>
        
<filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
        <init-param>
          <param-name>maxFileSize</param-name>
          <param-value>20m</param-value>
        </init-param>
    </filter>
      <filter-mapping>
        <filter-name>MyFacesExtensionsFilter</filter-name>
        <url-pattern>/faces/*</url-pattern>
      </filter-mapping>
      <filter-mapping>
        <filter-name>MyFacesExtensionsFilter</filter-name>
        <url-pattern>*.jsf</url-pattern>
      </filter-mapping>
     
      <filter-mapping>
        <filter-name>MyFacesExtensionsFilter</filter-name>
        <url-pattern>*.xhtml</url-pattern>
    </filter-mapping>
 
  <listener>
      <listener-class>
        org.apache.commons.chain.web.ChainListener
      </listener-class>
    </listener>
</web-app>


Anyone got a working ADF + MyFaces Tomahwak setup?

Posted by Murray Brandon <mu...@hotmagna.com>.
If so, can you please shoot me a copy of your web.xml and
faces-config.xml files?
Thanks!