You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Hendrik Neumann <th...@googlemail.com> on 2006/07/20 15:33:16 UTC

javax.servlet.ServletException using Tree2

Hi everybody,

I try to develop my own component which renders a Tree2 component within the
encodeBegin(FacesContext myContext)-Method of my own UIComponent.

For this purpose I use the following code-snippet:

    public void encodeBegin(FacesContext myContext) throws IOException
    {
        ResponseWriter myWriter = myContext.getResponseWriter();
        Property props = myPropertyEditor.getModel();
        try
        {

[...]
            Application myApp = (Application) myContext.getApplication();
            HtmlTree myTree = (HtmlTree)myApp.createComponent(
HtmlTree.COMPONENT_TYPE);
            myTree.setValue(de.rub.swt.csseditor.db.Database.getDB
().getCssAttributesAsTreeNode());
            myTree.setVar("node");
            myTree.setVarNodeToggler("t");
            myTree.setShowRootNode(true);
            myTree.setId(myTools.createUniqueId());

            HtmlPanelGroup rootContent = (HtmlPanelGroup)
myApp.createComponent(HtmlPanelGroup.COMPONENT_TYPE);
            Map rootFacet = myTree.getFacets();
            rootFacet.put("root", rootContent);
            HtmlOutputText rootText =  (HtmlOutputText)
myApp.createComponent(HtmlOutputText.COMPONENT_TYPE);
            ValueBinding rootBinding = myApp.createValueBinding("#{
node.description}");
            rootText.setValueBinding("value", rootBinding);
            HtmlGraphicImage root = (HtmlGraphicImage) myApp.createComponent
(HtmlGraphicImage.COMPONENT_TYPE);
            root.setValue("misc/folder/blue-folder-open.gif");
            rootContent.getChildren().add(root);
            rootContent.getChildren().add(rootText);


[...]

        }
    }

This snipped works great, but the problem is: HtmlCommandLinks are not
working when I add them to the PanelGroup:

            HtmlCommandLink editIconLink =
myTools.createActionListenerLink("edit
this node", myContext, "switchView", "propertyeditor");
            editIconLink.addActionListener(new SwitchWindow());
            rootContent.getChildren().add(editIconLink);

When I click on such a link I'll get the following error:

StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces
Servlet threw exception
java.lang.NullPointerException
        at org.apache.myfaces.custom.tree2.UITreeData.getDataModel(
UITreeData.java:420)
        at org.apache.myfaces.custom.tree2.UITreeData.setNodeId(
UITreeData.java:320)
        at org.apache.myfaces.custom.tree2.HtmlTree.setNodeId(HtmlTree.java
:95)
        at org.apache.myfaces.custom.tree2.UITreeData.processDecodes(
UITreeData.java:172)
        at javax.faces.component.UIComponentBase.processDecodes(
UIComponentBase.java:880)
        at javax.faces.component.UIForm.processDecodes(UIForm.java:144)
        at javax.faces.component.UIComponentBase.processDecodes(
UIComponentBase.java:880)
        at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java
:306)
        at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(
ApplyRequestValuesPhase.java:79)
        at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java
:200)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java
:90)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:237)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:157)
        at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(
ExtensionsFilter.java:144)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:186)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:157)
        at
oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(
AdfFacesFilterImpl.java:367)
        at
oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(
AdfFacesFilterImpl.java:336)
        at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(
AdfFacesFilterImpl.java:196)
        at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(
AdfFacesFilter.java:87)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:186)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:157)
        at org.apache.catalina.core.StandardWrapperValve.invoke(
StandardWrapperValve.java:214)
        at org.apache.catalina.core.StandardValveContext.invokeNext(
StandardValveContext.java:104)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.java:520)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(
StandardContextValve.java:198)
        at org.apache.catalina.core.StandardContextValve.invoke(
StandardContextValve.java:152)
        at org.apache.catalina.core.StandardValveContext.invokeNext(
StandardValveContext.java:104)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.java:520)
        at org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.java:137)
        at org.apache.catalina.core.StandardValveContext.invokeNext(
StandardValveContext.java:104)
        at org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.java:117)
        at org.apache.catalina.core.StandardValveContext.invokeNext(
StandardValveContext.java:102)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.java:520)
        at org.apache.catalina.core.StandardEngineValve.invoke(
StandardEngineValve.java:109)
        at org.apache.catalina.core.StandardValveContext.invokeNext(
StandardValveContext.java:104)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.java:520)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
:929)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(
CoyoteAdapter.java:160)
        at org.apache.coyote.http11.Http11Processor.process(
Http11Processor.java:799)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection
(Http11Protocol.java:705)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(
PoolTcpEndpoint.java:577)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
ThreadPool.java:683)
        at java.lang.Thread.run(Thread.java:534)

But my HtmlCommandLink renders a different UIComponent - without any
tree-components. Therefore there should be no NullPointerException in
UITreeData because the linked JSP has no Tree2-component!

What am I doing wrong? Does anybody of you guys has any helpfull hints for
me?

Greetings,
Hendrik

Re: javax.servlet.ServletException using Tree2

Posted by Hendrik Neumann <th...@googlemail.com>.
I have just taken a look at  UITreeData.getDataModel(UITreeData.java:420).

This is the following snippet:

        if (_restoredState != null)
            _model.setTreeState(_restoredState); // set the restored state
(if there is one) on the model

The problem is, that both  _model and value are "null" in my  situation.
Therefore the setTreeState-method can not be applied to _model.

I don't now wheter this is a MyFaces bug or whether I did anything wrong in
my code... nevertheless I found a quick and dirty workaround:

        if (_restoredState != null)
        {
            if (_model == null ) _model = new TreeModelBase(new
TreeNodeBase("", "", false));
            _model.setTreeState(_restoredState); // set the restored state
(if there is one) on the model
        }

This - of course - returns an empty tree, but in my situation this is
excactly what I want, because the new JSF-site, my CommandLink is referenced
to, does not contain a tree2-component which should be rendered.

Was this information helpfull or do you need any aditional informations in
order to find out whether this is a myfaces-bug or not?

Greetings,
Hendrik

Re: javax.servlet.ServletException using Tree2

Posted by Andrew Robinson <an...@gmail.com>.
I have received the same error message on occasion (it isn't 100%
reproducible, but I haven't tried too hard). I think that it is only
happening when my Seam conversation times out or is destroyed/ended.
Most of the time, command links are working fine in the panel group
from what I thought. I would be interested to hear more on this issue
myself.

On 7/21/06, Matthias Wessendorf <ma...@apache.org> wrote:
> give them some time. for voting issue etc we usaly use a 72 hours timeframe.
>
> -Matthias
>
> On 7/21/06, Hendrik Neumann <th...@googlemail.com> wrote:
> > No idea? Anyone?
> >
> > 2006/7/20, Hendrik Neumann <th...@googlemail.com>:
> > >
> > > Hi everybody,
> > >
> > > I try to develop my own component which renders a Tree2 component within
> > the encodeBegin(FacesContext myContext)-Method of my own UIComponent.
> > >
> > > For this purpose I use the following code-snippet:
> > >
> > >     public void encodeBegin(FacesContext myContext) throws IOException
> > >     {
> > >         ResponseWriter myWriter = myContext.getResponseWriter();
> > >         Property props = myPropertyEditor.getModel();
> > >         try
> > >         {
> > >
> > > [...]
> > >             Application myApp = (Application) myContext.getApplication();
> > >             HtmlTree myTree =
> > (HtmlTree)myApp.createComponent(HtmlTree.COMPONENT_TYPE);
> > >             myTree.setValue
> > (de.rub.swt.csseditor.db.Database.getDB().getCssAttributesAsTreeNode());
> > >             myTree.setVar("node");
> > >             myTree.setVarNodeToggler("t");
> > >             myTree.setShowRootNode(true);
> > >             myTree.setId(myTools.createUniqueId());
> > >
> > >             HtmlPanelGroup rootContent = (HtmlPanelGroup)
> > myApp.createComponent(HtmlPanelGroup.COMPONENT_TYPE);
> > >             Map rootFacet = myTree.getFacets ();
> > >             rootFacet.put("root", rootContent);
> > >             HtmlOutputText rootText =  (HtmlOutputText)
> > myApp.createComponent(HtmlOutputText.COMPONENT_TYPE);
> > >             ValueBinding rootBinding =
> > myApp.createValueBinding("#{node.description}");
> > >             rootText.setValueBinding("value", rootBinding);
> > >             HtmlGraphicImage root = (HtmlGraphicImage)
> > myApp.createComponent(HtmlGraphicImage.COMPONENT_TYPE );
> > >             root.setValue("misc/folder/blue-folder-open.gif");
> > >             rootContent.getChildren().add(root);
> > >             rootContent.getChildren().add(rootText);
> > >
> > >
> > > [...]
> > >
> > >         }
> > >     }
> > >
> > > This snipped works great, but the problem is: HtmlCommandLinks are not
> > working when I add them to the PanelGroup:
> > >
> > >             HtmlCommandLink editIconLink =
> > myTools.createActionListenerLink("edit this node",
> > myContext, "switchView", "propertyeditor");
> > >             editIconLink.addActionListener(new SwitchWindow());
> > >             rootContent.getChildren().add(editIconLink);
> > >
> > > When I click on such a link I'll get the following error:
> > >
> > > StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces
> > Servlet threw exception
> > > java.lang.NullPointerException
> > >         at
> > org.apache.myfaces.custom.tree2.UITreeData.getDataModel(UITreeData.java:420)
> > >         at
> > org.apache.myfaces.custom.tree2.UITreeData.setNodeId
> > (UITreeData.java:320)
> > >         at
> > org.apache.myfaces.custom.tree2.HtmlTree.setNodeId(HtmlTree.java:95)
> > >         at
> > org.apache.myfaces.custom.tree2.UITreeData.processDecodes(UITreeData.java:172)
> > >         at
> > javax.faces.component.UIComponentBase.processDecodes
> > (UIComponentBase.java:880)
> > >         at
> > javax.faces.component.UIForm.processDecodes(UIForm.java:144)
> > >         at
> > javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
> > >         at
> > javax.faces.component.UIViewRoot.processDecodes
> > (UIViewRoot.java:306)
> > >         at
> > com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:79)
> > >         at
> > com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
> > >         at
> > com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
> > >         at
> > javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
> > >         at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
> > (ApplicationFilterChain.java:237)
> > >         at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
> > >         at
> > org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java
> > :144)
> > >         at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
> > >         at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
> > >         at
> > oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:367)
> > >         at
> > oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java
> > :336)
> > >         at
> > oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:196)
> > >         at
> > oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:87)
> > >         at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
> > (ApplicationFilterChain.java:186)
> > >         at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
> > >         at
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java
> > :214)
> > >         at
> > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
> > >         at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> > >         at
> > org.apache.catalina.core.StandardContextValve.invokeInternal
> > (StandardContextValve.java:198)
> > >         at
> > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
> > >         at
> > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java
> > :104)
> > >         at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> > >         at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
> > >         at
> > org.apache.catalina.core.StandardValveContext.invokeNext
> > (StandardValveContext.java:104)
> > >         at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
> > >         at
> > org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java
> > :102)
> > >         at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> > >         at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> > >         at
> > org.apache.catalina.core.StandardValveContext.invokeNext
> > (StandardValveContext.java:104)
> > >         at
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> > >         at
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
> > >         at
> > org.apache.coyote.tomcat5.CoyoteAdapter.service
> > (CoyoteAdapter.java:160)
> > >         at
> > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
> > >         at
> > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java
> > :705)
> > >         at
> > org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
> > >         at
> > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
> > >         at java.lang.Thread.run (Thread.java:534)
> > >
> > > But my HtmlCommandLink renders a different UIComponent - without any
> > tree-components. Therefore there should be no NullPointerException in
> > UITreeData because the linked JSP has no Tree2-component!
> > >
> > > What am I doing wrong? Does anybody of you guys has any helpfull hints for
> > me?
> > >
> > > Greetings,
> > >
> > > Hendrik
> > >
> >
> >
>
>
> --
> Matthias Wessendorf
>
> further stuff:
> blog: http://jroller.com/page/mwessendorf
> mail: mwessendorf-at-gmail-dot-com
>

Re: javax.servlet.ServletException using Tree2

Posted by Matthias Wessendorf <ma...@apache.org>.
give them some time. for voting issue etc we usaly use a 72 hours timeframe.

-Matthias

On 7/21/06, Hendrik Neumann <th...@googlemail.com> wrote:
> No idea? Anyone?
>
> 2006/7/20, Hendrik Neumann <th...@googlemail.com>:
> >
> > Hi everybody,
> >
> > I try to develop my own component which renders a Tree2 component within
> the encodeBegin(FacesContext myContext)-Method of my own UIComponent.
> >
> > For this purpose I use the following code-snippet:
> >
> >     public void encodeBegin(FacesContext myContext) throws IOException
> >     {
> >         ResponseWriter myWriter = myContext.getResponseWriter();
> >         Property props = myPropertyEditor.getModel();
> >         try
> >         {
> >
> > [...]
> >             Application myApp = (Application) myContext.getApplication();
> >             HtmlTree myTree =
> (HtmlTree)myApp.createComponent(HtmlTree.COMPONENT_TYPE);
> >             myTree.setValue
> (de.rub.swt.csseditor.db.Database.getDB().getCssAttributesAsTreeNode());
> >             myTree.setVar("node");
> >             myTree.setVarNodeToggler("t");
> >             myTree.setShowRootNode(true);
> >             myTree.setId(myTools.createUniqueId());
> >
> >             HtmlPanelGroup rootContent = (HtmlPanelGroup)
> myApp.createComponent(HtmlPanelGroup.COMPONENT_TYPE);
> >             Map rootFacet = myTree.getFacets ();
> >             rootFacet.put("root", rootContent);
> >             HtmlOutputText rootText =  (HtmlOutputText)
> myApp.createComponent(HtmlOutputText.COMPONENT_TYPE);
> >             ValueBinding rootBinding =
> myApp.createValueBinding("#{node.description}");
> >             rootText.setValueBinding("value", rootBinding);
> >             HtmlGraphicImage root = (HtmlGraphicImage)
> myApp.createComponent(HtmlGraphicImage.COMPONENT_TYPE );
> >             root.setValue("misc/folder/blue-folder-open.gif");
> >             rootContent.getChildren().add(root);
> >             rootContent.getChildren().add(rootText);
> >
> >
> > [...]
> >
> >         }
> >     }
> >
> > This snipped works great, but the problem is: HtmlCommandLinks are not
> working when I add them to the PanelGroup:
> >
> >             HtmlCommandLink editIconLink =
> myTools.createActionListenerLink("edit this node",
> myContext, "switchView", "propertyeditor");
> >             editIconLink.addActionListener(new SwitchWindow());
> >             rootContent.getChildren().add(editIconLink);
> >
> > When I click on such a link I'll get the following error:
> >
> > StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces
> Servlet threw exception
> > java.lang.NullPointerException
> >         at
> org.apache.myfaces.custom.tree2.UITreeData.getDataModel(UITreeData.java:420)
> >         at
> org.apache.myfaces.custom.tree2.UITreeData.setNodeId
> (UITreeData.java:320)
> >         at
> org.apache.myfaces.custom.tree2.HtmlTree.setNodeId(HtmlTree.java:95)
> >         at
> org.apache.myfaces.custom.tree2.UITreeData.processDecodes(UITreeData.java:172)
> >         at
> javax.faces.component.UIComponentBase.processDecodes
> (UIComponentBase.java:880)
> >         at
> javax.faces.component.UIForm.processDecodes(UIForm.java:144)
> >         at
> javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:880)
> >         at
> javax.faces.component.UIViewRoot.processDecodes
> (UIViewRoot.java:306)
> >         at
> com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:79)
> >         at
> com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
> >         at
> com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
> >         at
> javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
> >         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
> (ApplicationFilterChain.java:237)
> >         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
> >         at
> org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java
> :144)
> >         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
> >         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
> >         at
> oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:367)
> >         at
> oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java
> :336)
> >         at
> oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:196)
> >         at
> oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:87)
> >         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
> (ApplicationFilterChain.java:186)
> >         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
> >         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java
> :214)
> >         at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
> >         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> >         at
> org.apache.catalina.core.StandardContextValve.invokeInternal
> (StandardContextValve.java:198)
> >         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
> >         at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java
> :104)
> >         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> >         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
> >         at
> org.apache.catalina.core.StandardValveContext.invokeNext
> (StandardValveContext.java:104)
> >         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
> >         at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java
> :102)
> >         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> >         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> >         at
> org.apache.catalina.core.StandardValveContext.invokeNext
> (StandardValveContext.java:104)
> >         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> >         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
> >         at
> org.apache.coyote.tomcat5.CoyoteAdapter.service
> (CoyoteAdapter.java:160)
> >         at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
> >         at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java
> :705)
> >         at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
> >         at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
> >         at java.lang.Thread.run (Thread.java:534)
> >
> > But my HtmlCommandLink renders a different UIComponent - without any
> tree-components. Therefore there should be no NullPointerException in
> UITreeData because the linked JSP has no Tree2-component!
> >
> > What am I doing wrong? Does anybody of you guys has any helpfull hints for
> me?
> >
> > Greetings,
> >
> > Hendrik
> >
>
>


-- 
Matthias Wessendorf

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

Re: javax.servlet.ServletException using Tree2

Posted by Hendrik Neumann <th...@googlemail.com>.
No idea? Anyone?

2006/7/20, Hendrik Neumann <th...@googlemail.com>:
>
> Hi everybody,
>
> I try to develop my own component which renders a Tree2 component within
> the encodeBegin(FacesContext myContext)-Method of my own UIComponent.
>
> For this purpose I use the following code-snippet:
>
>     public void encodeBegin(FacesContext myContext) throws IOException
>     {
>         ResponseWriter myWriter = myContext.getResponseWriter();
>         Property props = myPropertyEditor.getModel();
>         try
>         {
>
> [...]
>             Application myApp = (Application) myContext.getApplication();
>             HtmlTree myTree = (HtmlTree)myApp.createComponent(
> HtmlTree.COMPONENT_TYPE);
>             myTree.setValue (de.rub.swt.csseditor.db.Database.getDB
> ().getCssAttributesAsTreeNode());
>             myTree.setVar("node");
>             myTree.setVarNodeToggler("t");
>             myTree.setShowRootNode(true);
>             myTree.setId(myTools.createUniqueId());
>
>             HtmlPanelGroup rootContent = (HtmlPanelGroup)
> myApp.createComponent(HtmlPanelGroup.COMPONENT_TYPE);
>             Map rootFacet = myTree.getFacets ();
>             rootFacet.put("root", rootContent);
>             HtmlOutputText rootText =  (HtmlOutputText)
> myApp.createComponent(HtmlOutputText.COMPONENT_TYPE);
>             ValueBinding rootBinding = myApp.createValueBinding("#{
> node.description}");
>             rootText.setValueBinding("value", rootBinding);
>             HtmlGraphicImage root = (HtmlGraphicImage)
> myApp.createComponent(HtmlGraphicImage.COMPONENT_TYPE );
>             root.setValue("misc/folder/blue-folder-open.gif");
>             rootContent.getChildren().add(root);
>             rootContent.getChildren().add(rootText);
>
>
> [...]
>
>         }
>     }
>
> This snipped works great, but the problem is: HtmlCommandLinks are not
> working when I add them to the PanelGroup:
>
>             HtmlCommandLink editIconLink =
> myTools.createActionListenerLink("edit this node", myContext,
> "switchView", "propertyeditor");
>             editIconLink.addActionListener(new SwitchWindow());
>             rootContent.getChildren().add(editIconLink);
>
> When I click on such a link I'll get the following error:
>
> StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces
> Servlet threw exception
> java.lang.NullPointerException
>         at org.apache.myfaces.custom.tree2.UITreeData.getDataModel(
> UITreeData.java:420)
>         at org.apache.myfaces.custom.tree2.UITreeData.setNodeId (
> UITreeData.java:320)
>         at org.apache.myfaces.custom.tree2.HtmlTree.setNodeId(
> HtmlTree.java:95)
>         at org.apache.myfaces.custom.tree2.UITreeData.processDecodes(
> UITreeData.java:172)
>         at javax.faces.component.UIComponentBase.processDecodes (
> UIComponentBase.java:880)
>         at javax.faces.component.UIForm.processDecodes(UIForm.java:144)
>         at javax.faces.component.UIComponentBase.processDecodes(
> UIComponentBase.java:880)
>         at javax.faces.component.UIViewRoot.processDecodes (
> UIViewRoot.java:306)
>         at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(
> ApplyRequestValuesPhase.java:79)
>         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java
> :200)
>         at com.sun.faces.lifecycle.LifecycleImpl.execute(
> LifecycleImpl.java:90)
>         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (
> ApplicationFilterChain.java:237)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:157)
>         at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(
> ExtensionsFilter.java :144)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:186)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:157)
>         at
> oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(
> AdfFacesFilterImpl.java:367)
>         at
> oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(
> AdfFacesFilterImpl.java :336)
>         at
> oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(
> AdfFacesFilterImpl.java:196)
>         at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(
> AdfFacesFilter.java:87)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (
> ApplicationFilterChain.java:186)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:157)
>         at org.apache.catalina.core.StandardWrapperValve.invoke(
> StandardWrapperValve.java :214)
>         at org.apache.catalina.core.StandardValveContext.invokeNext(
> StandardValveContext.java:104)
>         at org.apache.catalina.core.StandardPipeline.invoke(
> StandardPipeline.java:520)
>         at org.apache.catalina.core.StandardContextValve.invokeInternal (
> StandardContextValve.java:198)
>         at org.apache.catalina.core.StandardContextValve.invoke(
> StandardContextValve.java:152)
>         at org.apache.catalina.core.StandardValveContext.invokeNext(
> StandardValveContext.java :104)
>         at org.apache.catalina.core.StandardPipeline.invoke(
> StandardPipeline.java:520)
>         at org.apache.catalina.core.StandardHostValve.invoke(
> StandardHostValve.java:137)
>         at org.apache.catalina.core.StandardValveContext.invokeNext (
> StandardValveContext.java:104)
>         at org.apache.catalina.valves.ErrorReportValve.invoke(
> ErrorReportValve.java:117)
>         at org.apache.catalina.core.StandardValveContext.invokeNext(
> StandardValveContext.java:102)
>         at org.apache.catalina.core.StandardPipeline.invoke(
> StandardPipeline.java:520)
>         at org.apache.catalina.core.StandardEngineValve.invoke(
> StandardEngineValve.java:109)
>         at org.apache.catalina.core.StandardValveContext.invokeNext (
> StandardValveContext.java:104)
>         at org.apache.catalina.core.StandardPipeline.invoke(
> StandardPipeline.java:520)
>         at org.apache.catalina.core.ContainerBase.invoke(
> ContainerBase.java:929)
>         at org.apache.coyote.tomcat5.CoyoteAdapter.service (
> CoyoteAdapter.java:160)
>         at org.apache.coyote.http11.Http11Processor.process(
> Http11Processor.java:799)
>         at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection
> (Http11Protocol.java :705)
>         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(
> PoolTcpEndpoint.java:577)
>         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> ThreadPool.java:683)
>         at java.lang.Thread.run (Thread.java:534)
>
> But my HtmlCommandLink renders a different UIComponent - without any
> tree-components. Therefore there should be no NullPointerException in
> UITreeData because the linked JSP has no Tree2-component!
>
> What am I doing wrong? Does anybody of you guys has any helpfull hints for
> me?
>
> Greetings,
> Hendrik
>