2007-10-26

Connecting to a Server in GWT

A while back I started playing with GWT and created a small game GWTTiles. Fine example but there's no client-server interaction, so I tried that out a few days ago. The DynaTables example seemed way too complicated so I looked on the web, and got fairly far but couldn't get the server to work- but then finally a comment in a tutorial pointed out I needed to compile the java server myself, GWT wasn't going to compile it for me- though once placed in the proper directory it would happily run the .class file automatically.

So I didn't even have the java jdk installed, that was necessary to get javac:

javac -cp "$APPDIR/bin:$APPDIR/src:/home/bm/other/gwt-linux-1.4.60/gwt-user.jar:/home/bm/other/gwt-linux-1.4.60/gwt-dev-linux.jar" src/com/binarymillenium/gwt/server/serviceImpl.java

Then the class file had to be placed in bin/com/binarymillenium/gwt/server, and running the -shell script will properly execute it and my client app can get data from the server (just a text string for now, I need to figure out serializing next).

This is the error I used to get:

"com.google.gwt.user.client.rpc.InvocationException: Unable to find/load mapped servlet class 'com.binarymillenium.gwt.server.serviceImpl'"

And in the development shell window:

[ERROR] Unable to instantiate 'com.binarymillenium.gwt.server.serviceImpl'
java.lang.ClassNotFoundException: com.binarymillenium.gwt.server.serviceImpl
...

No comments: