我正在运行一个问题。我在我的应用程序中使用了ICEFaces jar,我正在weblogic中部署。当我部署战争并尝试上传战争时,它不起作用,我能够捕获以下异常。但是,当我在weblogic中部署爆炸的war文件夹时,它无法正常工作。由于它适用于爆炸的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作为动作映射的动作类
堆栈跟踪
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 :(得分:0)
你走在正确的轨道上。部署爆炸的WAR会创建一个可写的目录结构,但只部署WAR将不会这样做,并且您无法在该WAR中创建目录。
因此,您需要将文件上载目录放在固定位置。请参阅:How to specify an absolute path for com.icesoft.faces.uploadDirectory