PDA

View Full Version : [GXT 2.0.1] BaseTreeModel + BeanModel + hosted noServer -> inconsistent .gwt.rpc file



mike07
24 Jul 2009, 6:13 AM
The problem only appear in hosted mode with the option noserver
When i try to call a service with a BaseTreeModel parameter i encounter a serialization error (file A1122A2...556.gwt.rpc not found in server)
I have discovered that during the compilation and in hosted mode the same service produces 2 differents gwt.rpc files.
I found that:
-BeanModel extends ModelData
-BaseTreeModel reference a ModelData (variable children)
-unfortunatly, all BeanModel_..... generated class extend BeanModel
During a gwt compilation BeanModel_... are processes as a Serializable types and it works in ie/mozilla... (file .gwt.rpc contains line like com.xxx.zzz.eee.BeanModel_..., true)
In hosted mode generator are not called, so BeanModel_... are not generated.
In consequence, .gwt.rpc file in Hosted side can't contains BeanModel_... class.
That explains the error (the content of 2 different .gwt.rpc generate 2 different filename).
The server search on server side a file with the name generated in hosted browser.
Is it a known issue? (that works in previous version (1.2))

mike07
26 Jul 2009, 11:27 PM
Hi,
I post this in the bug section. Somebody move the thread in the Help section without any explanation. I don't understand why it's not a bug?
It works in gxt 1.2 and not in gxt 2.0
Is it a known issue (Bean model must not be use if we want to use hosted mode with option noServer)?
Thanks for your answer/Help.

sven
27 Jul 2009, 1:35 AM
GXT is not generating the files. This is GWT. When updating to GXT2 you also updated to GWT 1.6 and use the new hostedmode etc.

mike07
27 Jul 2009, 5:02 AM
Thank you for your answer.
I agree with you but if BeanModel can't be use in with GWT 1.6 in Hosted mode (with option noserver), i think that BeanModel must be deprecated or at least a "warning" must be added (in documentation or something else).
Moreover, i think that this problem can be solved by GXT Team because the problem is clear.
BeanModel_xxxx must never be taken into account in .gwt.rpc files.
If i declare a class AAA, a class BeanModel_AAA is generated but i want to send to the server a instance of AAA not Bean_AAA.

I think that BeanModel_XXX mustn't extends BeanModel, that's the source of the problem.
I'll try to use annotation for solve the problem but please add an advertisment in your documentation because many persons will lose time with this problem (I lose 3 Hours with this problem).

sven
27 Jul 2009, 5:12 AM
I just tested this without problems.


If i declare a class AAA, a class BeanModel_AAA is generated but i want to send to the server a instance of AAA not Bean_AAA.

That should not make any difference in which *.gwt.rpc file is used. The filename that should be used is send over with the request.


I think that BeanModel_XXX mustn't extends BeanModel, that's the source of the problem.
It has to extend it.


i think that BeanModel must be deprecated
Why should we deprecate something if it is heavily used without problems and without any replacement?


I guess that there is something more wrong on your side. Have you also updated the GWT libs on your serverside?

mike07
27 Jul 2009, 9:15 AM
That should not make any difference in which *.gwt.rpc file is used. The filename that should be used is send over with the request.


That's the problem! the name send in the http request doesn't exist in server side (the name is a hash of the content and content are differents (server side contents BeanModel_XXX not client side))

FYI: i found a solution for generate BeanModel_XXX in Hosted mode but i discover that in server side some .gwt.rpc doesn't content BeanModel_XXX , thats strange for me (i suppose that generators are run in parallel during a real compilation (not in hosted mode), i'll check this).
If generator are launched in parallel, it's a big issue... (it's impossible to know if a gwt.rpc file will contain or not BeanModel_XXX)
I continue my investigation.

2 days of work on this problem... I'm a little bit disappointed :-(



I guess that there is something more wrong on your side. Have you also updated the GWT libs on your serverside?
i think that All is updated because all work fine if i copy Hosted gwt.rpc file on my war.
and in standalone browser (ie/mozilla) all rpc call are OK

It's really a problem between gxt end gwt

Thanks for your help

sven
27 Jul 2009, 9:18 AM
Well this is more another problem. The war content has to be on your server. The actual war content. Not the one from a view hours ago. So the server has to directly stream the content of the war folder the hostedmode consoel generates the rpc file in

mike07
27 Jul 2009, 9:30 AM
Well this is more another problem. The war content has to be on your server. The actual war content. Not the one from a view hours ago. So the server has to directly stream the content of the war folder the hostedmode consoel generates the rpc file in
I will try to do this tomorrow. i think that it's more a workaround than a real clean solution but it's a good idea.

The fact that BeanModel_XXX are not always present in all .gwt.rpc files who contains BeanModel (The base class) is very strange because the concequences is that in some services you can serialize them and in other you cant', it's the lottery.

sven
27 Jul 2009, 9:34 AM
This is not a workaround. This is the normal behaviour of the hostedmode. The server needs access to the latest versions of the rpc file. Not an old one.

mike07
27 Jul 2009, 11:18 PM
This is not a workaround. This is the normal behaviour of the hostedmode. The server needs access to the latest versions of the rpc file. Not an old one.
Yes but if i compile and deploy a war, and if (with no change in source code) i launch hosted i must see same gwt.rpc file and that's not the case (since gwt 1.7/GXT 2, before it was ok).
Do you think that BeanModel_XXX must be in gwt.rpc file or not (when a BeanModel or a Model data is referenced by an rpc parameter)?

sven
28 Jul 2009, 12:05 AM
Yes they have to and that is also not the problem. The problem is that the hostedmode generates rpc files on the fly and they need to be accessed from your server. This is also documented in the gwt docs.

mike07
28 Jul 2009, 12:27 AM
Yes they have to and that is also not the problem. The problem is that the hostedmode generates rpc files on the fly and they need to be accessed from your server. This is also documented in the gwt docs.
ok, but the problem exist in my war, i have gwt.rpc files without BeanModel_XXX (in service which contains BeanModel/ModelData parameter)
As said before i have found how to force BeanModel_XXX generation in hosted mode, my problem is the "random" generation of BeanModel_XXX (some gwt.rpc files doesn't contain them) during a normal compilation (perhaps due to parallel runs of generator)

I think that this generator
(i think that this generator generates gwt.rpc files)


<generate-with class="com.google.gwt.user.rebind.rpc.ServiceInterfaceProxyGenerator">
<when-type-assignable class="com.google.gwt.user.client.rpc.RemoteService"/>
</generate-with>

must be run after your generator:


<generate-with class="com.extjs.gxt.ui.rebind.core.BeanModelGenerator">
<when-type-assignable class="com.extjs.gxt.ui.client.data.BeanModelLookup"/>
</generate-with>

during a normal compilation (i think that today they are run simultaneously)

sven
28 Jul 2009, 12:53 AM
In hostedmode generators run when needed. You cant control the order. You need to have the rpc file in sync.

mike07
28 Jul 2009, 1:20 AM
In hostedmode generators run when needed. You cant control the order. You need to have the rpc file in sync.
In hosted mode it's easy to generate BeanModel_XXX before gwt.rpc, the problem is during a real compilation.

My previous message is about my war (using real compilation).
Are you agree with the fact that in my war all gwt.rpc wich reference BeanModel must contain BeanModel_XXX (because of inheritance)?

sven
28 Jul 2009, 1:21 AM
Yes, during real compilation it generates all of them. But why are you using hostedmode than?

mike07
28 Jul 2009, 1:28 AM
Yes, during real compilation it generates all of them. But why are you using hostedmode than?
I use hosted mode for debugging (i call EJB from my rpc service in a jboss server, that's why i use hosted with noserver)

My problem is that during a real compilation it doesn't generate all BeanModel_XXX.
2 first compiled services doesn't contain BeanModel_XXX, next 3 contains them (probably because of parallel execution of BeanModelGenerator and ServiceInterfaceProxyGenerator).

sven
28 Jul 2009, 1:32 AM
The problem only appear in hosted mode with the option noserver

That you stated as first sentence. Now you talk about real compilition which has nothing todo with hostedmode. So where is the real problem now?

mike07
28 Jul 2009, 1:50 AM
The problem only appear in hosted mode with the option noserver

That you stated as first sentence. Now you talk about real compilition which has nothing todo with hostedmode. So where is the real problem now?

Real compilation and Hosted mode "work" together because i use noserver option in the hostedMode.

Consequences of the bug appears only in hosted mode with the option noserver (because i never try to serialize/deserialize (BeanModel_XXX) in real browser)

BUT the source of the problem is in the war with a real compilation (all my gwt.rpc file doesn't contain BeanModel_XXX (some yes some no))
When i talk about war it's always a real compilation (not the war directory of HostedMode)

About your workaround, i think it's difficult to reference directory of gwt.rpc files generated by hosted mode because each time you run a new HostedMode a new directory is created.

sven
28 Jul 2009, 1:54 AM
There is no bug. Please refer to the GWT documentation. The real server has to contain always the newest rpc file.


BUT the source of the problem is in the war with a real compilation (all my gwt.rpc file doesn't contain BeanModel_XXX (some yes some no))

I dont have this issue nor has anybody else this. If this would be the case no app would work.


I really suggest that you post your code in the forums, than somebody might can help you.

mike07
28 Jul 2009, 2:08 AM
I dont have this issue nor has anybody else this. If this would be the case no app would work.

the problem appear only in hosted mode with option noserver.
i think that perhaps 1% of person use it.
It's a new problem with gwt 1.6/gxt2
how many person use gxt2 and hosted mode with noserver?

i ll try to reproduce the problem in a simple project as soon as possible.

sven
28 Jul 2009, 2:12 AM
Compiling has nothing todo with hostedmode. If the classes are missing after compiling than something is wrong in on your side. However hostedmode is not linked to the compiling.

mike07
28 Jul 2009, 3:34 AM
Compiling has nothing todo with hostedmode. If the classes are missing after compiling than something is wrong in on your side. However hostedmode is not linked to the compiling.
After compiling classes are generated BUT they are not in all gwt.rpc files (just in some not in all (instead they contain BeanModel))

sven
28 Jul 2009, 3:36 AM
BUT they are not in all gwt.rpc files

There is only one rpc file.

micgala
28 Jul 2009, 4:13 AM
the problem appear only in hosted mode with option noserver.
i think that perhaps 1% of person use it.
It's a new problem with gwt 1.6/gxt2
how many person use gxt2 and hosted mode with noserver?

i ll try to reproduce the problem in a simple project as soon as possible.

I use hosted mode with option noserver.
I have no issues with GWT 1.6 (or 1.7) and Gxt 2.

mike07
28 Jul 2009, 4:39 AM
There is only one rpc file.
no there is one rpc file per service (if all services have different parameter)

mike07
28 Jul 2009, 4:44 AM
I use hosted mode with option noserver.
I have no issues with GWT 1.6 (or 1.7) and Gxt 2.
Hi micgala,
are you using BeanModel or ModelData as parameter of your services?

Can you check your .gwt.rpc files, please check this rule:
If a .gwt.rpc contains class BeanModel it must contains all BeanModel_XXX generated from your own BeanModel via (BeanModelTag)
For me the rule is false.

mike07
28 Jul 2009, 4:54 AM
I create a project with:
a BeanModel:



public class BeanModel1 extends BaseModelData implements IsSerializable , BeanModelTag{


public BeanModel1() {
super();
}


public String getDisplay() {
return (String) this.get("display");
}
}



Many remoteService like:



package test.client;


import com.extjs.gxt.ui.client.data.ModelData;
import com.google.gwt.user.client.rpc.RemoteService;


public interface RemoteService1 extends RemoteService {
ModelData getModelData();
}



package test.client;


import com.extjs.gxt.ui.client.data.ModelData;
import com.google.gwt.user.client.rpc.AsyncCallback;


public interface RemoteService1Async {
public void getModelData(AsyncCallback<ModelData> callback);
}



package test.server;


import test.client.RemoteService1;


import com.extjs.gxt.ui.client.data.ModelData;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;


public class RemoteService1Impl extends RemoteServiceServlet implements RemoteService1 {
public ModelData getModelData() {
return null;
}
}


An EntryPoint:
which calls them:



BeanModel1 b = new BeanModel1();
b.set("TUTU", "PLAYA");
b.get("TUTU");


GWT.create(RemoteService1.class);
GWT.create(RemoteService2.class);
GWT.create(RemoteService3.class);
GWT.create(RemoteService4.class);
GWT.create(RemoteService5.class);
GWT.create(RemoteService6.class);


RemoteService1/2/3/4/5/6 are just duplicated services


If i check my gwt.rpc file BeanModel_testBeanModel1 is not present
(If all RemoteService have same parameter, only one gwt.rpc is generated (it's ok because the name is a hash of the content and the content is the same becaus it's just duplicated services))

micgala
28 Jul 2009, 4:59 AM
Hi micgala,
are you using BeanModel or ModelData as parameter of your services?

Can you check your .gwt.rpc files, please check this rule:
If a .gwt.rpc contains class BeanModel it must contains all BeanModel_XXX generated from your own BeanModel via (BeanModelTag)
For me the rule is false.

Sorry, I don't use BeanModel/ModelData in the server side.

sven
28 Jul 2009, 5:03 AM
Ok, i am understanding now what oyu are doing.

You should not send the generated classes to the server, send over the bean. There is no way to control the order of the generators.

mike07
28 Jul 2009, 5:32 AM
Ok, i am understanding now what oyu are doing.

You should not send the generated classes to the server, send over the bean. There is no way to control the order of the generators.

I don't send BeanModel_XXX generated class. I just want to sent a ModelData. The problem is that if i transfert a BaseTreeModel , BaseTreeModel reference a property children which is a ModelData. All BeanModel_XXX extends ModelData (via BeanModel), that's why they are considered as transferable by gwt.
As you say, it's ok, BeanModel_XXX must be in gwt.rpc, why not, it's by design.
Now the problem is that when i compile simple Test case, i see that BeanModel_XXX is not present in gwt.rpc. For you, Is it a bug or not?
(In my big project BeanModel_XXX are in some gwt.rpc, but not in other)

mike07
28 Jul 2009, 6:05 AM
In my simple test case, I have add a breakpoint in BeanModelGenerator and in ServiceInterfaceProxyGenerator.
ServiceInterfaceProxyGenerator is called BEFORE BeanModelGenerator, so gwt.rpc files can't contain BeanModel_XXX object.
I think that the order of generator call is undefined.

sven
28 Jul 2009, 6:12 AM
Yes that is the problem. There is not really a good way to control the order of the generators.

mike07
28 Jul 2009, 6:30 AM
Yes that is the problem. There is not really a good way to control the order of the generators.

will you try to solve the problem?

I think that BeanModel_XXX must never be in gwt.rpc file (as you previously say , they are NEVER send to server side). That's why in my first post i propose the suppress of inheritance of BeanModel. I know that you say that
It has to extend it but it's clearly the source of the problem. it's the cleanest solution.

If you want to keep BeanModel_XXX in gwt.rpc (why???), perhaps you can try to regenerate gwt.rpc at the end of the execution of your generator (or add BeanModel_XXX in existant gwt.rpc files (you must re-compute the hash name))

mike07
4 Aug 2009, 1:07 PM
Hi GXT Team,
Can we expect a solution for this problem or shall i remove all "implements BeanModelTag" from my source code?
thanks for your answer.