2016-09-30 29 views
0

私はPF6.0とWildfly 10を使用しています。私のWebアプリケーションは、ある時点で、p:inplaceオブジェクトを単一のページに配置する必要があります。簡単に聞こえます。org.primefaces.util.ResourceUtils.getComponentResourcesのjava.lang.NullPointerException

問題:グリッドが大きすぎると、Ajaxリクエストはエラーで終了します。

私は例働いているこの問題を再現するには、次の

ページtest.xhtml:

<?xml version='1.0' encoding='UTF-8' ?> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<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:p="http://primefaces.org/ui"> 
 
    <h:head> 
 
     <title>Test</title> 
 
    </h:head> 
 
    <h:body> 
 
     <h:form> 
 
      <!--it's a part of something bigger so this part is in outputPanel--> 
 
      <p:outputPanel id="details"> 
 
       <h:outputText value="Size: #{backBean.size}" /> 
 
      <p:panelGrid> 
 
       <!--btw. why it forces me to set all of this variables at p.repeat?--> 
 
       <p:repeat value="#{backBean.content}" 
 
          var="_row" 
 
          offset="0" 
 
          step="1" 
 
          size="#{backBean.content.size()}" 
 
          varStatus="_rowStatus" > 
 
        <p:row> 
 
        <p:repeat value="#{_row}" 
 
           var="_cell" 
 
           offset="0" 
 
           step="1" 
 
           size="#{_row.size()}" 
 
           varStatus="_rowStatus" > 
 
         <p:column> 
 
          <p:inplace editor="true"> 
 
           <f:facet name="output"> 
 
             <h:outputText value="#{_cell.output}" />         
 
           </f:facet> 
 
           <f:facet name="input"> 
 
            <!--in real example it will be more complex with checkboxes, selectonemenu etc--> 
 
            <h:outputText value="First:" /> 
 
            <p:inputText value="#{_cell.something}" /> 
 
            <br /> 
 
            <h:outputText value="Second:" /> 
 
            <p:inputText value="#{_cell.another}" /> 
 
           </f:facet> 
 
          </p:inplace> 
 
         </p:column> 
 
        </p:repeat> 
 
        </p:row> 
 
       </p:repeat> 
 
      </p:panelGrid> 
 
      
 

 
     </p:outputPanel> 
 
      <p:commandButton value="more" update="details" actionListener="#{backBean.weNeedMore}" /> 
 
     </h:form> 
 
    </h:body> 
 
</html>

バッキングBean:

package com.test; 

import javax.inject.Named; 
import javax.enterprise.context.SessionScoped; 
import java.io.Serializable; 
import java.util.ArrayList; 
import java.util.List; 
import javax.annotation.PostConstruct; 


@Named(value = "backBean") 
@SessionScoped 
public class BackBean implements Serializable { 

private List<List<CellContent>> content; 
private int size; 

/** 
* Creates a new instance of BackBean 
*/ 
public BackBean() { 
} 

private void build() { 
    content = new ArrayList<>(); 
    for(int i=0;i<size;i++) { 
     List<CellContent> row = new ArrayList<>(); 
     for(int j=0;j<size;j++) { 
      CellContent cell = new CellContent(); 
      row.add(cell); 
     } 
     content.add(row); 
    }  
} 

@PostConstruct 
public void init() { 
    size = 10; 

    //create first content 
    build(); 
} 

public void weNeedMore() { 
    //increase until we get error after click. 
    size = size + 10; 
    build(); 
} 

//plain getters & setters 

public List<List<CellContent>> getContent() { 
    return content; 
} 

public void setContent(List<List<CellContent>> content) { 
    this.content = content; 
} 

public int getSize() { 
    return size; 
} 

public void setSize(int size) { 
    this.size = size; 
} 



} 

と1クラスというオブジェクトを保持しています:

package com.test; 


public class CellContent { 

private String something = ""; 
private String another = ""; 
private String output = "click_me"; 

public CellContent() { 
} 

//some dummy update based on inputs 
private void update() { 
    if(!something.equals("")) 
     output = something; 
    if(!another.equals("")) 
     output = "another: " + another; 
} 

//those two setters update the object 
public void setSomething(String something) { 
    this.something = something; 
    update(); 
} 

public void setAnother(String another) { 
    this.another = another; 
    update(); 
} 

//rest are plain get&seters 
public String getSomething() { 
    return something; 
} 

public String getAnother() { 
    return another; 
} 

public String getOutput() { 
    return output; 
} 

public void setOutput(String output) { 
    this.output = output; 
} 


} 

私のオブジェクトのグリッドは、それが動作する10×10または20×20のような「小さな」のとき - 私は、任意のセルをクリックして、更新することができます。

しかし、私は何かをクリックしたときに(より多くのボタンを押すことで)30にサイズアップを増やすと、このエラーにつながる:

09:47:13602 ERROR [io.undertow.request](デフォルトタスク-89) UT005023:/myapp/test.xhtmlへの例外処理要求:javax.servlet.ServletException (javax.faces.webapp.FacesServlet.service)(FacesServlet.java:671) at io.undertow.servlet.handlers.ServletHandler.handleRequest (FileHandler.java:129) (org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter。 Javaの:io.undertow.servlet.handlers.FilterHandler $ FilterChainImpl.doFilter(FilterHandler.java:131)10時 でio.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) で100) 。 undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)で io.undertow.servlet.handlers.ServletDispatchingHandlerで 。 io.undertow.server.handlers.PredicateHandler.handleRequestでのhandleRequest org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)で(ServletDispatchingHandler.java:36) (PredicateHandler.java:43) io.undertow.servlet.handの io.undertow.server.handlers.PredicateHandler.handleRequestでio.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) でlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) ( IOでio.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) でio.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:51) でPredicateHandler.java:43) 。サーブレット・セキュリティー・アンド・レスリーia.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler)でを練習してください。Javaの:60) io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequestで(IOでio.undertow.security.handlers.NotificationReceiverHandler.handleRequestでCachedAuthenticatedSessionHandler.java:77) (NotificationReceiverHandler.java:50) 。 undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)で org.wildfly.extension.undertow.security.jaccで 。 io.undertow.server.handlers.PredicateHandler.handleRequestでio.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) でJACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61) (PredicateHandler.java:43) io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)io.undertow.servlet.handlersで でio.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284) で。 io.undertow.server.Connectors.executeRootHandlerでio.undertow.servlet.handlers.ServletInitialHandler $ 1.handleRequest(ServletInitialHandler.java:174) (Connectors.java:202)でServletInitialHandler.access $ 000(ServletInitialHandler.java:81) at io.undertow.server.HttpServerExchange $ 1.run(HttpServerExchange.java:793) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:617)org.primefaces.contextでorg.primefaces.util.ResourceUtils.getComponentResourcesでjava.lang.NullPointerExceptionが (ResourceUtils.java:66) :によって引き起こさjava.lang.Thread.run(Thread.java:745) でcom.sun.faces.context.AjaxExceptionHandlerImpl.handlePartialResponseErrorでorg.primefaces.context.PrimePartialResponseWriter.startError(PrimePartialResponseWriter.java:107) (AjaxExceptionHandlerImpl.java:203)で.PrimePartialResponseWriter.startMetadataIfNecessary(PrimePartialResponseWriter.java:280) com.sun.faces.context.AjaxExceptionHandlerImpl.handle(AjaxExceptionHandlerImpl.java:127) (javax.faces.context.ExceptionHandlerWrapper.handle(ExceptionHandlerWrapper.java:100)) at com.sun.faces.lifecycle.Phase.doPhase (段階.java:119) at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:123) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) at javax.faces .webapp.FacesServlet.service(FacesServlet.java:658) ... 34もっと

のことが起こる何を任意のアイデア?このエラーを回避するために調整できるパラメータはありますか?または他のソリューション(私の現在の問題を回避するには、ページネーションとデータグリッドを使用しています)。

答えて

-1

はそれを見つけた;)

私はそれはPrimeFacesの問題だかどうかを確認するために戻ってPF 5.3に切り替えます。 一切pはありません:私はUIに切り替えるようPF5.3 @繰り返し:繰り返します。

同じことがここにあったが、エラーメッセージは最終的に何が起こっているのか伝えます:

10:37:58508 SEVERE [javax.enterprise.resource.webcontainer.jsf.context](デフォルトタスク-44)のjava.lang .IllegalStateException:UT000047:パラメータの数はio.undertow.server.handlers.form.FormDataでio.undertow.server.handlers.form.FormData.add(FormData.java:78) で1000の最大値を超え。 add(FormData。Javaの:68)

私は何をする必要があるかすべては、スタンドアロン構成でHTTPリスナーで更新MAX-パラメータの値である:

<subsystem xmlns="urn:jboss:domain:undertow:3.0"> 
 
      <buffer-cache name="default"/> 
 
      <server name="default-server"> 
 
       <http-listener name="default" max-parameters="10000" socket-binding="http" redirect-socket="https"/>

https://developer.jboss.org/thread/241526でそれを見つけた)

+1

'partialSubmit'を使用する方が便利です。これは気違いです。 – BalusC

+0

@BalusCこの特定の例で 'partialSubmit'を使用する方法 - インプレースを使用する場合? – drops

+0

このソリューションの次の点は、パフォーマンスが悪い理由を質問することです。 BalusCが示唆していることをより良くする – Kukeltje

関連する問題