You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "CHAUDHURI, Neil" <NC...@lmi.org> on 2005/06/07 20:59:44 UTC

"Java heap space" Error with Tree2

Hey there.  I am attempting to use Tree2 to render a tree with not very
many nodes (under 20 altogether).  I have unit tested the backer bean
supporting this tree, and I have verified that its contents are as they
should be.  However, I am receiving the following error:

javax.servlet.ServletException: Java heap space
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:125)
	
org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(Extensi
onsFilter.java:112)

root cause

javax.faces.FacesException: Java heap space
	
org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(S
ervletExternalContextImpl.java:411)
	
org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspView
HandlerImpl.java:280)
	
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300
)
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:110)
	
org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(Extensi
onsFilter.java:112)


The following is my tag for your perusal:

<f:view>
         <x:tree2 id="tree" value="#{tree.contents}" var="node"
varNodeToggler="t" showRootNode="false">
            <f:facet name="branch">
               <h:panelGroup>
                  <f:facet name="expand">
                     <h:graphicImage value="images/blue-folder-open.gif"
rendered="#{t.nodeExpanded}" border="0"/>
                  </f:facet>
                  <f:facet name="collapse">
                     <h:graphicImage
value="images/blue-folder-closed.png" rendered="#{!t.nodeExpanded}"
border="0"/>
                  </f:facet>
                  <h:outputText value="#{node.description}"
styleClass="nodeFolder"/>
                  <h:outputText value=" (#{node.childCount})"
styleClass="childCount" rendered="#{!empty node.children}"/>
               </h:panelGroup>
            </f:facet>
            <f:facet name="leaf">
               <h:panelGroup>
                  <h:graphicImage value="images/document.png"
border="0"/>
                  <h:outputText value="#{node.description}"
styleClass="nodeFolder"/>
               </h:panelGroup>
            </f:facet>
         </x:tree2>
</f:view>


Any insight is appreciated since I am using MyFaces for a demo tomorrow.
Thanks so much.

Neil

Re: regularExpressionValidator

Posted by alex <de...@yahoo.co.nz>.
I opened up a ticket in JIRA (MYFACES-279) and attached source, so that 
now the ErrorMessage shows the pattern which the input string must match.

Rgds
Alex

Re: regularExpressionValidator

Posted by alex <de...@yahoo.co.nz>.
Just because I cannot.
My jsp looks like this:

<f:view>
<h:form>
<h:panelGrid binding="#{somebean.inputGrid}" />
<h:commandButton value="submit" action="somebean.send" />
</h:form>
</f:view>

The inputform is built generic via component binding as you see. I never 
know, how many inputfields I would have and which validator has to be 
bound to it. This all comes out of an xml-file. That's why.

Richard Featherstone wrote:

>Alex,
>
>Not sure if this is any help but why not add the validation in your jsp like:
><h:inputText>
>	<x:validateRegExpr pattern=""/>
></h:inputText>
>
>Cheers,
>
>Ric
>  
>


Re: regularExpressionValidator

Posted by Richard Featherstone <rf...@transactgroup.net>.
Alex,

Not sure if this is any help but why not add the validation in your jsp like:
<h:inputText>
	<x:validateRegExpr pattern=""/>
</h:inputText>

Cheers,

Ric

On Wednesday 08 Jun 2005 10:18, alex wrote:
> Hi,
>
> I'm trying to use the regularExpressionValidator as follows:
>
> In the faces-config.xml I set it up under a custom ID (here myID).
>
>     <validator>
>         <validator-id>myID</validator-id>
>
> <validator-class>org.apache.myfaces.custom.regexprvalidator.RegExprValidato
>r</validator-class> <property>
>             <property-name>pattern</property-name>
>             <property-class>java.lang.String</property-class>
>             <default-value>aaa</default-value>
>         </property>
>     </validator>
>
> Then I add it to an inputField in a bean:
>
> Validator val =
> getApplication().createValidator("myID");
> inputfield.addValidator(val);
>
> With other validators like the lengthValidator this way works fine,
> however, the regexprValidator doesn't work. It seems, as if the pattern
> is always null.
> Unfortunately the message of this validator doesn't show the
> regular-expression itself though this would be even more helpfull to the
> user than "the inserted value (some value) is not correct". Better would
> be "the inserted value (some value) doesn't match REGEX (<< the pattern
> set)".
>
> Has anyone an idea how I can get it to work?
>
> Regards
> Alex

regularExpressionValidator

Posted by alex <de...@yahoo.co.nz>.
Hi,

I'm trying to use the regularExpressionValidator as follows:

In the faces-config.xml I set it up under a custom ID (here myID).

    <validator>
        <validator-id>myID</validator-id>
        
<validator-class>org.apache.myfaces.custom.regexprvalidator.RegExprValidator</validator-class>
        <property>
            <property-name>pattern</property-name>
            <property-class>java.lang.String</property-class>
            <default-value>aaa</default-value>
        </property>
    </validator>

Then I add it to an inputField in a bean:

Validator val = 
getApplication().createValidator("myID");                          
inputfield.addValidator(val);

With other validators like the lengthValidator this way works fine, 
however, the regexprValidator doesn't work. It seems, as if the pattern 
is always null.
Unfortunately the message of this validator doesn't show the 
regular-expression itself though this would be even more helpfull to the 
user than "the inserted value (some value) is not correct". Better would 
be "the inserted value (some value) doesn't match REGEX (<< the pattern 
set)".

Has anyone an idea how I can get it to work?

Regards
Alex

Re: "Java heap space" Error with Tree2

Posted by Martin Marinschek <ma...@gmail.com>.
Well, 

even the MyFaces examples have more than 20 nodes in tree2, I think,
so you should really have no problems with 20 nodes!

are you sure that tree2 is causing this problems or might it be some
data in your backing beans?

regards,

Martin

On 6/7/05, Matt Blum <mb...@gmail.com> wrote:
> What app server are you using?  What do you have the maximum heap size set
> to?
>  
>  If you've never configured the maximum heap size, it's probably set to 64mb
> (that's what Tomcat's default is, anyway).  Try increasing it to as big a
> number as your server can handle--you'll probably get better performance if
> you do, anyway, since garbage collection will happen less often.
>  
>  -Matt
> 
> 
> On 6/7/05, CHAUDHURI, Neil <NC...@lmi.org> wrote:
> > Hey there.  I am attempting to use Tree2 to render a tree with not very
> > many nodes (under 20 altogether).  I have unit tested the backer bean
> > supporting this tree, and I have verified that its contents are as they
> > should be.  However, I am receiving the following error:
> > 
> > javax.servlet.ServletException: Java heap space
> >        
> javax.faces.webapp.FacesServlet.service(FacesServlet.java:125)
> > 
> >
> org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter
> (Extensi
> > onsFilter.java:112)
> > 
> > root cause
> > 
> > javax.faces.FacesException: Java heap space
> > 
> >
> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(S
> > ervletExternalContextImpl.java:411)
> > 
> >
> org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspView
> > HandlerImpl.java:280)
> > 
> >
> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300
> > )
> >         javax.faces.webapp.FacesServlet.service
> (FacesServlet.java:110)
> > 
> >
> org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(Extensi
> > onsFilter.java:112)
> > 
> > 
> > The following is my tag for your perusal:
> > 
> > <f:view>
> >          <x:tree2 id="tree" value="#{ tree.contents}" var="node"
> > varNodeToggler="t" showRootNode="false">
> >             <f:facet name="branch">
> >                <h:panelGroup>
> >                   <f:facet name="expand">
> >                      <h:graphicImage value="images/blue-folder-open.gif"
> > rendered="#{t.nodeExpanded}" border="0"/>
> >                   </f:facet>
> >                   <f:facet name="collapse">
> >                      <h:graphicImage
> > value="images/blue-folder-closed.png" rendered="#{!t.nodeExpanded}"
> > border="0"/>
> >                   </f:facet>
> >                   <h:outputText value="#{node.description}"
> > styleClass="nodeFolder"/>
> >                   <h:outputText value=" (#{node.childCount})"
> > styleClass="childCount" rendered="#{!empty node.children}"/>
> >                </h:panelGroup>
> >             </f:facet>
> >             <f:facet name="leaf"> 
> >                <h:panelGroup>
> >                   <h:graphicImage
> value="images/document.png"
> > border="0"/>
> >                   <h:outputText value="#{node.description}"
> > styleClass="nodeFolder"/>
> >                </h:panelGroup>
> >             </f:facet>
> >          </x:tree2>
> > </f:view>
> > 
> > 
> > Any insight is appreciated since I am using MyFaces for a demo tomorrow. 
> > Thanks so much.
> > 
> > Neil
> > 
> 
>

Re: "Java heap space" Error with Tree2

Posted by Matt Blum <mb...@gmail.com>.
What app server are you using? What do you have the maximum heap size set 
to?

If you've never configured the maximum heap size, it's probably set to 64mb 
(that's what Tomcat's default is, anyway). Try increasing it to as big a 
number as your server can handle--you'll probably get better performance if 
you do, anyway, since garbage collection will happen less often.

-Matt

On 6/7/05, CHAUDHURI, Neil <NC...@lmi.org> wrote:
> 
> Hey there. I am attempting to use Tree2 to render a tree with not very
> many nodes (under 20 altogether). I have unit tested the backer bean
> supporting this tree, and I have verified that its contents are as they
> should be. However, I am receiving the following error:
> 
> javax.servlet.ServletException: Java heap space
> javax.faces.webapp.FacesServlet.service(FacesServlet.java:125)
> 
> org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(Extensi
> onsFilter.java:112)
> 
> root cause
> 
> javax.faces.FacesException: Java heap space
> 
> org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(S
> ervletExternalContextImpl.java:411)
> 
> org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspView
> HandlerImpl.java:280)
> 
> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300
> )
> javax.faces.webapp.FacesServlet.service(FacesServlet.java:110)
> 
> org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(Extensi
> onsFilter.java:112)
> 
> 
> The following is my tag for your perusal:
> 
> <f:view>
> <x:tree2 id="tree" value="#{tree.contents}" var="node"
> varNodeToggler="t" showRootNode="false">
> <f:facet name="branch">
> <h:panelGroup>
> <f:facet name="expand">
> <h:graphicImage value="images/blue-folder-open.gif"
> rendered="#{t.nodeExpanded}" border="0"/>
> </f:facet>
> <f:facet name="collapse">
> <h:graphicImage
> value="images/blue-folder-closed.png" rendered="#{!t.nodeExpanded}"
> border="0"/>
> </f:facet>
> <h:outputText value="#{node.description}"
> styleClass="nodeFolder"/>
> <h:outputText value=" (#{node.childCount})"
> styleClass="childCount" rendered="#{!empty node.children}"/>
> </h:panelGroup>
> </f:facet>
> <f:facet name="leaf">
> <h:panelGroup>
> <h:graphicImage value="images/document.png"
> border="0"/>
> <h:outputText value="#{node.description}"
> styleClass="nodeFolder"/>
> </h:panelGroup>
> </f:facet>
> </x:tree2>
> </f:view>
> 
> 
> Any insight is appreciated since I am using MyFaces for a demo tomorrow.
> Thanks so much.
> 
> Neil
>