I found a way around the exception by having not initializing the class/classloader like:
xyxClazz.forName(someName, false, clazzLoader); //using false instead of true like I was using This allows me to perform the reflection I need without invoking the static calls (that what is true/false initialization is supposed to do) that trigger the GWT.create() calls on the server-side. -Sam On Aug 29, 10:52 pm, Sam Taha <[EMAIL PROTECTED]> wrote: > I am doing some reflection on GWT client UI code. I do the reflection > (like checking if a client class is of an "isAssignableForm" on the > server side. I do not want to instantiate the GWT client UI classes on > the server I only want to check some meta/reflection information about > the superclass ...etc and I get this exception: > > 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. > at com.google.gwt.core.client.GWT.create(GWT.java:91) > at com.google.gwt.user.client.ui.UIObject.<clinit>(UIObject.java: > 139) > > This used to work just fine with GWT 1.4. Why is it necessary to > prevent any reflection calls of client code on the server side. Seems > like overkill. I can see the need to prevent the client UI classes > from being accidentally used on the server side but this prevents my > ability to do reflection. > > -Sam --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
