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.
NPE with JSON decoding on RPC-Call
Hi all,
I try to create an UI extension with a Server-RPC call. I hook my extension directly to the UI and the GWT-Logic works as expected.
I now want to tirgger an action on the server over an RPC call. For that I created an Interface that extends ServerRpc.
If I send the different values as own parameters in the rpc-method it works as expected but if I put all values in a DTO I an NPE from the JSON decoding. The encoded JSON-Value is always null.
I have the DTO in the same package as the Connector that extends AbstractExtensionConnector.
Do I need to register the DTO somewhere so that Vaadin can serialize it correctly or do I need to put it in a specific package? I thought having it in the same package as the client side stuff should be ok.
Also GWT should put it on the Whitelist, since the DTO is referenced in the RPC interface as a method parameter directly...
My DTO looks as foolowing
public class TransferData implements Serializable {
private double value1;
private double value2;
private Double value3;
public TransferData () {
}
public double getValue1() {
return this.value1;
}
public void setValue1(double value) {
this.value1= value;
}
public double getValue2() {
return this.value2;
}
public void setValue2(double value) {
this.value2= value;
}
public Double getValue3() {
return this.value3;
}
public void setValue3(Double value) {
this.value3= value;
}
}
error is:
java.lang.RuntimeException: java.lang.NullPointerException
at com.vaadin.server.JsonCodec.decodeObject(JsonCodec.java:627)
at com.vaadin.server.JsonCodec.decodeCustomType(JsonCodec.java:334)
at com.vaadin.server.JsonCodec.decodeInternalOrCustomType(JsonCodec.java:291)
at com.vaadin.server.communication.ServerRpcHandler.parseServerRpcInvocation(ServerRpcHandler.java:499)
at com.vaadin.server.communication.ServerRpcHandler.parseInvocation(ServerRpcHandler.java:433)
at com.vaadin.server.communication.ServerRpcHandler.parseInvocations(ServerRpcHandler.java:377)
at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:244)
at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:202)
at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:95)
at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1408)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:350)
at amos.web.system.servlet.WebServlet.service(WebServlet.java:106)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:738)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:551)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:544)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1111)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:478)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1045)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:199)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:309)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:462)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:279)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:232)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:534)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at com.vaadin.server.JsonCodec.decodeInternalType(JsonCodec.java:388)
at com.vaadin.server.JsonCodec.decodeInternalOrCustomType(JsonCodec.java:288)
at com.vaadin.server.JsonCodec.decodeObject(JsonCodec.java:619)
... 35 more