Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
ReadOnlyException when setValue on a customField
Hello,
I am stucked wtih a problem for 2 days. I have a custom component which extends CustomField class. this component opens a modal panel to select a value, then i call component's setValue to store selection. Here i get the exception below:
Caused by: com.vaadin.data.Property$ReadOnlyException: null
at com.vaadin.data.util.MethodProperty.setValue(MethodProperty.java:663) ~[vaadin-6.7.3.jar:6.7.3]
at company.project.ui.Chooser$1.valueBind(Chooser.java:23) ~[Chooser$1.class:na]
at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_21]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_21]
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:512) ~[vaadin-6.7.3.jar:6.7.3]
... 70 common frames omitted
i tried to manually setReadOnly to false, but not helped.
Any advice?
Thanks
@Override
public void setValue(Object newValue) throws ReadOnlyException, ConversionException {
avoidReadOnlyException();
super.setValue(newValue);
}
private void avoidReadOnlyException() {
super.setReadOnly(false);
Property propertyDataSource = getPropertyDataSource();
if(propertyDataSource!=null)
{
propertyDataSource.setReadOnly(false);
}
}
The MethodProperty indicates that you have probably bound the component to a BeanItem or something like that. The typical case for this error is that you are missing a setter from the bean, so the MethodProperty wrapper can't write values to it.