The domain type com.dummyPackage.thriftgen.ClassOtherDTO cannot be sent to the client

326 views
Skip to first unread message

Victor Lujan

unread,
Feb 13, 2012, 6:06:26 PM2/13/12
to Google Web Toolkit
Feb 13, 2012 3:57:14 PM
com.google.web.bindery.requestfactory.server.ServiceLayerDecorator die
SEVERE: The domain type com.dummyPackage.thriftgen.ClassOtherDTO
cannot be sent to the client


Hi everyone,

I have 3 DTOs and 3 proxies, ClassOtherDTO, ClassSomethingDTO and
ClassAnotherDTO, each has it's own locator.

I have something like
classSomethingRequest.getSomething(100).with(getProperties()).fire(new
Receiver<List<ClassSomethingProxy>>() {
@Override
public void onSuccess(List<ClassSomethingProxy>
classSomethingList) {
(...)
}

where getProperties is a String[] {"property1", "property2"}


ClassSomethingProxy extends EntityProxy {
ClassAnotherProxy getProperty1();
List<ClassOtherProxy> getProperty2();
(...)
}



The requests brings me the information of ClassSomething and
ClassAnother but dies when I request information of ClassOther. With
the following message:
The domain type com.dummyPackage.thriftgen.ClassOtherDTO cannot be
sent to the client



I noticed that in class Builder , there is the following line:
Builder builder = builderClass.newInstance();


Somewhere in the process the following class is automatically
generated:



// Automatically Generated -- DO NOT EDIT
// com.dummyPackage.gwt.shared.ClientRequestFactory
package com.dummyPackage.gwt.shared;
import java.util.Arrays;
import com.google.web.bindery.requestfactory.vm.impl.OperationData;
import com.google.web.bindery.requestfactory.vm.impl.OperationKey;
public final class ClientRequestFactoryDeobfuscatorBuilder extends
com.google.web.bindery.requestfactory.vm.impl.Deobfuscator.Builder {
{
withOperation(new OperationKey("dw_W77IdEET0DW0FaU5srH7Tp8s="),
new OperationData.Builder()
.withClientMethodDescriptor("(Ljava/lang/String;)Lcom/google/web/
bindery/requestfactory/shared/Request;")
.withDomainMethodDescriptor("(Ljava/lang/String;)Lcom/dummyPackage/
thriftgen/ClassSomethingDTO;")
.withMethodName("findSomething")
.withRequestContext("com.dummyPackage.gwt.shared.ClientRequestFactory
$ClassSomethingRequest")
.build());
withOperation(new OperationKey("zc3JZ1NYIC1KtsEQ2bX8VtGyAag="),
new OperationData.Builder()
.withClientMethodDescriptor("(I)Lcom/google/web/bindery/
requestfactory/shared/Request;")
.withDomainMethodDescriptor("(I)Ljava/util/List;")
.withMethodName("getSomething")
.withRequestContext("com.dummyPackage.gwt.shared.ClientRequestFactory
$ClassSomethingRequest")
.build());
withRawTypeToken("w1Qg$YHpDaNcHrR5HZ$23y518nA=",
"com.google.web.bindery.requestfactory.shared.EntityProxy");
withRawTypeToken("FXHD5YU0TiUl3uBaepdkYaowx9k=",
"com.google.web.bindery.requestfactory.shared.BaseProxy");
withRawTypeToken("2V15tuS$Yny$aeAf45pmDIE2bFk=",
"com.dummyPackage.gwt.shared.ClassAnotherProxy");
withRawTypeToken("4EHxlUwpVRbxMNh_BZBl5aVN0uY=",
"com.dummyPackage.gwt.shared.ClassSomethingProxy");
withClientToDomainMappings("com.dummyPackage.thriftgen.ClassAnotherDTO",
Arrays.asList("com.dummyPackage.gwt.shared.ClassAnotherProxy"));
withClientToDomainMappings("com.theworkingcrowd.thriftgen.ClassSomethingDTO",
Arrays.asList("com.dummyPackage.gwt.shared.ClassSomethingProxy"));
}}



And there is nothing about ClassOtherDTO or ClassOtherProxy. How can
I see what's going on?

If I dont request for property2 everything goes right (ClassAnother
and ClassSomething work alright) but when i include property2 in the
request it tells me that it cannot be sent to the client.

All ClassAnother, ClassSomething and ClassOther (the problematic)
were automatically generated by thrift and if you see the code they
are very similar.
Could it be that the problem exist in that getProperty2 expects a list
of DTOs and not just one?

Thank you

Victor Lujan

unread,
Feb 13, 2012, 6:15:37 PM2/13/12
to google-we...@googlegroups.com
ps.  I have been debugging this for a day and i have ran out of ideas. this is that stack trace


SEVERE: The domain type com.dummyPackage.thriftgen.ClassOtherDTO cannot be sent to the client
Feb 13, 2012 3:57:14 PM com.google.web.bindery.requestfactory.server.RequestFactoryServlet doPost
SEVERE: Unexpected error
com.google.web.bindery.requestfactory.server.UnexpectedException: The domain type com.dummyPackage.thriftgen.ClassOtherDTO cannot be sent to the client
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.die(ServiceLayerDecorator.java:216)
at com.google.web.bindery.requestfactory.server.ResolverServiceLayer.resolveClientType(ResolverServiceLayer.java:91)
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveClientType(ServiceLayerDecorator.java:142)
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveClientType(ServiceLayerDecorator.java:142)
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.resolveClientType(ServiceLayerDecorator.java:142)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.google.web.bindery.requestfactory.server.ServiceLayerCache.getOrCache(ServiceLayerCache.java:233)
at com.google.web.bindery.requestfactory.server.ServiceLayerCache.resolveClientType(ServiceLayerCache.java:163)
at com.google.web.bindery.requestfactory.server.Resolver.resolveClientValue(Resolver.java:586)
at com.google.web.bindery.requestfactory.server.Resolver.resolveClientValue(Resolver.java:618)
at com.google.web.bindery.requestfactory.server.Resolver.access$400(Resolver.java:50)
at com.google.web.bindery.requestfactory.server.Resolver$PropertyResolver.visitReferenceProperty(Resolver.java:139)
at com.google.web.bindery.autobean.shared.AutoBeanVisitor.visitCollectionProperty(AutoBeanVisitor.java:229)
at com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.traverseProperties(ProxyAutoBean.java:300)
at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.traverse(AbstractAutoBean.java:166)
at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.accept(AbstractAutoBean.java:101)
at com.google.web.bindery.requestfactory.server.Resolver.resolveClientValue(Resolver.java:395)


Victor Lujan

unread,
Feb 13, 2012, 6:24:55 PM2/13/12
to google-we...@googlegroups.com
Forgot to say that class Builder is not a class I made, its:
com.google.web.bindery.requestfactory.vm.impl.Deobfuscator.Builder

Here is the code.  This is where I get the first symptom  that something odd happened , given that in that new Instance() is where I think the automatically generated code (the one of my first post) gets created (I could be wrong here though)  and  it doesnt include anything about ClassOtherDTO or ClassOtherProxy  : (

public class Deobfuscator {

   
//...

   
public static class Builder {
       
public static Builder load(Class<?> clazz, ClassLoader resolveClassesWith) {
           
Throwable ex;
           
try {
               
Class<?> found;
               
try {
                   
// Used by the server
                    found
= Class.forName(clazz.getName() + GENERATED_SUFFIX, false, resolveClassesWith);
               
} catch (ClassNotFoundException ignored) {
                   
// Used by JRE-only clients
                    found
= Class.forName(clazz.getName() + GENERATED_SUFFIX_LITE, false, resolveClassesWith);
               
}
               
Class<? extends Builder> builderClass = found.asSubclass(Builder.class);
               
Builder builder = builderClass.newInstance();
               
return builder;
           
} catch (ClassNotFoundException e) {
               
throw new RuntimeException("The RequestFactory ValidationTool must be run for the "
                   
+ clazz.getCanonicalName() + " RequestFactory type");
           
} catch (InstantiationException e) {
            ex
= e;
       
} catch (IllegalAccessException e) {
            ex
= e;
       
}
       
throw new RuntimeException(ex);
   
}

Victor Lujan

unread,
Feb 13, 2012, 8:43:19 PM2/13/12
to google-we...@googlegroups.com
Actually,  instead of 

ClassSomethingProxy extends EntityProxy { 
   ClassAnotherProxy getProperty1(); 
   List<ClassOtherProxy> getProperty2(); 
(...) 


I changed it to


ClassSomethingProxy extends EntityProxy { 
   ClassAnotherProxy getProperty1(); 
   ClassOtherProxy getProperty2(); 
(...) 


ps. i changed the definition of the thrift file  to not have a list of ClassOtherDTOs and also changed the proxy  , locator, etc.

And it all works just fine !   

What's the deal with using a proxy with a list of proxies?  is this a well known problem? do you need me to give you more info? do you want me to dig deeper?
it would help me A LOT if there is a work around for this problem.


Thanks.

Vasi Sándor

unread,
Feb 14, 2012, 1:24:11 AM2/14/12
to google-we...@googlegroups.com
I dont know the reason, but if i remember well, i got similar error, when i have changed the server side code and did not launch mvn clean install after. It made the development process really slow, but it forced me to write server side unit tests.

Sandor
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/RFTh7TGYD_QJ.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Thomas Broyer

unread,
Feb 14, 2012, 5:22:25 AM2/14/12
to google-we...@googlegroups.com
Have a look at http://code.google.com/p/google-web-toolkit/wiki/RequestFactoryInterfaceValidation

If ClassOtherDTO isn't included, it's probably that it has an issue, i.e. there's a mismatch between ClassOtherProxy and ClassOtherDTO.

Victor Lujan

unread,
Feb 14, 2012, 2:01:10 PM2/14/12
to google-we...@googlegroups.com
Wow,  actually you were right SaWo!  I did nothing new except using maven clean and maven install  and now it works!  


Thank you so much : )


Thank you too Thomas,   I have read some of your articles and they rock.  This time the problem was with my use of maven, you couldn't have know about that : ) thank you anyway.
Reply all
Reply to author
Forward
0 new messages