Upload Exception in Drag&Drop Upload

Hi there!

I’ve been struggling with a problem concerning the drag’n’drop file upload for 2 days now and I’m not getting any step further.

In my project I use the code of the drag’n’drop example in the Vaadin demo, which is working perfectly on my local system:

  • Windows Vista
  • Tomcat 6/7
  • Vaadin 6.7.4 used with Eclipse WTP Connector

Exporting the project as a .war file and deploying it on the Server works fine, except the part of uploading via drag’n’drop:

  • Windows Server 2008
  • Tomcat 6/7
  • deactivated Windows Firewall

In the Tomcat logs I get the following error:

22.02.2012 14:42:56 com.vaadin.Application terminalError
SCHWERWIEGEND: Terminal error:
com.vaadin.terminal.gwt.server.UploadException: Upload failed
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.streamToReceiver(AbstractCommunicationManager.java:626)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleXhrFilePost(AbstractCommunicationManager.java:523)
	at com.vaadin.terminal.gwt.server.CommunicationManager.handleFileUpload(CommunicationManager.java:265)
	at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:495)
	at org.vaadin.artur.icepush.ICEPushServlet.service(ICEPushServlet.java:72)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:383)
	at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:284)
	at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:322)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1684)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException
	at org.apache.coyote.http11.InternalAprInputBuffer.fill(InternalAprInputBuffer.java:593)
	at org.apache.coyote.http11.InternalAprInputBuffer$SocketInputBuffer.doRead(InternalAprInputBuffer.java:623)
	at org.apache.coyote.http11.filters.IdentityInputFilter.doRead(IdentityInputFilter.java:116)
	at org.apache.coyote.http11.InternalAprInputBuffer.doRead(InternalAprInputBuffer.java:526)
	at org.apache.coyote.Request.doRead(Request.java:422)
	at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:286)
	at org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java:407)
	at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:309)
	at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:166)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.streamToReceiver(AbstractCommunicationManager.java:581)
	... 19 more

I’d be very glad if someone could help me with the problem and show me the direction where I can possibly find the error.
Thanks in advance!

Greetings,
David

Hi David,

this post won’t be the solution to your problem as I am not familiar with the drag’n’drop example. But maybe it can point you in the right direction anyway.

I had a similar situation two days ago. The application worked on my development machine but did not on the server. Local machine and server had exactly the same setup. The error I got was:


com.vaadin.terminal.gwt.server.UploadException: Upload failed
        at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.streamToReceiver(AbstractCommunicationManager.java:626)
        at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleSimpleMultipartFileUpload(AbstractCommunicationManager.java:479)
        at com.vaadin.terminal.gwt.server.CommunicationManager.handleFileUpload(CommunicationManager.java:257)
        at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:495)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
        at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
        at java.lang.Thread.run(Thread.java:722)
Caused by: com.vaadin.terminal.gwt.server.NoOutputStreamException
        at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.streamToReceiver(AbstractCommunicationManager.java:571)
        ... 29 more

I turned everything upside down and was about to post it here when I saw that I was just blind.

The reason why vaadin threw an NoOutputStreamException was, in my case, that the server used a different path than the local machine did for writing the uploaded file. The path simply did not exist on the server. It had nothing to do with vaadin. So it turned out server and local machine were not so equal than I thought they were. :smiley:

Now your log lists an IOException. That might has nothing to do with vaadin as well. Check if the file you want to upload is ok. Check if you have permission to write to the path the upload component points to, etc.

Hope this helps.

Kurt

I’m having the same problem. Not sure what is going on but it calls this method :

   public void streamingFailed(
                                StreamingErrorEvent event) {
                            progress.setVisible(false);
                        }

Weird thing is I’m able to save the file that was dropped in a directory under the tomcat file system just fine, but still get this error.

I ran into the same problem. When trying to use the MyUploader example source file I got the exception Kurt posted before. Using the applications base directory solved the problem for me. Of course on might use any other valid directory as well.

File basepath = getApplication().getContext().getBaseDirectory();
        file = new File(basepath.getAbsolutePath() + filename);

Hello,

Somebody know if there is a way to get the path of the source file at client side, while Dragged and Dropped in vaadin 7 application ?

As far as I know, in general that is not possible - even the specification recommends that browsers should not make that information available to the server for security reasons.

Some versions of some browsers do send the upload path to the server, ignoring the recommendation, but that may change in future browser updates.