且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

gwt java.lang.ExceptionInInitializerError

更新时间:2023-12-03 23:36:52

几乎确定你正在调用一个只有GWT客户端的类。你有错误:

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.

您不需要专门调用GWT.create()来获取该异常。您可能会在服务器端调用GWT客户端类。另外,您可能会在您的RPC参数之一中包含一个仅客户端对象,甚至包含在服务器端调用的共享代码。

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.