[Seasar-user:9509] Re: [Teeda]ファイルアップロードのサンプル

fujihara [E-MAIL ADDRESS DELETED]
2007年 7月 27日 (金) 14:36:58 JST


お世話になります。fujiharaです。

> MyFacesのTomahawkはJavaExpertと全く同じバージョンを
> 使ってみてください.その後のバージョンでは実装方法と設定方法が
> 変わっているはずなので、動作しない可能性があります.
> (こちらでは未検証です)

JavaExpertのサンプルをダウンロードして動かしました
ちなみにteeda1.0.4です。サンプルはエラーは出ませんでしたが
アップロードしたファイルが見当たりません。Web.xmlの設定では
/tmp配下に出来てるはずなのですが...

開発のターゲット環境でJavaExpertのサンプルのtomahawkの
ソースをコピーして動かしましたcommons-fileuploadとtomahawk
のバージョンはJavaExpertのサンプルと同じです。
commons-fileupload-1.0.jar
tomahawk-1.1.1.jar

開発環境のteeda1.0.7環境だと同じソースで同じtomahawkでも
java.lang.NullPointerExceptionが出ます。

原因が良く分かりません。
お手数をおかけしますが宜しくお願いします。

----- Original Message ----- 
From: "Shinpei Ohtani" <[E-MAIL ADDRESS DELETED]>
To: <[E-MAIL ADDRESS DELETED]>
Sent: Friday, July 27, 2007 1:16 PM
Subject: [Seasar-user:9506] Re:[Teeda]ファイルアップロードのサンプル


> 大谷です.
>
> MyFacesのTomahawkはJavaExpertと全く同じバージョンを
> 使ってみてください.その後のバージョンでは実装方法と設定方法が
> 変わっているはずなので、動作しない可能性があります.
> (こちらでは未検証です)
>
>
> 07/07/27 に fujihara<[E-MAIL ADDRESS DELETED]> さんは書きました:
>> お世話になりますfujiharaです。
>>
>> Churaプロジェクト(Teeda1.07+S2DAO1.0.43)で社内システムを
>> 構築しています。
>>
>> ファイルアップロードの試験をしていますがうまくいきません。
>> 以下の様なエラーが出てしまいます。
>>
>> DEBUG 2007-07-27 12:53:33,531 [http-8080-Processor24] HOT deployを開始します
>> DEBUG 2007-07-27 12:53:33,875 [http-8080-Processor24] クラス(jp.roaso.web.upload.UploadPage[upload_uploadPage])のコンポーネント定義を登録します
>> DEBUG 2007-07-27 12:53:35,281 [http-8080-Processor24] [HtmlMessage]
>> forComponent [all] is null. [id=allMessage]
>> WARN  2007-07-27 12:53:35,328 [http-8080-Processor24]
>> jp.roaso.web.upload.UploadPage$$EnhancedByS2AOP$$2646f7のプロパティ(uploadedFile)が見つからないので設定をスキップします
>> 2007-07-27 12:53:35,359 [http-8080-Processor24] INFO
>> org.apache.myfaces.shared_tomahawk.config.MyfacesConfig - No context init
>> parameter 'org.apache.myfaces.PRETTY_HTML' found, using default value 
>> true
>> 2007-07-27 12:53:35,359 [http-8080-Processor24] INFO
>> org.apache.myfaces.shared_tomahawk.config.MyfacesConfig - No context init
>> parameter 'org.apache.myfaces.ALLOW_JAVASCRIPT' found, using default 
>> value
>> true
>> 2007-07-27 12:53:35,359 [http-8080-Processor24] INFO
>> org.apache.myfaces.shared_tomahawk.config.MyfacesConfig - No context init
>> parameter 'org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS' found, 
>> using
>> default value true
>> 2007-07-27 12:53:35,359 [http-8080-Processor24] INFO
>> org.apache.myfaces.shared_tomahawk.config.MyfacesConfig - No context init
>> parameter 'org.apache.myfaces.DETECT_JAVASCRIPT' found, using default 
>> value
>> false
>> 2007-07-27 12:53:35,359 [http-8080-Processor24] INFO
>> org.apache.myfaces.shared_tomahawk.config.MyfacesConfig - No context init
>> parameter 'org.apache.myfaces.AUTO_SCROLL' found, using default value 
>> false
>> 2007-07-27 12:53:35,359 [http-8080-Processor24] INFO
>> org.apache.myfaces.shared_tomahawk.config.MyfacesConfig - No context init
>> parameter 'org.apache.myfaces.ADD_RESOURCE_CLASS' found, using default 
>> value
>> org.apache.myfaces.renderkit.html.util.DefaultAddResource
>> 2007-07-27 12:53:35,359 [http-8080-Processor24] INFO
>> org.apache.myfaces.shared_tomahawk.config.MyfacesConfig - No context init
>> parameter 'org.apache.myfaces.RESOURCE_VIRTUAL_PATH' found, using default
>> value /faces/myFacesExtensionResource
>> 2007-07-27 12:53:35,359 [http-8080-Processor24] INFO
>> org.apache.myfaces.shared_tomahawk.config.MyfacesConfig - No context init
>> parameter 'org.apache.myfaces.CHECK_EXTENSIONS_FILTER' found, using 
>> default
>> value true
>> DEBUG 2007-07-27 12:53:35,359 [http-8080-Processor24] HOT deployを終了しました
>>
>> DEBUG 2007-07-27 12:53:43,234 [http-8080-Processor24] HOT deployを開始します
>> DEBUG 2007-07-27 12:53:45,015 [http-8080-Processor24]
>> java.lang.NullPointerException
>>  at
>> org.apache.myfaces.renderkit.html.util.AutoScrollPhaseListener.afterPhase(AutoScrollPhaseListener.java:35)
>>  at
>> org.seasar.teeda.core.lifecycle.AbstractPhase.postPhase(AbstractPhase.java:71)
>>  at
>> org.seasar.teeda.core.lifecycle.AbstractPhase.execute(AbstractPhase.java:57)
>>  at
>> org.seasar.teeda.core.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:68)
>>  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:92)
>>  at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
>>  at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
>>  at
>> org.seasar.framework.container.hotdeploy.HotdeployFilter.doFilter(HotdeployFilter.java:63)
>>  at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
>>  at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
>>  at
>> org.seasar.framework.container.filter.S2ContainerFilter.doFilter(S2ContainerFilter.java:63)
>>  at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
>>  at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
>>  at
>> org.seasar.extension.filter.EncodingFilter.doFilter(EncodingFilter.java:62)
>>  at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
>>  at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
>>  at
>> org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
>>  at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
>>  at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
>>  at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
>>  at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
>>  at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
>>  at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
>>  at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
>>  at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
>>  at
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
>>  at
>> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
>>  at
>> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
>>  at
>> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
>>  at
>> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
>>  at java.lang.Thread.run(Unknown Source)
>>
>> commons-fileupload-1.2.jar
>> tomahawk-1.1.6.jar
>>>> commons-fileupload-1.0.jar
>> tomahawk-1.1.1.jar
>> でも同じ結果でした。
>>
>> ------------------------Pageクラス-------------------------
>> package jp.roaso.web.upload;
>>
>> import java.io.Serializable;
>> import org.apache.myfaces.custom.fileupload.UploadedFile;
>>
>> public class UploadPage implements Serializable {
>>  private static final long serialVersionUID = 1L;
>>
>>  private UploadedFile uploadedFile;
>>
>>  private long fileSize;
>>
>>  private String fileName;
>>
>>  public long getFileSize() {
>>   return this.fileSize;
>>  }
>>
>>  public String getFileName() {
>>   return this.fileName;
>>  }
>>
>>  public UploadedFile getUploadedFile() {
>>   return this.uploadedFile;
>>  }
>>
>>  public void setUploadedFile(UploadedFile uploadedFile) {
>>   this.uploadedFile = uploadedFile;
>>  }
>>
>>  public String doUpload() {
>>   if (uploadedFile != null) {
>>    this.fileSize = uploadedFile.getSize();
>>    this.fileName = uploadedFile.getName();
>>   }
>>   return null;
>>  }
>> }
>> ----------------------------------------------------------
>>
>> --------------------------HTML---------------------------
>> <?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:x="http://myfaces.apache.org/tomahawk">
>> <head>
>> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
>> <title>FileUpload</title>
>> </head>
>> <body>
>> <form id="form" enctype="multipart/form-data">
>> <span id="allMessage"/>
>> <x:inputFileUpload id="uploadedFile"
>> value="#{tomahawk_uploadPage.uploadedFile}"/>
>> <input type="submit" id="doUpload" value="FileUpload"/>
>> <br/>
>> upload File Size : <span id="fileSize"/><br/>
>> upload File Name : <span id="fileName"/>
>> </form>
>> </body>
>> </html>
>> ----------------------------------------------------------
>>
>> --------------------------web.xml--------------------------
>>     <filter>
>>         <filter-name>tomahawkFilter</filter-name>
>> <!--
>> <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>-->
>> 
>> <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
>>         <init-param>
>>             <param-name>uploadMaxFileSize</param-name>
>>             <param-value>100m</param-value>
>>             <description>Set the size limit for uploaded files.
>>                 Format: 10 - 10 bytes
>>                         10k - 10 KB
>>                         10m - 10 MB
>>                         1g - 1 GB
>>             </description>
>>         </init-param>
>>         <init-param>
>>             <param-name>uploadThresholdSize</param-name>
>>             <param-value>100m</param-value>
>>             <description>Set the threshold size - files
>>                     below this limit are stored in memory, files above
>>                     this limit are stored on disk.
>>
>>                 Format: 10 - 10 bytes
>>                         10k - 10 KB
>>                         10m - 10 MB
>>                         1g - 1 GB
>>             </description>
>>         </init-param>
>>             <init-param>
>>             <param-name>uploadRepositoryPath</param-name>
>>             <param-value>/temp</param-value>
>>             <description>Set the path where the intermediary files will 
>> be
>> stored.
>>             </description>
>>         </init-param>
>>     </filter>
>>
>>     <filter-mapping>
>>         <filter-name>tomahawkFilter</filter-name>
>>         <url-pattern>*.html</url-pattern>
>>     </filter-mapping>
>>
>> ----------------------------------------------------------
>>
>> ログにuploadedFileが見つかりませんって出てるのが気になりますが...でも
>> Pageクラスには宣言してあるし???
>>
>> 大変申し訳ありませんがどなたかご教授願えないでしょうか?
>>
>> _______________________________________________
>> Seasar-user mailing list
>> [E-MAIL ADDRESS DELETED]
>> https://ml.seasar.org/mailman/listinfo/seasar-user
>>
>
>
> -- 
> =============================
> Shinpei Ohtani
> [E-MAIL ADDRESS DELETED]
> =============================
> _______________________________________________
> Seasar-user mailing list
> [E-MAIL ADDRESS DELETED]
> https://ml.seasar.org/mailman/listinfo/seasar-user
> 



Seasar-user メーリングリストの案内