2 Replies Latest reply on Apr 18, 2007 11:54 AM by J.R. Ector

    trimInitialSpace throws nullpointer

    J.R. Ector Newbie

      I'm using ajax4jsf with trinidad and richfaces. I'm getting a nullpointer exception as well as a popup that says "500 Internal Server error" when I select one of the dropdowns that use an ajax tag.
      Any help would be appreciated.

      Here's the page:

      <f:view xmlns="http://www.w3.org/1999/xhtml"
       xmlns:s="http://jboss.com/products/seam/taglib"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:tr="http://myfaces.apache.org/trinidad"
       xmlns:rich="http://richfaces.ajax4jsf.org/rich"
       xmlns:a="https://ajax4jsf.dev.java.net/ajax">
      
       <html>
       <body>
      
       <h:messages globalOnly="true" styleClass="message" id="globalMessages" />
      
      
       <rich:tabPanel switchType="ajax">
      
       <rich:tab label="Borrower Information">
       <h:form id="titleXiProfile" styleClass="edit">
       <f:facet name="header">Borrower Information</f:facet>
       <h:panelGrid>
       <h:inputHidden id="projectNumber" required="true"
       disabled="#{titleXiProfileHome.managed}"
       value="#{titleXiProfileHome.instance.projectNumber}">
       <a:support event="onblur" reRender="projectNumberDecoration" />
       </h:inputHidden>
       <h:outputLabel for="projectName">
       * Project Name:
       </h:outputLabel>
       <s:decorate id="projectName">
       <h:inputText id="projectName" required="true" size="30"
       maxlength="30" value="#{titleXiProfileHome.instance.projectName}">
       </h:inputText>
       <h:message for="projectName" />
       </s:decorate>
      
       <a:region>
       <a:outputPanel ajaxRendered="true">
       <h:outputText>
       <fieldset title="company"><legend>Company</legend>
       <table>
       <tr>
       <td><h:outputLabel for="company">
       <p align="right">Company:</p>
       </h:outputLabel></td>
       <td><s:decorate id="companyDecoration">
       <h:selectOneMenu id="company"
       value="#{titleXiProfileHome.instance.company}">
       <s:selectItems value="#{companyList.resultList}"
       var="company" label="#{company.name}"
       noSelectionLabel="Please Select..."
       hideNoSelectionLabel="true" />
       <a:support event="onchange" reRender="companyDecoration" />
       <s:convertEntity />
       </h:selectOneMenu>
       </s:decorate></td>
       </tr>
       <f:subview rendered="#{titleXiProfileHome.instance.company != null}"
       id="companyInfo1">
       <ui:repeat value="#{titleXiProfileHome.instance.company}"
       var="company" id="companyInfo">
       <ui:include src="CompanyContact.xhtml" />
       </ui:repeat>
       </f:subview>
       <f:subview rendered="#{titleXiProfileHome.instance.company == null}"
       id="companyInfo1">
       <ui:include src="CompanyNew.xhtml" />
       </f:subview>
       </table>
       </fieldset>
       </h:outputText>
       </a:outputPanel>
       </a:region>
       <a:region>
       <a:outputPanel ajaxRendered="true">
       <h:outputText>
       <fieldset title="contact"><legend>Contact</legend>
       <table>
       <tr>
       <td><h:outputLabel for="contact">
       <p align="right">Contact:</p>
       </h:outputLabel></td>
       <td><s:decorate id="contactDecoration">
       <h:selectOneMenu id="contact"
       value="#{titleXiProfileHome.instance.contact}">
       <s:selectItems value="#{contactList.resultList}"
       var="contact" label="#{contact.firstName} #{contact.lastName}"
       noSelectionLabel="Please Select..."
       hideNoSelectionLabel="true" />
       <a:support event="onchange" reRender="contactDecoration" />
       <s:convertEntity />
       </h:selectOneMenu>
       </s:decorate></td>
       </tr>
       <f:subview rendered="#{titleXiProfileHome.instance.contact != null}"
       id="contactInfo1">
       <ui:repeat value="#{titleXiProfileHome.instance.contact}"
       var="contact" id="contactInfo">
       <ui:include src="ContactChild.xhtml" />
       </ui:repeat>
       </f:subview>
       <f:subview rendered="#{titleXiProfileHome.instance.contact == null}"
       id="contactInfo1">
       <ui:include src="ContactNew.xhtml" />
       </f:subview>
       </table>
       </fieldset>
       </h:outputText>
       </a:outputPanel>
       </a:region>
      
       <s:decorate id="cppmsUserDecoration" template="layout/edit.xhtml">
       <ui:define name="label">DOT Analyst</ui:define>
       <h:selectManyListbox id="cppmsUsers"
       value="#{titleXiProfileHome.instance.cppmsUsers}" size="2">
       <s:selectItems value="#{cppmsUserList.resultList}" var="cppmsUser"
       label="#{cppmsUser.name}" />
       <s:convertEntity />
       </h:selectManyListbox>
       </s:decorate>
      
       <s:decorate id="approvedDateDecoration" template="layout/edit.xhtml">
       <ui:define name="label">approvedDate</ui:define>
       <h:inputText id="approvedDate" size="16"
       value="#{titleXiProfileHome.instance.approvedDate}">
       <s:convertDateTime type="both" dateStyle="short" />
       <a:support event="onblur" reRender="approvedDateDecoration" />
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="meetingFinancialTestDecoration"
       template="layout/edit.xhtml">
       <ui:define name="label">meetingFinancialTest</ui:define>
       <h:inputText id="meetingFinancialTest"
       value="#{titleXiProfileHome.instance.meetingFinancialTest}">
       <a:support event="onblur"
       reRender="meetingFinancialTestDecoration" />
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="numberOfYearsDecoration"
       template="layout/edit.xhtml">
       <ui:define name="label">numberOfYears</ui:define>
       <h:inputText id="numberOfYears"
       value="#{titleXiProfileHome.instance.numberOfYears}">
       <a:support event="onblur" reRender="numberOfYearsDecoration" />
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="originalSubsidyRateDecoration"
       template="layout/edit.xhtml">
       <ui:define name="label">originalSubsidyRate</ui:define>
       <h:inputText id="originalSubsidyRate"
       value="#{titleXiProfileHome.instance.originalSubsidyRate}"
       size="29">
       <a:support event="onblur" reRender="originalSubsidyRateDecoration" />
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="guaranteeFeeDecoration" template="layout/edit.xhtml">
       <ui:define name="label">guaranteeFee</ui:define>
       <h:inputText id="guaranteeFee"
       value="#{titleXiProfileHome.instance.guaranteeFee}" size="22">
       <a:support event="onblur" reRender="guaranteeFeeDecoration" />
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="investigationFeeDecoration"
       template="layout/edit.xhtml">
       <ui:define name="label">investigationFee</ui:define>
       <h:inputText id="investigationFee"
       value="#{titleXiProfileHome.instance.investigationFee}" size="22">
       <a:support event="onblur" reRender="investigationFeeDecoration" />
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="reserveFundBalanceDecoration"
       template="layout/edit.xhtml">
       <ui:define name="label">reserveFundBalance</ui:define>
       <h:inputText id="reserveFundBalance"
       value="#{titleXiProfileHome.instance.reserveFundBalance}"
       size="22">
       <a:support event="onblur" reRender="reserveFundBalanceDecoration" />
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="guarantorNameDecoration"
       template="layout/edit.xhtml">
       <ui:define name="label">guarantorName</ui:define>
       <h:inputText id="guarantorName" size="50" maxlength="50"
       value="#{titleXiProfileHome.instance.guarantorName}">
       <a:support event="onblur" reRender="guarantorNameDecoration" />
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="modifiedDateDecoration" template="layout/edit.xhtml">
       <ui:define name="label">modifiedDate</ui:define>
       <h:inputText id="modifiedDate" size="16"
       value="#{titleXiProfileHome.instance.modifiedDate}">
       <s:convertDateTime type="both" dateStyle="short" />
       <a:support event="onblur" reRender="modifiedDateDecoration" />
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="guaranteeFeeDateDecoration"
       template="layout/edit.xhtml">
       <ui:define name="label">guaranteeFeeDate</ui:define>
       <h:inputText id="guaranteeFeeDate" size="16"
       value="#{titleXiProfileHome.instance.guaranteeFeeDate}">
       <s:convertDateTime type="both" dateStyle="short" />
       <a:support event="onblur" reRender="guaranteeFeeDateDecoration" />
       </h:inputText>
       </s:decorate>
      
       <div style="clear:both"><span class="required">*</span>
       required fields</div>
      
       </h:panelGrid>
       <div class="actionButtons"><h:commandButton id="save"
       value="Save" action="#{titleXiProfileHome.persist}"
       disabled="#{!titleXiProfileHome.wired}"
       rendered="#{!titleXiProfileHome.managed}" /> <h:commandButton
       id="update" value="Save" action="#{titleXiProfileHome.update}"
       rendered="#{titleXiProfileHome.managed}" /> <h:commandButton
       id="delete" value="Delete" action="#{titleXiProfileHome.remove}"
       rendered="#{titleXiProfileHome.managed}" /> <s:button id="done"
       value="Done" propagation="end" view="/TitleXiProfile.xhtml"
       rendered="#{titleXiProfileHome.managed}" /> <s:button id="cancel"
       value="Cancel" propagation="end"
       view="/#{empty titleXiProfileFrom ? 'TitleXiProfileList' : titleXiProfileFrom}.xhtml"
       rendered="#{!titleXiProfileHome.managed}" /></div>
       </h:form>
       </rich:tab>
       <rich:tab label="Project Description">
       <h:form>
       <rich:panel>
       <h:inputHidden id="projectNumber" required="true"
       disabled="#{titleXiProfileHome.managed}"
       value="#{titleXiProfileHome.instance.projectNumber}">
       <a:support event="onblur" reRender="projectNumberDecoration" />
       </h:inputHidden>
       <s:decorate id="applicationNumberDecoration"
       template="layout/edit.xhtml">
       <ui:define name="label">applicationNumber</ui:define>
       <h:inputText id="applicationNumber" size="15" maxlength="15"
       value="#{titleXiProfileHome.instance.applicationNumber}">
       <a:support event="onblur" reRender="applicationNumberDecoration" />
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="agreementNumberDecoration"
       template="layout/edit.xhtml">
       <ui:define name="label">agreementNumber</ui:define>
       <h:inputText id="agreementNumber" size="15" maxlength="15"
       value="#{titleXiProfileHome.instance.agreementNumber}">
       <a:support event="onblur" reRender="agreementNumberDecoration" />
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="initialClosingDateDecoration"
       template="layout/edit.xhtml">
       <ui:define name="label">Initial Closing Date: </ui:define>
       <h:inputText id="initialClosingDate" size="16"
       value="#{titleXiProfileHome.instance.initialClosingDate}">
       <s:convertDateTime type="both" dateStyle="short" />
       <a:support event="onblur" reRender="initialClosingDateDecoration" />
       </h:inputText>
       </s:decorate>
      
       <s:decorate id="statusDecoration"
       template="layout/edit.xhtml">
       <ui:define name="label">Status: </ui:define>
       <h:selectOneMenu id="status"
       value="#{titleXiProfileHome.instance.status}">
       <s:selectItems value="#{statusList.resultList}" var="status"
       label="#{status.name}" noSelectionLabel="Please Select..."
       hideNoSelectionLabel="true" />
       <a:support event="onchange" reRender="statusDecoration" />
       <s:convertEntity />
       </h:selectOneMenu>
       </s:decorate>
      
       <s:decorate id="receivedDateDecoration" template="layout/edit.xhtml">
       <ui:define name="label">Received Date: </ui:define>
       <h:inputText id="receivedDate" size="16"
       value="#{titleXiProfileHome.instance.receivedDate}">
       <s:convertDateTime type="both" dateStyle="short" />
       <a:support event="onblur" reRender="receivedDateDecoration" />
       </h:inputText>
       </s:decorate>
       </rich:panel>
       <div class="actionButtons"><h:commandButton id="save"
       value="Save" action="#{titleXiProfileHome.persist}"
       disabled="#{!titleXiProfileHome.wired}"
       rendered="#{!titleXiProfileHome.managed}" /> <h:commandButton
       id="update" value="Save" action="#{titleXiProfileHome.update}"
       rendered="#{titleXiProfileHome.managed}" /> <h:commandButton
       id="delete" value="Delete" action="#{titleXiProfileHome.remove}"
       rendered="#{titleXiProfileHome.managed}" /> <s:button id="done"
       value="Done" propagation="end" view="/TitleXiProfile.xhtml"
       rendered="#{titleXiProfileHome.managed}" /> <s:button id="cancel"
       value="Cancel" propagation="end"
       view="/#{empty titleXiProfileFrom ? 'TitleXiProfileList' : titleXiProfileFrom}.xhtml"
       rendered="#{!titleXiProfileHome.managed}" /></div>
       </h:form>
       </rich:tab>
       <rich:tab label="Payment Information">
       </rich:tab>
       <rich:tab label="General Information">
       </rich:tab>
       </rich:tabPanel>
      
       </body>
      
       </html>
      
      </f:view>
      
      


      Here's the error:

      10:47:18,828 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
      java.lang.NullPointerException
       at org.ajax4jsf.org.w3c.tidy.Node.trimInitialSpace(Node.java:967)
       at org.ajax4jsf.org.w3c.tidy.Node.trimSpaces(Node.java:1033)
       at org.ajax4jsf.org.w3c.tidy.ParserImpl$ParseInline.parse(ParserImpl.java:1146)
       at org.ajax4jsf.org.w3c.tidy.ParserImpl.parseTag(ParserImpl.java:224)
       at org.ajax4jsf.org.w3c.tidy.ParserImpl$ParseRow.parse(ParserImpl.java:3033)
       at org.ajax4jsf.org.w3c.tidy.ParserImpl.parseTag(ParserImpl.java:224)
       at org.ajax4jsf.org.w3c.tidy.ParserImpl$ParseRowGroup.parse(ParserImpl.java:2906)
       at org.ajax4jsf.org.w3c.tidy.ParserImpl.parseTag(ParserImpl.java:224)
       at org.ajax4jsf.org.w3c.tidy.ParserImpl$ParseTableTag.parse(ParserImpl.java:2650)
       at org.ajax4jsf.org.w3c.tidy.ParserImpl.parseTag(ParserImpl.java:224)
       at org.ajax4jsf.org.w3c.tidy.ParserImpl$ParseBlock.parse(ParserImpl.java:2488)
       at org.ajax4jsf.org.w3c.tidy.ParserImpl.parseTag(ParserImpl.java:224)
       at org.ajax4jsf.org.w3c.tidy.ParserImpl$ParseInline.parse(ParserImpl.java:1608)
       at org.ajax4jsf.org.w3c.tidy.ParserImpl.parseTag(ParserImpl.java:224)
       at org.ajax4jsf.org.w3c.tidy.ParserImpl$ParseBody.parse(ParserImpl.java:999)
       at org.ajax4jsf.org.w3c.tidy.ParserImpl.parseTag(ParserImpl.java:224)
       at org.ajax4jsf.org.w3c.tidy.ParserImpl$ParseHTML.parse(ParserImpl.java:507)
       at org.ajax4jsf.org.w3c.tidy.ParserImpl.parseDocument(ParserImpl.java:3430)
       at org.ajax4jsf.org.w3c.tidy.Tidy.parse(Tidy.java:384)
       at org.ajax4jsf.org.w3c.tidy.Tidy.parse(Tidy.java:282)
       at org.ajax4jsf.org.w3c.tidy.Tidy.parseDOM(Tidy.java:625)
       at org.ajax4jsf.framework.ajax.xmlfilter.tidy.TidyParser.parseHtmlByTidy(TidyParser.java:98)
       at org.ajax4jsf.framework.ajax.xmlfilter.tidy.TidyParser.parseHtml(TidyParser.java:203)
       at org.ajax4jsf.framework.ajax.xmlfilter.FilterServletResponseWrapper.parseContent(FilterServletResponseWrapper.
      java:607)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:212)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java
      :664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)


        • 1. Re: trimInitialSpace throws nullpointer
          Ilya Shaikovsky Master

          describe your settings please

          • 2. Re: trimInitialSpace throws nullpointer
            J.R. Ector Newbie

            Here's my web.xml

            <?xml version="1.0" ?>
            <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
             version="2.4">
            
             <!-- Ajax4jsf (must come first!) -->
            
             <filter>
             <display-name>Ajax4jsf Filter</display-name>
             <filter-name>ajax4jsf</filter-name>
             <filter-class>org.ajax4jsf.Filter</filter-class>
             </filter>
            
             <filter-mapping>
             <filter-name>ajax4jsf</filter-name>
             <url-pattern>*.seam</url-pattern>
             </filter-mapping>
            
             <!-- Not used, as we've integrated Trinidad -->
             <!-- <context-param>
             <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
             <param-value>org.jboss.seam.ui.facelet.SeamFaceletViewHandler</param-value>
             </context-param>-->
            
             <context-param>
             <param-name>org.ajax4jsf.SKIN</param-name>
             <param-value>blueSky</param-value>
             </context-param>
            
             <!-- Seam -->
            
             <listener>
             <listener-class>
             org.jboss.seam.servlet.SeamListener
             </listener-class>
             </listener>
            
             <filter>
             <filter-name>Seam Filter</filter-name>
             <filter-class>org.jboss.seam.web.SeamFilter</filter-class>
             </filter>
            
             <filter-mapping>
             <filter-name>Seam Filter</filter-name>
             <url-pattern>/*</url-pattern>
             </filter-mapping>
            
             <servlet>
             <servlet-name>Seam Resource Servlet</servlet-name>
             <servlet-class>
             org.jboss.seam.servlet.ResourceServlet
             </servlet-class>
             </servlet>
            
             <servlet-mapping>
             <servlet-name>Seam Resource Servlet</servlet-name>
             <url-pattern>/seam/resource/*</url-pattern>
             </servlet-mapping>
            
             <!-- MyFaces -->
            
             <listener>
             <listener-class>
             org.apache.myfaces.webapp.StartupServletContextListener
             </listener-class>
             </listener>
            
             <!-- Facelets development mode (disable in production) -->
            
             <context-param>
             <param-name>facelets.DEVELOPMENT</param-name>
             <param-value>true</param-value>
             </context-param>
            
             <!-- JSF -->
            
             <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>
            
             <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>*.seam</url-pattern>
             </servlet-mapping>
            
             <security-constraint>
             <display-name>Restrict raw XHTML Documents</display-name>
             <web-resource-collection>
             <web-resource-name>XHTML</web-resource-name>
             <url-pattern>*.xhtml</url-pattern>
             </web-resource-collection>
             <auth-constraint>
             <role-name>NONE</role-name>
             </auth-constraint>
             </security-constraint>
            
             <!-- Trinidad -->
            
             <context-param>
             <param-name>
             org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER
             </param-name>
             <param-value>
             org.jboss.seam.ui.facelet.SeamFaceletViewHandler
             </param-value>
             </context-param>
            
             <context-param>
             <param-name>
             org.apache.myfaces.trinidad.CHANGE_PERSISTENCE
             </param-name>
             <param-value>session</param-value>
             </context-param>
            
             <filter>
             <filter-name>Trinidad</filter-name>
             <filter-class>
             org.apache.myfaces.trinidad.webapp.TrinidadFilter
             </filter-class>
             </filter>
            
             <filter-mapping>
             <filter-name>Trinidad</filter-name>
             <url-pattern>*.seam</url-pattern>
             </filter-mapping>
            
             <servlet>
             <servlet-name>Trinidad Resources</servlet-name>
             <servlet-class>
             org.apache.myfaces.trinidad.webapp.ResourceServlet
             </servlet-class>
             </servlet>
            
             <servlet-mapping>
             <servlet-name>Trinidad Resources</servlet-name>
             <url-pattern>/adf/*</url-pattern>
             </servlet-mapping>
            
            </web-app>
            


            Using jboss 4.0.5, seam 1.2.1GA, ajax4jsf-1.1.1-SNAPSHOT.jar, richfaces-3.0.1-SNAPSHOT.jar, trinidad-1.0.0-incubating jars and I added a4j-trinidad.jar to the WEB-INF/lib. Project was generated by seam-gen.

            Did I leave anything out?