GWT error "no instantiable subtypes" with interface in RPC method with 1 known concrete class?

2,274 views
Skip to first unread message

Ed

unread,
Dec 17, 2014, 4:34:35 AM12/17/14
to google-we...@googlegroups.com
I have added the following async remote service method (using 2.7.0.):
TransportTokenResponse<ProductDto> findActiveDeclarationsOfActiveMember(TransportTokenRequest<Void> request);

TransportTokenResponse, just like TransportTokenRequest are interfaces with both an abstract subclass and one concrete class.
The GWT console shows the following error:
   ERROR] 'com.ited.lang.transporttoken.TransportTokenResponse' has no instantiable subtypes 

I am aware that using interfaces in RPC methods is tricky and can result in bloat code, but in this case, I only have one concrete class, so why does GWT complain and can't use the concrete class (it's in the same package as the interface) ?
I noticed this is a new 2.7.0. warning, maybe it has something to do with this


The details of TransportTokenResponse,:

public abstract class TransportTokenResponseBase<T> implements TransportTokenResponse<T> {
 
private static final long serialVersionUID = 1L;

 
protected TransportTokenResponseBase() {
 
}
}


public final class SimpleTransportTokenResponse<T> extends TransportTokenResponseBase<T> {
 
private static final long serialVersionUID = 1L;
   
SimpleTransportTokenResponse() {
 
}
}






Ed

unread,
Dec 18, 2014, 7:47:27 AM12/18/14
to google-we...@googlegroups.com
Sorry for being impatient ;)..
Anybody an idea ? (interface not allowed at all in RPC method calls? )

Jens

unread,
Dec 18, 2014, 8:09:16 AM12/18/14
to google-we...@googlegroups.com
Sorry for being impatient ;)..
Anybody an idea ? (interface not allowed at all in RPC method calls? )

No idea. Might be a bug... or intended ;-) Maybe GWT explicitly searches for a class that implements TransportTokenResponse<ProductDto> and does not care about your <T> implementation.

Does it work if you add

SimpleTransportTokenResponse<ProductDto> dummyMethod();

to your service?


-- J.

rhmoller

unread,
Dec 18, 2014, 9:58:59 AM12/18/14
to google-we...@googlegroups.com
Are the classes visible to GWT? I don't see .client. or .shared. in the package com.ited.lang.transporttoken.TransportTokenResponse so double check the source entries in your gwt.xml file

/Rene

rhmoller

unread,
Dec 18, 2014, 10:03:48 AM12/18/14
to google-we...@googlegroups.com
and check that the request and response interfaces are marked Serializable

/Rene

Ed Bras

unread,
Dec 18, 2014, 1:24:41 PM12/18/14
to google-we...@googlegroups.com
@Rhmoller: thanks. Yes they are marked as Serializable. And yes they are visible to gwt, when I create a instance in gwt code, it results in no error.​ I hardly ever use client, shared, server packages..

I get that impression that GWT does't allow interfaces (anymore) in RPC methods. This is the new 2.7.0 code that shows me the error: LINKE

@Jens: thanks. I am about to try that (using concrete classes), let me get back on that.

Jens

unread,
Dec 18, 2014, 1:49:28 PM12/18/14
to google-we...@googlegroups.com
I get that impression that GWT does't allow interfaces (anymore) in RPC methods. This is the new 2.7.0 code that shows me the error: LINKE

That patch just gives you a better error message. Before that you would get something like "Failed to resolve 'my.package.MyService' via deferred binding".
-- J.

Ian White

unread,
May 10, 2016, 8:59:37 AM5/10/16
to GWT Users
If you have a class that you are using to transport RPC params then it needs to implement IsSerializable, right.
So then if your IsSerializable class does not have a default empty constructor (i.e. no params) you will see this message.
Reply all
Reply to author
Forward
0 new messages