0
votes

I am using SQL adapter in my mobilefirst hybrid application. The Login and all other Sql adapters are working perfectly in my web simulator.

I just tried this app to the android device and perform the login action in my device at that time I am getting the following errors in my LogCat(App installed through the USB). I installed the app through the USB and .apk file. In two cases my login is not working in my Android device.

ERROR:

Request timeout for [/apps/services/api/projectfolder/android/query]

WLNativeXHRPlugin$NativeXHRPostListener.onException in WLNativeXHRPlugin.java:154 :: onException

org.apache.http.conn.ConnectTimeoutException: Connect to .. timed out

at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:121)

at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144)

at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)

at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)

at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)

at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:670)

at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:509)

at com.worklight.wlclient.WLHybridRequestSender.run(WLHybridRequestSender.java:63)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)

at java.lang.Thread.run(Thread.java:856)

Android device connected in same network through the WIFI . This application is working perfectly in web Simulator problem occurring in Android device.

Adapter XML For database connection

<dataSourceDefinition>
                <driverClass>com.mysql.jdbc.Driver</driverClass>
                <url>jdbc:mysql://databaseurl:3306/batabasename</url>
                <user>username</user>
                <password>password</password> 
            </dataSourceDefinition>

My databse url is public url not localhost(127.0.0.1) url. Its perfectly working in Browser simulator

2
Provide the adapter XML, it could be that you're pointing to "localhost" and then the requests remains "inside" the adapter and doesn't reach the server. - Idan Adar
I updated the adapter XML below to my question - Team
What about Android Emulator. Does it fail there as well? - Idan Adar
Additionally, from the log: "Connect to .. timed out" - did you edit this line? what was written there? - Idan Adar

2 Answers

0
votes

The log is showing:

org.apache.http.conn.ConnectTimeoutException: Connect to .. timed out

Need to figure out where it tried to connect to. What was there before you changed it to ".."?

Several theories:

  1. If you're pointing to localhost, change that to an IP address
  2. If you have several IP addresses, make sure you are using the correct one used by the server (you can try to disable any networks cards, leaving only 1 so that you will have only 1 IP address; the server should automatically pick it, use it for the adapter as well.
0
votes

Try to reboot your mobile phone! This solved the problem for me.