0 Replies Latest reply on May 26, 2009 11:44 PM by Matt Kohanek

    Trying to use XMLTreeDataBuilder Class but having problems

    Matt Kohanek Novice

      I think I am close to doing this correctly, but I must be doing somethign wrong.

      Here is my XmlTreeDataBuilder Class:

      package testContainer;
      
      import org.richfaces.model.TreeNode;
      import org.richfaces.component.xml.XmlTreeDataBuilder;
      import org.xml.sax.InputSource;
      import org.xml.sax.SAXException;
      import java.io.IOException;
      
      public class XMLTreeDataBuilderTest {
      
      
       private TreeNode data;
      
       public XMLTreeDataBuilderTest () throws SAXException, IOException {
       data = XmlTreeDataBuilder.build(new InputSource(getClass().getResourceAsStream("songs.xml")));
       }
      
       public void setData(TreeNode data) {
       this.data = data;
       }
      
       public TreeNode getData() {
       return data;
       }
      
      
      }


      Here is the songs.xml file it refers to:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <songs>
       <song>List</song>
       <song>Dance</song>
       <song>It</song>
       <song>Eyes</song>
       <song>Up</song>
      </songs>
      


      And finally my xhml page:

      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:ui="http://java.sun.com/jsf/facelets">
      
      <body>
      
       <h:form>
       <rich:tree style="width:300px" switchType="ajax" >
       <rich:recursiveTreeNodesAdaptor roots="#{nodesBean.data}" var="data" nodes="#{nodesBean.data}" />
       </rich:tree>
       </h:form>
      
      </body>
      </html>


      plus I of course have a managed bean:

      <managed-bean>
       <managed-bean-name>nodesBean</managed-bean-name>
       <managed-bean-class>testContainer.XMLTreeDataBuilderTest</managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>
       </managed-bean>


      But when I try to run this on my server I get:

      HTTP Status 500 -

      --------------------------------------------------------------------------------

      type Exception report

      message

      description The server encountered an internal error () that prevented it from fulfilling this request.

      exception

      java.net.MalformedURLException
      java.net.URL.(URL.java:601)
      java.net.URL.(URL.java:464)
      java.net.URL.(URL.java:413)
      com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:650)
      com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:186)
      com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
      com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
      com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
      com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
      com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
      org.apache.commons.digester.Digester.parse(Digester.java:1745)
      org.richfaces.component.xml.XmlTreeDataBuilder.build(XmlTreeDataBuilder.java:160)
      testContainer.XMLTreeDataBuilderTest.(XMLTreeDataBuilderTest.java:33)
      sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      java.lang.Class.newInstance0(Class.java:355)
      java.lang.Class.newInstance(Class.java:308)
      com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:186)
      com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:106)
      com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:368)
      com.sun.faces.mgbean.BeanManager.create(BeanManager.java:222)
      com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:86)
      javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
      com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
      org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:61)
      org.apache.el.parser.AstValue.getValue(AstValue.java:107)
      org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
      com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
      org.richfaces.component.html.HtmlRecursiveTreeNodesAdaptor.getRoots(HtmlRecursiveTreeNodesAdaptor.java:181)
      org.richfaces.component.UIRecursiveTreeNodesAdaptor.getData(UIRecursiveTreeNodesAdaptor.java:55)
      org.richfaces.component.UITreeNodesAdaptor$1.getData(UITreeNodesAdaptor.java:54)
      org.richfaces.model.StackingTreeModel.getDataModel(StackingTreeModel.java:83)
      org.richfaces.model.StackingTreeModel.doWalk(StackingTreeModel.java:309)
      org.richfaces.model.StackingTreeModel.walk(StackingTreeModel.java:381)
      org.richfaces.component.UITree.walk(UITree.java:422)
      org.richfaces.renderkit.TreeRendererBase.writeContent(TreeRendererBase.java:655)
      org.richfaces.renderkit.TreeRendererBase.encodeChildren(TreeRendererBase.java:601)
      javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
      javax.faces.component.UIComponent.encodeAll(UIComponent.java:930)
      javax.faces.render.Renderer.encodeChildren(Renderer.java:148)
      javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
      javax.faces.component.UIComponent.encodeAll(UIComponent.java:930)
      javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
      com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
      org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
      org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
      com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
      com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
      com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
      org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
      org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
      org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)


      note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.


      --------------------------------------------------------------------------------

      Apache Tomcat/6.0.18




      Can anyone help me figure out where I am wrong please?