Samsul Arifin
Samsul Arifin

Reputation: 247

IBM Worklight - "The Connection to the server was unsuccessful"

When I preview my application in Worklight Console, it successfully connects to the Worklight Server, but if I run the app in the emulator I get this error:

The Connection to the server was unsuccessful. (file://data/data/com.TestApps/files/www/default/TestApps.html).

I have changed the worklightServerRootURL value, but it is not helping.

<worklightServerRootURL>http:10.0.2.2:8080</worklightServerRootURL>

Upvotes: 1

Views: 1133

Answers (1)

Idan Adar
Idan Adar

Reputation: 44516

Is the worklightServerRootURL value in your question the actual value you've placed? You forgot "//"... it should be: http://10.0.2.2:8080.

That said, the IP address seems weird. Make sure that this IP address is the same IP address used for the machine Worklight Server is installed on (the Eclipse with the Worklight Studio plug-in...).

You can do this by opening a CMD window and typing ipconfig. Choose the correct IP address and use it instead of 10.0.0.2.


When previewing using Worklight Console, you're loading the web resources sitting in the server, so there is no problem there (you're connecting to localhost).

When launching the app in a device/emulator, the app tries to connect to the Worklight Server, so you need to make sure to use the external IP address of your server machine. Also make sure that both the server and device/emulator are in the same network.

To make sure the device is in the same network as the server, open the emulator browser app and try to load this URL: http://your-ip-address:8080/console (use the same IP address as in worklightServerRootURL).

Upvotes: 1

Related Questions