Drag and Drop Error

I downloaded DragAndDropExtensions from this link: https://vaadin.com/directory/component/html5-drag-and-drop-extension

All works fine but tomcat gives this error: java.io.NotSerializableException: org.vaadin.stefan.dnd.drop.DropTargetExtension

And it worries me. How to fix it, will it make problems in my project, did anyone come across this?

Hi.

I suspect you obtain this error most probably whenever an “Application reload” is triggered in Tomcat (e.g. by modifying resources etc). This is because, by default, Tomcat tries to serialize/deserialize your current active session whenever such events occur (clean stop/start, application reload).

The requirement for this to happen is that all session attributes have to Serializable (implement java.io.Serializable interface).

So, I suspect that this Component that you are using, does not fulfill this condition.
I guess, you can either talk with the Author to update the component or you can even propose a Fix if you have time.

Silvan Eugen Lincan:
Hi.

I suspect you obtain this error most probably whenever an “Application reload” is triggered in Tomcat (e.g. by modifying resources etc). This is because, by default, Tomcat tries to serialize/deserialize your current active session whenever such events occur (clean stop/start, application reload).

The requirement for this to happen is that all session attributes have to Serializable (implement java.io.Serializable interface).

So, I suspect that this Component that you are using, does not fulfill this condition.
I guess, you can either talk with the Author to update the component or you can even propose a Fix if you have time.

Thanks for reply. I wrote to author and still in waiting)

Yes, everytime when i restart tomcat this error appears.

I also wanted to know can it harm my app? I don’t use that Seriaziable anywhere in my code.

Thanks!

I would say that this is a must for a WebApp, especially if you want to scale it out in a clustered environment where the session has to be serializable otherwise it cannot be replicated.

What can happen is that the users of the application will loose the data that they entered in the UI and they will have to start again, if something happens and the session cannot be serialized.

So, it is a Best Practice that what you put on the session should be serializable.

Hope this helps.

Silvan Eugen Lincan:
I would say that this is a must for a WebApp, especially if you want to scale it out in a clustered environment where the session has to be serializable otherwise it cannot be replicated.

What can happen is that the users of the application will loose the data that they entered in the UI and they will have to start again, if something happens and the session cannot be serialized.

So, it is a Best Practice that what you put on the session should be serializable.

Hope this helps.

I understand you.

What surprises me that i never use Serializable in my classes and in this project either, but get this error.

Thanks for reply Silvan.

You’re welcome.

Yes, and you don’t need to, only for those objects that you put on the session.
And, this is exactly why you obtain that error, because that Component is not serializable.
And this is because in Vaadin, the Components are attached to an UI and the UI is attached to a VaadinSession, thus, all the Components have to be serializable.

If you look at the official Vaadin Components, they are all serializable.

Thank you so much, that you spent your time for me!

I understand the problem and hope the author will fix it.

If i can get the solution i’ll definitely share with it here.

Welcome and thank you also.