2017-04-06 91 views
0

我正在運行時遇到問題。我在使用weblogic部署的應用程序中使用了ICEFaces罐子。當我部署戰爭並嘗試上傳戰爭時,它不起作用,我能夠捕捉到以下例外情況。但是,當我在weblogic中部署分解的war文件夾時,它不起作用。由於它正在爲爆炸戰爭文件夾工作,我覺得它無法創建一個文件夾來上傳文件。有什麼我需要配置來解決這個問題?當warlogi部署在weblogic中時fileupload不工作,但是如果部署了爆炸war文件夾,則工作

部分的

的web.xml

部分的
<context-param> 
     <param-name>com.icesoft.faces.uploadDirectory</param-name> 
     <param-value>/upload</param-value> 
    </context-param> 

JSP

<ice:inputFile 
          submitOnUpload="postUpload" id="inputFileComponent" 
          actionListener="#{uploadAction.uploadActionListener}" 
          action="#{uploadAction.doUploadFile}" /> 

其中uploadAction是具有方法uploadActionListener()作爲動作偵聽器和doUploadFile動作類作爲動作映射

Stacktrace

com.icesoft.faces.webapp.xmlhttp.PersistentFacesState [pool-2-thread-1]  Exception occured during execute push on /jsp/upload.jspx 
javax.faces.el.EvaluationException: /jsp/upload.jspx @64,48 actionListener="#{uploadAction.uploadActionListener}": java.lang.NullPointerException 
     at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73) 
     at javax.faces.component.UICommand.broadcast(UICommand.java:131) 
     at com.icesoft.faces.component.inputfile.InputFile.broadcast(InputFile.java:152) 
     at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:115) 
     at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:191) 
     at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32) 
     at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95) 
     at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70) 
     at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.execute(PersistentFacesState.java:286) 
     at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.executeAndRender(PersistentFacesState.java:314) 
     at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.setupAndExecuteAndRender(PersistentFacesState.java:326) 
     at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState$RenderRunner.run(PersistentFacesState.java:450) 
     at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665) 
     at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690) 
     at java.lang.Thread.run(Thread.java:724) 
Caused by: java.lang.NullPointerException 
     at java.io.FileInputStream.<init>(FileInputStream.java:134) 
     at java.io.FileReader.<init>(FileReader.java:72) 

回答

0

你是在正確的軌道上。部署分解式WAR會創建一個可寫的目錄結構,但僅部署WAR將不會這樣做,並且無法在該WAR中創建目錄。

所以你需要把文件上傳目錄放在一個固定的位置。請參閱:How to specify an absolute path for com.icesoft.faces.uploadDirectory

+0

昨天我嘗試了類似的方式,但沒有奏效。我給了絕對的路徑,並最終奏效。謝謝@TheCoolah – user123475