[jboss-user] [JBoss Seam] - Tomahawk dataTable & NPE Problem
cavani
do-not-reply at jboss.com
Wed Nov 1 13:09:46 EST 2006
I use this:
| <t:dataTable id="operationsTable"
| rendered="#{ operations.rowCount > 0 }"
| value="#{ operations }"
| var="operation"
| rowIndexVar="i"
| sortColumn="#{ operationView.column }"
| sortAscending="#{ operationView.ascending }"
| headerClass="dataHeader"
| rowClasses="dataLine1, dataLine2"
| styleClass="dataTable">
|
| <h:column>
| <f:facet name="header">
| <h:commandLink action="#{ operationFiling.create }">
| <h:graphicImage url="/img/new.png"style="margin-left: 2px; margin-right: 10px;"/>
| </h:commandLink>
| </f:facet>
| <h:outputText value="#{ i+1 }"/>
| </h:column>
|
| <h:column>
| <f:facet name="header">
| <t:commandSortHeader columnName="name" arrow="true">
| <h:outputText value="Nome"/>
| </t:commandSortHeader>
| </f:facet>
| <s:link value="#{ operation[1] }" action="#{ operationFiling.open(operation[0]) }" styleClass="blue"/>
| </h:column>
| </t:dataTable>
|
Action:
| @Stateful
| @Name("operationView")
| @Scope(ScopeType.SESSION)
| public class OperationViewAction implements OperationView
| {
|
| @In(create = true)
| private QueryService queryService;
|
| @DataModel
| private List<Object[]> operations;
|
| private String column;
|
| private boolean ascending;
|
| public String getColumn()
| {
| return column;
| }
|
| public void setColumn(String column)
| {
| if (!column.equals(this.column)) sortOperations();
| this.column = column;
| }
|
| public boolean isAscending()
| {
| return ascending;
| }
|
| public void setAscending(boolean ascending)
| {
| if (ascending != this.ascending) sortOperations();
| this.ascending = ascending;
| }
|
|
| public String clean()
| {
| operations = null;
| column = "name";
| ascending = false;
|
| return "operation";
| }
|
|
| @Observer("updateOperationList")
| public void loadOperations()
| {
| // fill operations list
| // ...
|
| sortFidcOperations();
| }
|
| private void sortOperations()
| {
| if (operations == null)
| return;
|
| Comparator<Object[]> comp = new Comparator<Object[]>()
| {
|
| private RuleBasedCollator collator = (RuleBasedCollator) Collator.getInstance(new Locale("pt_BR"));
|
| public int compare(Object[] x, Object[] y)
| {
| if (ascending)
| {
| Object[] t = y;
| y = x;
| x = t;
| }
| if (column.equals("name"))
| {
| String x1 = (String) x[1];
| String y1 = (String) y[1];
|
| if (x1 == null && y1 == null) return 0;
|
| if (x1 == null) return 1;
|
| if (y1 == null) return -1;
|
| return collator.compare(x1, y1);
| }
| }
|
| };
|
| Collections.sort(operations, comp);
| }
|
|
| @Destroy @Remove
| public void destroy()
| {
| clean();
| }
|
| }
|
And I had this exception:
| 16:12:59,165 ERROR [STDERR] 01/11/2006 16:12:59 com.sun.facelets.FaceletViewHandler handleRenderException
| SEVERE: Error Rendering View[/Data/Operation.xhtml]
| java.lang.NullPointerException
| at org.jboss.seam.ui.UISelection.getValue(UISelection.java:27)
| at org.jboss.seam.ui.HtmlLink.getParameterString(HtmlLink.java:250)
| at org.jboss.seam.ui.HtmlLink.encodeBegin(HtmlLink.java:178)
| at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:433)
| at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:419)
| at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:440)
| at org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererBase.renderColumnBody(HtmlTableRendererBase.java:313)
| at org.apache.myfaces.renderkit.html.ext.HtmlTableRenderer.renderColumnBody(HtmlTableRenderer.java:593)
| at org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererBase.encodeColumnChild(HtmlTableRendererBase.java:282)
| at org.apache.myfaces.renderkit.html.ext.HtmlTableRenderer.encodeColumnChild(HtmlTableRenderer.java:496)
| at org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererBase.encodeInnerHtml(HtmlTableRendererBase.java:258)
| at org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererBase.encodeChildren(HtmlTableRendererBase.java:123)
| at org.apache.myfaces.renderkit.html.ext.HtmlTableRenderer.encodeChildren(HtmlTableRenderer.java:171)
| at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:524)
| at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererUtils.java:436)
| at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChildren(RendererUtils.java:419)
| at org.apache.myfaces.shared_impl.renderkit.html.HtmlGroupRendererBase.encodeEnd(HtmlGroupRendererBase.java:75)
| at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
| at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:242)
| at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
| at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
| at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:580)
| at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
| 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:524)
| 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)
| 16:12:59,189 ERROR [SeamExceptionFilter] could not destroy contexts
| java.lang.IllegalStateException: No session context active
| at org.jboss.seam.core.ConversationEntries.instance(ConversationEntries.java:85)
| at org.jboss.seam.core.Manager.getCurrentConversationEntry(Manager.java:681)
| at org.jboss.seam.core.Manager.unlockConversation(Manager.java:329)
| at org.jboss.seam.contexts.Lifecycle.flushAndDestroyContexts(Lifecycle.java:367)
| at org.jboss.seam.contexts.Lifecycle.endRequest(Lifecycle.java:281)
| at org.jboss.seam.servlet.SeamExceptionFilter.endWebRequestAfterException(SeamExceptionFilter.java:81)
| at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:56)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
| 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:524)
| 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)
| 16:12:59,190 ERROR [SeamExceptionFilter] uncaught exception handled by Seam
| javax.servlet.ServletException
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:156)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
| 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:524)
| 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)
| 16:12:59,220 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
| java.lang.NullPointerException
| at org.jboss.seam.ui.UISelection.getValue(UISelection.java:27)
| at org.jboss.seam.ui.HtmlLink.getParameterString(HtmlLink.java:250)
| at org.jboss.seam.ui.HtmlLink.encodeBegin(HtmlLink.java:178)
| at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:433)
| at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:419)
| at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:440)
| at org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererBase.renderColumnBody(HtmlTableRendererBase.java:313)
| at org.apache.myfaces.renderkit.html.ext.HtmlTableRenderer.renderColumnBody(HtmlTableRenderer.java:593)
| at org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererBase.encodeColumnChild(HtmlTableRendererBase.java:282)
| at org.apache.myfaces.renderkit.html.ext.HtmlTableRenderer.encodeColumnChild(HtmlTableRenderer.java:496)
| at org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererBase.encodeInnerHtml(HtmlTableRendererBase.java:258)
| at org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererBase.encodeChildren(HtmlTableRendererBase.java:123)
| at org.apache.myfaces.renderkit.html.ext.HtmlTableRenderer.encodeChildren(HtmlTableRenderer.java:171)
| at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:524)
| at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererUtils.java:436)
| at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChildren(RendererUtils.java:419)
| at org.apache.myfaces.shared_impl.renderkit.html.HtmlGroupRendererBase.encodeEnd(HtmlGroupRendererBase.java:75)
| at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
| at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:242)
| at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
| at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
| at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:580)
| at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
| 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:524)
| 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)
|
The exception occurs in UISelection:
| public Object getValue()
| {
| Object value = Contexts.lookupInStatefulContexts(dataModel);
| int rowIndex = ( (DataModel) value ).getRowIndex();
| return value==null || rowIndex<0 ?
| null : var + ':' + dataModel + '[' + rowIndex + ']';
| }
|
I think this should be:
| public Object getValue()
| {
| Object value = Contexts.lookupInStatefulContexts(dataModel);
| int rowIndex = value==null ? -1 : ( (DataModel) value ).getRowIndex();
| return rowIndex<0 ?
| null : var + ':' + dataModel + '[' + rowIndex + ']';
| }
|
Someone could give me a clue why this is not working? I should give up from Tomahawk?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982432#3982432
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982432
More information about the jboss-user
mailing list