Remote Service

Hi guys,

I’m using GWT’s AsyncCallback, but I get a errors on this snippet:


private static MyServiceAsync instance;

        public static final MyServiceAsync getInstance()
        {
            if ( instance == null )
            {
                instance = (MyServiceAsync ) com.google.gwt.core.client.GWT.create( MyService.class );
                ServiceDefTarget target = (ServiceDefTarget) instance;
                target.setServiceEntryPoint( com.google.gwt.core.client.GWT.getModuleBaseURL() + "myService" );
            }
            return instance;
        }

But I only get a NoClassDefFoundError: “com/google/gwt/core/shared/GWTBridge”.

I have googled around and tried the gwt.core.shared.GWT class, but then I get this:

“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.”

So is there a workaround or some alternative ways with vaadin?

Where are you doing this, in client side or server side code?

Are you making a pure GWT application or a Vaadin application?

My guess is that you are most likely trying to use GWT.create() in a server side only class which you cannot do, GWT.create() can only be used on the client side (as the exception states).

Thank you for the fast reply.

I’m only using it Clientside.
I have found an related issue here: http://code.google.com/p/google-web-toolkit/issues/detail?id=7527

Maybe it could be a bug of gwt itself.

Yes, looks like it is a bug in GWT indeed. It appears the GWT team merged the fix for it today into their repository so it will also be fixed in the next Vaadin 7 version.

So is there a similar alternative with vaadin?
Because I prefer to create a vaadin-only application and prefent mixing gwt and vaadin together (if this is even possible).

Thank you so far :slight_smile:

push