I had similar problems getting X-windows and emacs working together. 1) the DISPLAY environment variable needs to be set. 2) You must execute the xhost (xhosts?) command for remote operations to work correctly (at least in some environments). As I recall, the error messages were not too helpful in identifying the problem. I hope this helps.