Search code examples
tomcatgwtamazon-ec2cherrypy

CONNECTION_TIMED_OUT error when retrieving data from CherryPy webservice on Amazon EC2


I have a web application that works great running on my Mac. Frontend written in GWT under Tomcat, calls backend CherryPy service for data.

I'm trying to get it running on an Amazon EC2 Linux instance.

Tomcat is configured to use 8090, CherryPy uses 8080.

When I start my CherryPy server, I get the following, where the obscured IP address is my private IP address (this should only ever get called locally).

> [06/Mar/2015:21:23:59] ENGINE Listening for SIGHUP.
> [06/Mar/2015:21:23:59] ENGINE Listening for SIGTERM.
> [06/Mar/2015:21:23:59] ENGINE Listening for SIGUSR1.
> [06/Mar/2015:21:23:59] ENGINE Bus STARTING [06/Mar/2015:21:23:59]
> ENGINE Started monitor thread 'Autoreloader'. [06/Mar/2015:21:23:59]
> ENGINE Started monitor thread '_TimeoutMonitor'.
> [06/Mar/2015:21:24:00] ENGINE Serving on http://xxx.xx.x.xxx:8080
> [06/Mar/2015:21:24:00] ENGINE Bus STARTED

The frontend is requesting from http://xxx.xx.x.xxx:8080/search/?role=0&query=foo, and I verified that the IP addresses match.

The log for the CherryPy server never shows that it gets the request, but I'm not getting a CONNECTION REFUSED error, rather a timeout error. I originally had the CherryPy server serving on 0.0.0.0, but that didn't work, either.

I'm definitely missing something; I just don't know what.


Solution

  • I'm not too familiar with GWT, but it sounds like it runs in the browser of the client, which means the request generated by the frontend is coming from the client machine, not the same machine as the backend. That means you need to open up the CherryPy port to serve on 0.0.0.0, and the frontend should use your server's public IP address to connect to the backend, NOT a private IP.