Upload not working

I am using Vaadin 10 and have this minimal example:

@Route(value = "upl")
@Slf4j
public class UploadTestView extends HorizontalLayout {
    public UploadTestView() {
        MemoryBuffer buffer = new MemoryBuffer();
        Upload upload = new Upload(buffer);

        upload.addSucceededListener(event -> {
            log.info("Received "+event.getFileName()+" of size "+event.getContentLength());
        });
        add(upload);
    }
}

I see the upload component under the route, and using the Developer Tools of chrome I can see that the file was sent to the backend.
However, the SuccessListener is not called (nor are other Listeners called, I tried them.

The example is kind of 1:1 ( i think) from [here]
(https://vaadin.com/components/vaadin-upload/java-examples)

What am I doing wrong?

The example works correctly. I think you did not configure the logger correctly.

<dependency>
	<groupId>org.slf4j</groupId>
	<artifactId>slf4j-simple</artifactId>
</dependency>

LoggerFactory.getLogger(getClass())

I am using Lombok, the logger is working fine.

And it doesnt hold at breakpoints too :frowning:

All work fine
Vaadin Upload Demo + Lombok

Lombok is no issue here… I wonder why the listeners are never called.
After implementing a subclass of GeneratedVaadinIcon it is working.

Maybe it is somehow related to the AppLayout. Dunno

Hi. Daniel, if you can provide more details on the setup, or even a minimal app that reproduces the issue, you can open an issue for https://github.com/vaadin/vaadin-upload-flow/issues so we can take a look at it and fix it if there is a bug.

My setup is spring boot 2 with vaadin 10 and the App Layout from [here]
(https://github.com/appreciated/vaadin-app-layout).

I will try to create a minimal example showing the problem if I find the time.

What I did to get further was creating a RestController to accept files and use it as target in the GeneratedVaadinUpload.

I face the same problem here, it’s a spring boot 2 app with AppLayout and my succeededListenr is never called. Did you find a solution to this one?

Thomas Kratz:
I face the same problem here, it’s a spring boot 2 app with AppLayout and my succeededListenr is never called. Did you find a solution to this one?

Add this to applications.properties:

spring.servlet.multipart.enabled=false

Joe, thanks - i think i will try that.

What I did was using a spring controller to accept files and implemented a subclass of GeneratedVaadinUpload to use that endpoint.

spring.servlet.multipart.enabled=false did the trick.

Thank you for asking this question. I run into the same problem but because of you I found the solution within minutes.
I have to say I really like Vaadin very much, but these are things that I can not understand. That should be in the documentary and be mentioned in examples. Otherwise you will search forever and find no solution, assuming using SpringBoot isn’t that occasional.

I had an UrlPattern in my WebServlet-Annotation with “/VAADIN/*” that prevented me from uploading files.
I got a HTTP-Error 404 in Chrome Console.