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.
BeanFieldGroup problem with nestedMethodProperty
I am trying to create a form using BeanFieldGroup, but every time I do I get this exception commit:
com.vaadin.data.util.MethodProperty$MethodException
at com.vaadin.data.util.NestedMethodProperty.invokeSetMethod(NestedMethodProperty.java:251)
at com.vaadin.data.util.NestedMethodProperty.setValue(NestedMethodProperty.java:231)
at com.vaadin.data.util.TransactionalPropertyWrapper.setValue(TransactionalPropertyWrapper.java:94)
at com.vaadin.ui.AbstractField.commit(AbstractField.java:253)
at com.vaadin.data.fieldgroup.FieldGroup.commitFields(FieldGroup.java:509)
at com.vaadin.data.fieldgroup.FieldGroup.commit(FieldGroup.java:481)
at com.leosoft.app.view.persona.PersonaViewImpl$6.buttonClick(PersonaViewImpl.java:411)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:508)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:198)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:161)
at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1003)
at com.vaadin.ui.Button.fireClick(Button.java:393)
at com.vaadin.ui.Button$1.click(Button.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:158)
at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:118)
at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:313)
at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:202)
at com.vaadin.server.communication.PushHandler$2.run(PushHandler.java:153)
at com.vaadin.server.communication.PushHandler.callWithUi(PushHandler.java:232)
at com.vaadin.server.communication.PushHandler.onMessage(PushHandler.java:492)
at com.vaadin.server.communication.PushAtmosphereHandler.onMessage(PushAtmosphereHandler.java:88)
at com.vaadin.server.communication.PushAtmosphereHandler.onRequest(PushAtmosphereHandler.java:78)
at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:199)
at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:107)
at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:66)
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:2075)
at org.atmosphere.websocket.DefaultWebSocketProcessor.dispatch(DefaultWebSocketProcessor.java:571)
at org.atmosphere.websocket.DefaultWebSocketProcessor$3.run(DefaultWebSocketProcessor.java:333)
at org.atmosphere.util.VoidExecutorService.execute(VoidExecutorService.java:101)
at org.atmosphere.websocket.DefaultWebSocketProcessor.dispatch(DefaultWebSocketProcessor.java:328)
at org.atmosphere.websocket.DefaultWebSocketProcessor.invokeWebSocketProtocol(DefaultWebSocketProcessor.java:425)
at org.atmosphere.container.JSR356Endpoint$1.onMessage(JSR356Endpoint.java:213)
at org.atmosphere.container.JSR356Endpoint$1.onMessage(JSR356Endpoint.java:210)
at org.apache.tomcat.websocket.WsFrameBase.sendMessageText(WsFrameBase.java:393)
at org.apache.tomcat.websocket.WsFrameBase.processDataText(WsFrameBase.java:494)
at org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:289)
at org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:130)
at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:60)
at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler$WsReadListener.onDataAvailable(WsHttpUpgradeHandler.java:203)
at org.apache.coyote.http11.upgrade.AbstractServletInputStream.onDataAvailable(AbstractServletInputStream.java:198)
at org.apache.coyote.http11.upgrade.AbstractProcessor.upgradeDispatch(AbstractProcessor.java:96)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:663)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1517)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1474)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source) Caused by: java.lang.NullPointerException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.vaadin.data.util.NestedMethodProperty.invokeSetMethod(NestedMethodProperty.java:247) ... 56 more
This is part of the code of the form and do not see why this exception:
Label section = new Label(Constante.getString(Titulos.DIRECCION));
section.addStyleName(ValoTheme.LABEL_H3);
section.addStyleName(ValoTheme.LABEL_COLORED);
section.addStyleName(ValoTheme.LABEL_NO_MARGIN);
form.addComponent(section);
/* Direccion */
direccionArea = new TextArea(Constante.getString(Campos.DIRECCION));
direccionArea.setImmediate(true);
direccionArea.setWidth("100%");
direccionArea.setRows(4);
direccionArea.setNullRepresentation("");
direccionArea.addValueChangeListener(valueChangeListener);
form.addComponent(direccionArea);
editFGroup.bind(direccionArea, "direccion.direccion");
/* PAIS */
paisBox = new ComboBox();
paisBox.setCaption(Constante.getString(Campos.PAIS));
paisBox.setTextInputAllowed(true);
paisBox.setFilteringMode(FilteringMode.CONTAINS);
paisBox.setWidth("100%");
paisBox.setNullSelectionAllowed(false);
paisBox.addValueChangeListener(valueChangeListener);
paisBox.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
if (paisBox.getValue() != null) {
departamentoBox.setValue(null);
getPresenter().filtrarDepartamento((Long) paisBox.getValue());
}
}
});
form.addComponent(paisBox);
editFGroup.bind(paisBox, "direccion.ciudad.departamento.pais");
/* DEPARTAMENTO */
departamentoBox = new ComboBox();
departamentoBox.setCaption(Constante
.getString(Campos.DEPARTAMENTO));
departamentoBox.setTextInputAllowed(true);
departamentoBox.setFilteringMode(FilteringMode.CONTAINS);
departamentoBox.setWidth("100%");
departamentoBox.addValueChangeListener(valueChangeListener);
departamentoBox.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
if (departamentoBox.getValue() != null) {
ciudadBox.setValue(null);
getPresenter().filtrarCiudad((Long) departamentoBox.getValue());
}
}
});
form.addComponent(departamentoBox);
departamentoBox.setNullSelectionAllowed(false);
editFGroup.bind(departamentoBox, "direccion.ciudad.departamento");
/* DEPARTAMENTO */
ciudadBox = new ComboBox();
ciudadBox.setCaption(Constante.getString(Campos.CIUDAD));
ciudadBox.setTextInputAllowed(true);
ciudadBox.setFilteringMode(FilteringMode.CONTAINS);
ciudadBox.setWidth("100%");
ciudadBox.addValueChangeListener(valueChangeListener);
form.addComponent(ciudadBox);
ciudadBox.setNullSelectionAllowed(false);
editFGroup.bind(ciudadBox, "direccion.ciudad");
and this is the kind person and address:
public class Persona implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
@Size(max=100, min=0)
@NotEmpty
@Pattern(regexp = "[a-zA-ZñÑ\\s]*", message = "En el campo se debe usar solo "
+ "letras (a-z), no puede contener tildes, caracteres especiales y números.")
private String apellidos;
@NotEmpty
@Size(max=30, min=0)
@Pattern(regexp = "[a-zA-ZñÑ0-9\\s]*", message = "En el campo se debe usar solo "
+ "letras (a-z), no puede contener tildes, caracteres especiales.")
private String identificacion;
private String movil;
@Size(max=100, min=0)
@Pattern(regexp = "[a-zA-ZñÑ\\s]*", message = "En el campo se debe usar solo "
+ "letras (a-z), no puede contener tildes, caracteres especiales y números.")
private String nombres;
@Size(max=30, min=0)
@Pattern(regexp = "[0-9]*", message = "En el campo se debe usar solo "
+ "número (0-9), no puede contener tildes, caracteres especiales y letras.")
private String telefono;
@NotNull
private Direccion direccion;
@NotNull
private TipoDocumento tipoDocumento;
private Set<TipoPersona> tipoPersonas;
private Set<Suscripcion> suscripcionAsesor;
private Set<Suscripcion> suscripciones;
@Size(max=100, min=0)
private String eMail;
public Persona() {
}
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getApellidos() {
return (this.apellidos != null ? this.apellidos.trim().toUpperCase() : this.apellidos);
}
public void setApellidos(String apellidos) {
this.apellidos = (apellidos != null ? apellidos.trim().toUpperCase() : apellidos);
}
public String getIdentificacion() {
return (this.identificacion != null ? this.identificacion.trim().toUpperCase() : this.identificacion);
}
public void setIdentificacion(String identificacion) {
this.identificacion = (identificacion != null ? identificacion.trim().toUpperCase() : identificacion);
}
public String getMovil() {
return (this.movil != null ? this.movil.trim().toUpperCase() : this.movil);
}
public void setMovil(String movil) {
this.movil = (movil != null ? movil.trim().toUpperCase() : movil);
}
public String getNombres() {
return (this.nombres != null ? this.nombres.trim().toUpperCase() : this.nombres);
}
public void setNombres(String nombres) {
this.nombres = (nombres != null ? nombres.trim().toUpperCase() : nombres);
}
public String getTelefono() {
return (this.telefono != null ? this.telefono.trim().toUpperCase() : this.telefono);
}
public void setTelefono(String telefono) {
this.telefono = (telefono != null ? telefono.trim().toUpperCase() : telefono);
}
public Direccion getDireccion() {
return this.direccion;
}
public void setDireccion(Direccion direccion) {
this.direccion = direccion;
}
public TipoDocumento getTipoDocumento() {
return this.tipoDocumento;
}
public void setTipoDocumento(TipoDocumento tipoDocumento) {
this.tipoDocumento = tipoDocumento;
}
public Set<TipoPersona> getTipoPersonas() {
return this.tipoPersonas;
}
public void setTipoPersonas(Set<TipoPersona> tipoPersonas) {
this.tipoPersonas = tipoPersonas;
}
public Set<Suscripcion> getSuscripcionAsesor() {
return suscripcionAsesor;
}
public void setSuscripcionAsesor(Set<Suscripcion> suscripcionAsesor) {
this.suscripcionAsesor = suscripcionAsesor;
}
public Set<Suscripcion> getSuscripciones() {
return suscripciones;
}
public void setSuscripciones(Set<Suscripcion> suscripciones) {
this.suscripciones = suscripciones;
}
public String geteMail() {
return (eMail != null ? eMail.trim() : eMail);
}
public void seteMail(String eMail) {
this.eMail = (eMail != null ? eMail.trim() : eMail);
}
public String getTipoPersonaString(){ // Esto debe devoverme un listado de tipo de persona que pertenece...
return getTipoPersonas().toString();
}
}
public class Direccion implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
@NotNull
private Ciudad ciudad;
@Size(max=100, min=0)
@NotEmpty
private String direccion;
public Direccion() {
}
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public Ciudad getCiudad() {
return this.ciudad;
}
public void setCiudad(Ciudad ciudad) {
this.ciudad = ciudad;
}
public String getDireccion() {
return this.direccion;
}
public void setDireccion(String direccion) {
this.direccion = direccion;
}
}
not because I get this exception, hope someone I know and work with this. grace.
Maybe geteMail() and seteMail() methods names need to change to getEMail() and setEMail() ?
Yes. I had already noticed but the problem is not in this field. the problem is in the address field as not recognizing me this editFGroup.bind(direccionArea, "direccion.direccion");. field nested in class. and do not know why that happens is supposed to detect without problem.