2017-05-04 5 views
0

こんにちは私は、Bean内のメソッドが空であっても、ファイルをアップロードするときにエラーが発生します。ここでh:inputFileとh:commandButton - NullPointerException

は、私のJSF

ここ
<html xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:h="http://xmlns.jcp.org/jsf/html" 
    xmlns:f="http://xmlns.jcp.org/jsf/core"> 
<h:head> 
    <h:outputStylesheet library="css" name="main-admin.css"/> 
</h:head> 
<h:body> 
    <div class="container-fluid"> 
     <div class="row"> 
      <div class="col-sm-12"> 
       <h:form id="form" enctype="multipart/form-data"> 
        <h:inputFile id="file" value="#{userPictureUploadView.file}"/> 
        <h:commandButton value="Upload" 
            action="#{userPictureUploadView.uploadProfilePicture}"> 
        </h:commandButton> 
       </h:form> 
      </div> 
     </div> 
    </div> 

</h:body> 
</html> 

である私は例外を取得していますなぜ私は知らない私は

Caused by: java.lang.NullPointerException: Argument Error: Parameter text is null 
    at com.sun.faces.renderkit.html_basic.HtmlResponseWriter.writeText(HtmlResponseWriter.java:949) 
    at javax.faces.context.ResponseWriterWrapper.writeText(ResponseWriterWrapper.java:298) 
    at com.liferay.faces.bridge.renderkit.primefaces.internal.PrimeFacesInlineScript.encodeBegin(PrimeFacesInlineScript.java:51) 
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1854) 
    at com.liferay.faces.bridge.renderkit.html_basic.internal.BodyRendererBridgeImpl.encodeBegin(BodyRendererBridgeImpl.java:117) 
    at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:865) 
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1854) 
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859) 
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:458) 
    at javax.faces.view.ViewDeclarationLanguageWrapper.renderView(ViewDeclarationLanguageWrapper.java:146) 
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134) 
    at com.liferay.faces.bridge.application.internal.ViewHandlerCompatImpl.renderView(ViewHandlerCompatImpl.java:95) 
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120) 
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) 
    ... 223 more 

を取得するとエラーになり、それはエラーがメソッドの後に解雇されているようですリロード時と同様に実行されます。

これはすべてLiferayで作成したポートレットにあります。

詳細情報:

  • 私はLiferay.faces.bridge のこれらのバージョン使用しています 'com.liferay.faces:com.liferay.faces.bridge.impl:4.0.0' 「をCOM .liferay.faces:com.liferay.faces.bridge.ext:5.0.0'
+1

を使用するようになりますLiferay Faces Bridge(Impl):[FACES-3031](https://issues.liferay.com/browse/)。 – stiemannkj1

+1

カイルは正しいです。問題は[FACES-3031](https://issues.liferay.com/browse/FACES-3031)によって発生しています。 – Vernon

+0

1.あなたはどのバージョンのLiferayを使用していますか? – Vernon

答えて

1

ソリューションは、あなたの問題はバグが原因であるAJAXやuploadListener

     <div class="form-group"> 
          <div class="control-label">#{res['userProfilePictureUpload.profilePicture']}</div> 
          <p:fileUpload fileUploadListener="#{userPictureUploadView.handleFileUpload}" mode="advanced" allowTypes="/(\.|\/)(png)$/" auto="true" previewWidth="0" label="#{res['userProfilePictureUpload.upload']}" oncomplete="location.reload();"/> 
         </div> 
関連する問題