gwt java.lang.ExceptionInInitializerError

两盒软妹~` 提交于 2019-12-02 04:19:42

Almost for sure you are calling a class that is GWT client only. You have the error:

 Caused by: java.lang.UnsupportedOperationException: ERROR: GWT.create() is only usable    
in client code!  It cannot be called, for example, from server code.  If you are  
running a unit test, check that your test case extends GWTTestCase and that 
GWT.create() is not called from within an initializer or constructor.

You don't need to specifically call "GWT.create()" yourself to get that exception. you might be calling a GWT client only class on the server side. Also you might containg a "client only" object in one of your RPC's arguments or even on shared code being called on the server side.

FWIW, I had the same error and it ended up being a constant (static final) that used GWT.create() to initialise. The constant was in a class that needed to be loaded by the GIN dependency injection parser.

IE: It was trying to load the class (and call GWT.create()) during module compile.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!