setValue/select ComboBox get NullPointerException

Hi guys,

Im trying to programmatically select/setValue in a comboBox, but I have always the same:

java.lang.NullPointerException
at com.vaadin.ui.AbstractSingleSelect.setSelectedFromClient(AbstractSingleSelect.java:230)
at com.vaadin.ui.AbstractSingleSelect$1.select(AbstractSingleSelect.java:382)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:155)
at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:116)
at com.vaadin.server.communication.ServerRpcHandler.handleInvocation(ServerRpcHandler.java:445)
at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:410)
at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:274)
...

Maybe Im doing something wrong, but when I add some items to the combobox and I want to set on as selected, than come this fail. Also when I added all of them, knowing that they are all inside with getDataProvider().getItems(), I make click on one of them, and come the same fail. So what am I doing wrong with this easy task?

Im just having some values from DB and only setting them with setItems(values). When I run the programm, I can see them in the combobox.

Thx.

Thx for the answer. I have equals() implementation, but the problems was the converter. For vaadin 7 I had a converter that works fine, but with vaadin 8 I have made some changes but the fail was there.

Due to your answer I arrived at the fail, so thx again.

Are you implementing hashCode() and equals() in your Bean class?

Good to hear you figured it out :slight_smile:

-Olli