Thursday, September 27, 2012

No RequestContext for operation GWT

Problem

When trying to execute a Spring Roo Application that uses GWT it shows the following message error in console: No RequestContext for operation.


Attention 

This error also occurs  when using RequestFactory and the methods from the client side are not compatibles with the server side. Before trying what is explained here, make sure that the methods were created properly. More information about how to create the methods see this GWT documentation: https://developers.google.com/web-toolkit/doc/latest/DevGuideRequestFactory

Reason

Changes made in a subclass of RequestContext. Apparently it is related to compilation/build problems.

Solution

Recompile/rebuild the project. A simple rebuild did not work to me. Follow the steps that I think I did to resolve the problem. I am not sure because I do not simulated the error again. In the command line:


 mvn clean
 mvn compile
 mvn gwt:run

If not work, try in eclipse:

plugin do google->GWT Compile Projet

If not work try to recompile/rebuild in other ways.

No RequestContext for operation GWT





Problema

Ao tentar executar uma aplicação Spring Roo que utiliza o GWT apresenta a seguinte mensagem de erro no console: No RequestContext for operation.



Observação:

Este erro também acontece ao se utilizar RequestFactory e os métodos no lado cliente e no lado servidor não estejam compatíveis. Antes de tentar o explicado aqui certifique-se que os métodos foram criados corretamente. Maiores informações de como os métodos devem ser criados, ver a seguinte documentação do GWT: https://developers.google.com/web-toolkit/doc/latest/DevGuideRequestFactory?hl=pt-BR


Motivo

Modificações feita em classe filha de RequestContext. Aparentemente o projeto ficou inconsistente após modificações em classe filha de RequestContext. Está relacionado a problemas de build/compilação do projeto

Solução

Reconstruir o projeto. Uma simples rebuild não funcionou. Segue os passos que provavelmente efetuei para solucionar o problema. Não simulei o erro novamente. Na linha de comando execute:


 mvn clean
 mvn compile
 mvn gwt:run

Não tenho certeza se o passo seguinte também é necessário. No eclipse:

plugin do google->GWT Compile Projet

Se não funcionar tente recompilar/reconstruir de com outras sequências/formas.