Note that there are some explanatory texts on larger screens.

plurals
  1. POGWT Upload fails to App Engine
    primarykey
    data
    text
    <p>I want to provide a file upload to Google App Engine with the "GWT Upload" (<a href="https://code.google.com/p/gwtupload/" rel="nofollow noreferrer">https://code.google.com/p/gwtupload/</a>). During the upload I get an error. As <code>UploadAction</code> servlet I use the build in: <code>gwtupload.server.gae.AppEngineUploadAction</code></p> <p>The servlet is configured in the web.xml in the following way:</p> <pre><code>&lt;context-param&gt; &lt;!-- max size of the upload request --&gt; &lt;param-name&gt;maxSize&lt;/param-name&gt; &lt;param-value&gt;3145728&lt;/param-value&gt; &lt;/context-param&gt; &lt;context-param&gt; &lt;!-- Useful in development mode to slow down the uploads in fast networks. Put the number of milliseconds to sleep in each block received in the server. false or 0, means don't use slow uploads --&gt; &lt;param-name&gt;slowUploads&lt;/param-name&gt; &lt;param-value&gt;200&lt;/param-value&gt; &lt;/context-param&gt; &lt;servlet&gt; &lt;servlet-name&gt;uploadServlet&lt;/servlet-name&gt; &lt;!-- This is the default servlet, it puts files in session --&gt; &lt;servlet-class&gt;gwtupload.server.gae.AppEngineUploadAction&lt;/servlet-class&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;uploadServlet&lt;/servlet-name&gt; &lt;url-pattern&gt;*.gupld&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; </code></pre> <p>During upload the progress bar progresses some percentages and then shows the following error:</p> <p><img src="https://i.stack.imgur.com/CYGjy.png" alt="error message"></p> <p>But there are no more details in the logs. </p> <p>The error message shows the class <code>gwtupload.server.gae.MemCacheFileItemFactory$CacheableFileItem</code> with the method <code>setHeader()</code>. That's strange because I can't find the method in that class. What's happening here?</p> <p><strong>Edit:</strong> This is basically all the custom code i use. On the server side i use the build in <code>gwtupload.server.gae.AppEngineUploadAction</code> servlet.</p> <pre><code>package com.uploadtest.client; import gwtupload.client.IUploadStatus.Status; import gwtupload.client.IUploader; import gwtupload.client.IUploader.UploadedInfo; import gwtupload.client.MultiUploader; import gwtupload.client.PreloadedImage; import gwtupload.client.PreloadedImage.OnLoadPreloadedImageHandler; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.RootPanel; /** * Entry point classes define &lt;code&gt;onModuleLoad()&lt;/code&gt;. */ public class GWTUploadTest2 implements EntryPoint { // A panel where the thumbnails of uploaded images will be shown private FlowPanel panelImages = new FlowPanel(); public void onModuleLoad() { // Attach the image viewer to the document RootPanel.get("thumbnails").add(panelImages); // Create a new uploader panel and attach it to the document MultiUploader defaultUploader = new MultiUploader(); RootPanel.get("default").add(defaultUploader); // Add a finish handler which will load the image once the upload finishes defaultUploader.addOnFinishUploadHandler(onFinishUploaderHandler); } // Load the image in the document and in the case of success attach it to the viewer private IUploader.OnFinishUploaderHandler onFinishUploaderHandler = new IUploader.OnFinishUploaderHandler() { public void onFinish(IUploader uploader) { if (uploader.getStatus() == Status.SUCCESS) { new PreloadedImage(uploader.fileUrl(), showImage); // The server sends useful information to the client by default UploadedInfo info = uploader.getServerInfo(); System.out.println("File name " + info.name); System.out.println("File content-type " + info.ctype); System.out.println("File size " + info.size); // You can send any customized message and parse it System.out.println("Server message " + info.message); } } }; // Attach an image to the pictures viewer private OnLoadPreloadedImageHandler showImage = new OnLoadPreloadedImageHandler() { public void onLoad(PreloadedImage image) { image.setWidth("75px"); panelImages.add(image); } }; } </code></pre> <p>In addition to that i added the following jars to my clath path:</p> <ul> <li>log4j-1.2.17.jar </li> <li>gwtupload-gae-0.6.6.jar </li> <li>gwtupload-0.6.6.jar</li> <li>commons-fileupload-1.3.jar</li> <li>commons-io-2.4.jar</li> </ul> <p>Also zipped my whole sample project and uploaded it here:</p> <p><a href="https://skydrive.live.com/redir?resid=60B826E451F52B4D!118&amp;authkey=!ALa1n2mL2sRR0wU" rel="nofollow noreferrer">https://skydrive.live.com/redir?resid=60B826E451F52B4D!118&amp;authkey=!ALa1n2mL2sRR0wU</a></p> <p><strong>Edit 2:</strong></p> <p>Like Manolo pointed out: I was using "commons-fileupload-1.3.jar" instead of "commons-fileupload-1.2.1.jar". Changing the jar fixed my problem!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload