1 Reply Latest reply on Feb 19, 2006 4:24 PM by Alejandro Guizar

    Success on Tomcat but Error on Jbpm Server

    Tran Lap Newbie

      Hi all.
      I have this code:
      1. JSP file(DataTableTest.jsp):

      <%@ page language="java" pageEncoding="UTF-8"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      
      <f:view>
       <h:form id="dataTableForm">
       <h:dataTable border="1" id="dataTableTest" value="#{dataTableTest.data}" var="item">
       <h:column>
       <h:outputLabel value="#{item.label}"/>
       <h:inputText value="#{item.text}" />
       </h:column>
       <h:column>
       <h:commandButton action="#{dataTableTest.update}" value="Update" />
       </h:column>
       </h:dataTable>
       <h:commandButton value="Preview" action="#{dataTableTest.previewMe}" />
       </h:form>
      </f:view>
      

      2. Java1(DataTableTest.java):
      package org.jbpm.webapp.bean;
      import java.util.ArrayList;
      import java.util.List;
      
      import javax.faces.model.DataModel;
      import javax.faces.model.ListDataModel;
      
      public class DataTableTest {
       private DataModel myData=null;
       private List listData=null;
      
       public DataModel getData(){
       if (myData==null){
       myData=new ListDataModel();
       }
       if (listData==null){
       listData=new ArrayList();
       MyObject myObject=new MyObject();
       myObject.setLabel("line1");
       myObject.setText("Line 1");
       listData.add(myObject);
      
       myObject=new MyObject();
       myObject.setLabel("line2");
       myObject.setText("Line 2");
       listData.add(myObject);
       }
       myData.setWrappedData(listData);
       return myData;
       }
      
       public String previewMe(){
       int origin=myData.getRowIndex();
       System.out.println("1.Debug from Data table ===========");
       for (int i=0; i<myData.getRowCount(); i++){
       myData.setRowIndex(i);
       System.out.println("line "+i+" : "+((MyObject)myData.getRowData()).getText());
       }
       System.out.println("2.Debug from Data table ===========");
       myData.setRowIndex(origin);
       return "home";
       }
      
       public String update(){
       int originIndex=myData.getRowIndex();
       if (originIndex>=0){
       String item=((MyObject)myData.getRowData()).getText();
       String label=((MyObject)myData.getRowData()).getLabel();
       MyObject myObject=new MyObject();
       myObject.setLabel(label);
       myObject.setText(item);
      
       listData.set(originIndex, myObject);
       System.out.println("Index: " + originIndex + " data: " + myObject.getText());
       }
       return "home";
       }
      }
      

      3. Java2(MyObject.java):
      package org.jbpm.webapp.bean;
      
      public class MyObject {
       private String label;
       private String text;
      
       public String getLabel() {
       return label;
       }
       public void setLabel(String label) {
       this.label = label;
       }
       public String getText() {
       return text;
       }
       public void setText(String text) {
       this.text = text;
       }
      }


      Do not worry about faces-config.xml.

      Here is my PROBLEM.
      When i run this code on Tomcat Server, the Result as i want. But when i run this code with JBPM WEB APP(i insert my code into jbpm.war) on Jbpm Server, i have this error at start time of DataTableTest.jsp page.
      4. Error:
      17:25:14,578 DEBUG [LogFilter] request http://localhost:8080/jbpm/faces/login.jsp
      17:25:14,578 DEBUG [LogFilter] request parameter [login:username]=Every One
      17:25:14,578 DEBUG [LogFilter] request parameter [login_SUBMIT]=1
      17:25:14,578 DEBUG [LogFilter] request parameter [login:_link_hidden_]=
      17:25:14,593 DEBUG [LogFilter] request parameter [login:_id3]=Data Table
      17:25:14,593 DEBUG [LogFilter] session parameter [org.apache.myfaces.application.jsp.JspStateManagerImpl.SERIALIZED_VIEW-/login.jsp]=[Ljava.lang.Object;@437d
      17:25:14,593 DEBUG [LogFilter] session parameter [javax.faces.request.charset]=ISO-8859-1
      17:25:14,593 DEBUG [LogFilter] session parameter [userBean]=org.jbpm.webapp.bean.UserBean@f7cbcc
      17:25:14,593 DEBUG [PersistenceContext] beginning transaction
      17:25:14,718 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
      java.lang.NullPointerException: Attribute 'for' of label component with id dataTableForm:dataTableTest_0:_id1
       at org.apache.myfaces.renderkit.html.HtmlLabelRenderer.encodeBegin(HtmlLabelRenderer.java:60)
       at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:307)
       at org.apache.myfaces.renderkit.RendererUtils.renderChild(RendererUtils.java:441)
       at org.apache.myfaces.renderkit.RendererUtils.renderChildren(RendererUtils.java:427)
       at org.apache.myfaces.renderkit.RendererUtils.renderChild(RendererUtils.java:448)
       at org.apache.myfaces.renderkit.html.HtmlTableRendererBase.renderColumnBody(HtmlTableRendererBase.java:195)
       at org.apache.myfaces.renderkit.html.HtmlTableRendererBase.encodeColumnChild(HtmlTableRendererBase.java:168)
       at org.apache.myfaces.renderkit.html.HtmlTableRendererBase.encodeInnerHtml(HtmlTableRendererBase.java:154)
       at org.apache.myfaces.renderkit.html.HtmlTableRendererBase.encodeChildren(HtmlTableRendererBase.java:94)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:319)
       at javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:343)
       at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:251)
       at org.apache.myfaces.taglib.UIComponentBodyTagBase.doEndTag(UIComponentBodyTagBase.java:55)
       at org.apache.jsp.DataTableTest_jsp._jspx_meth_h_dataTable_0(org.apache.jsp.DataTableTest_jsp:192)
       at org.apache.jsp.DataTableTest_jsp._jspx_meth_h_form_0(org.apache.jsp.DataTableTest_jsp:139)
       at org.apache.jsp.DataTableTest_jsp._jspx_meth_f_view_0(org.apache.jsp.DataTableTest_jsp:109)
       at org.apache.jsp.DataTableTest_jsp._jspService(org.apache.jsp.DataTableTest_jsp:74)
       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
       at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
       at org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl.dispatch(JspTilesViewHandlerImpl.java:233)
       at org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl.renderView(JspTilesViewHandlerImpl.java:219)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jbpm.webapp.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:25)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jbpm.webapp.filter.PersistenceFilter.doFilter(PersistenceFilter.java:28)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jbpm.webapp.filter.ContextFilter.doFilter(ContextFilter.java:19)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jbpm.webapp.filter.LogFilter.doFilter(LogFilter.java:38)
       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:81)
       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.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
       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:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
       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)
      17:25:14,781 DEBUG [PersistenceContext] rolling back transaction
      17:25:14,781 ERROR [[FacesServlet]] Servlet.service() for servlet FacesServlet threw exception
      javax.faces.FacesException: Attribute 'for' of label component with id dataTableForm:dataTableTest_0:_id1
       at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421)
       at org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl.dispatch(JspTilesViewHandlerImpl.java:233)
       at org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl.renderView(JspTilesViewHandlerImpl.java:219)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:95)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jbpm.webapp.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:25)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jbpm.webapp.filter.PersistenceFilter.doFilter(PersistenceFilter.java:28)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jbpm.webapp.filter.ContextFilter.doFilter(ContextFilter.java:19)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jbpm.webapp.filter.LogFilter.doFilter(LogFilter.java:38)
       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:81)
       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.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
       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:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
       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)
      Caused by: org.apache.jasper.JasperException: Attribute 'for' of label component with id dataTableForm:dataTableTest_0:_id1
       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
       at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
       ... 35 more
      17:25:14,828 DEBUG [StaticNotifier] woke up


      Help me to correct it please.

        • 1. Re: Success on Tomcat but Error on Jbpm Server
          Alejandro Guizar Master

          I'm no JSF expert, but when you use a label component, you probably have to specify what other component you are labeling:

          <h:dataTable border="1" id="dataTableTest" value="#{dataTableTest.data}" var="item">
           <h:column>
           <h:outputLabel value="#{item.label}" for="itemText"/>
           <h:inputText value="#{item.text}" id="itemText" />
           </h:column>
           <h:column .../>
          </h:dataTable>

          The different results you get from running in Tomcat vs JBoss may be due to different JSF implementations/versions in each container. One of them is less forgiving.