2017-04-06 107 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