Unable to resolve host "api.shephertz.com": No address associated with hostname in android

0 votes

Hello, I have a problem in quering User Service in Android.

Almost app user have no problem, but tablet user have a problem.

A problem is 'appErrorCode 0' when quering User Service

the problem is appErrorCode 0 is occured in userService.getUser!

Non-fatal Exception: com.shephertz.app42.paas.sdk.android.App42Exception: java.net.UnknownHostException: Unable to resolve host "api.shephertz.com": No address associated with hostname
       at com.shephertz.app42.paas.sdk.android.user.UserService.authenticate(UserService.java:1566)
       at com.shephertz.app42.paas.sdk.android.user.UserService$20.run(UserService.java:1593)
Caused by java.net.UnknownHostException: Unable to resolve host "api.shephertz.com": No address associated with hostname
       at java.net.InetAddress.lookupHostByName(InetAddress.java:435)
       at java.net.InetAddress.getAllByNameImpl(InetAddress.java:255)
       at java.net.InetAddress.getAllByName(InetAddress.java:218)
       at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137)
       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:368)
       at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
       at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
       at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
       at com.shephertz.app42.paas.sdk.android.connection.RESTConnectorCache.getPostResponse(RESTConnectorCache.java:529)
       at com.shephertz.app42.paas.sdk.android.connection.RESTConnectorCache.executePost(RESTConnectorCache.java:246)
       at com.shephertz.app42.paas.sdk.android.user.UserService.authenticate(UserService.java:1558)
       at com.shephertz.app42.paas.sdk.android.user.UserService$20.run(UserService.java:1593)

Crashed: Thread-1326: 0 0 0x0000000000000000
       at com.shephertz.app42.paas.sdk.android.user.UserService.authenticate(UserService.java:1566)
       at com.shephertz.app42.paas.sdk.android.user.UserService$20.run(UserService.java:1593)

api call works on smartphone fine, but tablet make above error!

the tablet connected correctly on Wi-Fi. (openning web is fine)

and manifest permission also fine.

 

asked Jun 27, 2016 in Android by HunHee Na (21 points)

1 Answer

0 votes

Hi HunHee,

Greetings!!!!!!!!!

java.net.UnknownHostException kind of exception occures in following cases.

  1. Either you have not provided permission for InterNet in AndroidManifest.xml file.
  2. Or device is not connected with the internet.

As in your case this is not the reason as you have mentioned. Please Switch On the wifi again. If the problem  persists, share the device details with us.

Let me know if it helps.

Thanks

Vishnu Garg

answered Jun 27, 2016 by Vishnu Garg (674 points)
edited Jun 27, 2016 by Vishnu Garg
thank for your answer. but the problem remains.

I installed same apk file in smartphone and tablet.
and I logon using same ID/PW, same Wi-Fi.
but smartphone works good, but tablet is not!

here's tablet's log.
06-27 20:21:46.299 12097-12097/nahunhee.circle I/ViewRootImpl: ViewRoot's Touch Event : Touch Down
06-27 20:21:46.359 12097-12097/nahunhee.circle I/ViewRootImpl: ViewRoot's Touch Event : Touch UP
06-27 20:21:46.409 12097-12097/nahunhee.circle D/BubblePopupHelper: isShowingBubblePopup : false
06-27 20:21:46.409 12097-12097/nahunhee.circle D/BubblePopupHelper: isShowingBubblePopup : false
06-27 20:21:46.409 12097-12097/nahunhee.circle D/BubblePopupHelper: isShowingBubblePopup : false
06-27 20:21:46.409 12097-12097/nahunhee.circle D/BubblePopupHelper: isShowingBubblePopup : false
06-27 20:21:46.439 12097-12097/nahunhee.circle D/BubblePopupHelper: isShowingBubblePopup : false
06-27 20:21:46.439 12097-12097/nahunhee.circle D/BubblePopupHelper: isShowingBubblePopup : false
06-27 20:21:46.439 12097-12097/nahunhee.circle D/BubblePopupHelper: isShowingBubblePopup : false
06-27 20:21:46.439 12097-12097/nahunhee.circle D/BubblePopupHelper: isShowingBubblePopup : false
06-27 20:21:46.449 12097-17467/nahunhee.circle I/System.out:  ########## Setting Session ##########
06-27 20:21:46.449 12097-17467/nahunhee.circle I/System.out:  Json String : {"app42":{"user":{"password":"1111","userName":"1111"}}}
06-27 20:21:46.449 12097-17467/nahunhee.circle I/System.out: sortedparams: apiKey97830c4223ea683b7a3051691c25bb0b06c1a539187eea47c37d8856c882b492body{"app42":{"user":{"password":"1111","userName":"1111"}}}sessionIdc4a47b21-989d-4fbb-add0-b9669810c9e1timeStamp2016-06-27T11:21:46.464Zversion1.0
06-27 20:21:46.459 12097-17467/nahunhee.circle I/System.out: Post URL is https://api.shephertz.com/cloud/1.0/user/authenticateAndCreateSession?
06-27 20:21:46.459 12097-17467/nahunhee.circle I/System.out:  Setting Header value : deviceId : dc5542ad75ce220e
06-27 20:21:46.459 12097-17467/nahunhee.circle I/System.out:  Setting Header value : signature : AikEArKjReZYzPNfwohlzXADrb4%3D
06-27 20:21:46.459 12097-17467/nahunhee.circle I/System.out:  Setting Header value : SDKName : Android
06-27 20:21:46.459 12097-17467/nahunhee.circle I/System.out:  Setting Header value : version : 1.0
06-27 20:21:46.459 12097-17467/nahunhee.circle I/System.out:  Setting Header value : sessionId : c4a47b21-989d-4fbb-add0-b9669810c9e1
06-27 20:21:46.459 12097-17467/nahunhee.circle I/System.out:  Setting Header value : apiKey : 97830c4223ea683b7a3051691c25bb0b06c1a539187eea47c37d8856c882b492
06-27 20:21:46.459 12097-17467/nahunhee.circle I/System.out:  Setting Header value : loggedInUser : 1111
06-27 20:21:46.459 12097-17467/nahunhee.circle I/System.out:  Setting Header value : timeStamp : 2016-06-27T11:21:46.464Z
06-27 20:21:46.469 12097-12097/nahunhee.circle I/----: onPostExecute:  true
06-27 20:21:47.110 12097-17467/nahunhee.circle I/System.out:  PostResponse is {"app42":{"response":{"success":true,"users":{"user":{"userName":"1111","accountLocked":false,"sessionId":"c4a47b21-989d-4fbb-add0-b9669810c9e1","email":"1111@smartmath1111.com"}}}}}
06-27 20:21:47.110 12097-17467/nahunhee.circle I/System.out: Name : email
06-27 20:21:47.110 12097-17467/nahunhee.circle I/System.out: value : java.lang.String
06-27 20:21:47.110 12097-17467/nahunhee.circle I/System.out: Name : sessionId
06-27 20:21:47.110 12097-17467/nahunhee.circle I/System.out: value : java.lang.String
06-27 20:21:47.110 12097-17467/nahunhee.circle I/System.out: Name : userName
06-27 20:21:47.110 12097-17467/nahunhee.circle I/System.out: value : java.lang.String
06-27 20:21:47.120 12097-17467/nahunhee.circle I/System.out: Name : accountLocked
06-27 20:21:47.120 12097-17467/nahunhee.circle I/System.out: value : java.lang.Boolean
06-27 20:21:47.130 12097-17489/nahunhee.circle I/System.out:  ########## Setting Session ##########
06-27 20:21:47.130 12097-17489/nahunhee.circle I/System.out: sortedparams: apiKey97830c4223ea683b7a3051691c25bb0b06c1a539187eea47c37d8856c882b492sessionIdc4a47b21-989d-4fbb-add0-b9669810c9e1timeStamp2016-06-27T11:21:47.140ZuserName1111version1.0
06-27 20:21:47.130 12097-17489/nahunhee.circle I/System.out:  QueryString is ?
06-27 20:21:47.130 12097-17489/nahunhee.circle I/System.out:  Requested URL is https://api.shephertz.com/cloud/1.0/user/1111?
06-27 20:21:47.130 12097-17489/nahunhee.circle I/System.out: Policy.NETWORK_FIRST
06-27 20:21:47.130 12097-17489/nahunhee.circle I/System.out:  Exception :com.shephertz.app42.paas.sdk.android.App42Exception: java.lang.NullPointerException
06-27 20:21:47.130 12097-17489/nahunhee.circle I/----: java.lang.NullPointerException
and here's smartphone's debug log that works good.


and here's smartphone's debug log

06-27 20:25:25.874 4393-4995/nahunhee.circle I/System.out:  ########## Setting Session ##########
06-27 20:25:25.884 4393-4995/nahunhee.circle I/System.out:  Json String : {"app42":{"user":{"password":"1111","userName":"1111"}}}
06-27 20:25:25.884 4393-4995/nahunhee.circle I/System.out: sortedparams: apiKey97830c4223ea683b7a3051691c25bb0b06c1a539187eea47c37d8856c882b492body{"app42":{"user":{"password":"1111","userName":"1111"}}}sessionIdbb4e5016-ff1a-43fe-a5e4-cc6bf5f961f2timeStamp2016-06-27T11:25:25.886Zversion1.0
06-27 20:25:25.884 4393-4995/nahunhee.circle I/System.out: Post URL is https://api.shephertz.com/cloud/1.0/user/authenticateAndCreateSession?
06-27 20:25:25.884 4393-4995/nahunhee.circle I/System.out:  Setting Header value : deviceId : 674e06977dae1df
06-27 20:25:25.884 4393-4995/nahunhee.circle I/System.out:  Setting Header value : signature : Wc%2Fw%2BwuhQe04X3CLgjj6%2B%2FOcuyU%3D
06-27 20:25:25.884 4393-4995/nahunhee.circle I/System.out:  Setting Header value : SDKName : Android
06-27 20:25:25.884 4393-4995/nahunhee.circle I/System.out:  Setting Header value : version : 1.0
06-27 20:25:25.884 4393-4995/nahunhee.circle I/System.out:  Setting Header value : sessionId : bb4e5016-ff1a-43fe-a5e4-cc6bf5f961f2
06-27 20:25:25.884 4393-4995/nahunhee.circle I/System.out:  Setting Header value : apiKey : 97830c4223ea683b7a3051691c25bb0b06c1a539187eea47c37d8856c882b492
06-27 20:25:25.884 4393-4995/nahunhee.circle I/System.out:  Setting Header value : loggedInUser : teacher
06-27 20:25:25.884 4393-4995/nahunhee.circle I/System.out:  Setting Header value : timeStamp : 2016-06-27T11:25:25.886Z
06-27 20:25:25.894 4393-4393/nahunhee.circle I/----: onPostExecute:  true
06-27 20:25:26.314 4393-4995/nahunhee.circle I/System.out:  PostResponse is {"app42":{"response":{"success":true,"users":{"user":{"userName":"1111","accountLocked":false,"sessionId":"c4a47b21-989d-4fbb-add0-b9669810c9e1","email":"1111@smartmath1111.com"}}}}}
06-27 20:25:26.314 4393-4995/nahunhee.circle I/System.out: Name : email
06-27 20:25:26.314 4393-4995/nahunhee.circle I/System.out: value : java.lang.String
06-27 20:25:26.314 4393-4995/nahunhee.circle I/System.out: Name : sessionId
06-27 20:25:26.314 4393-4995/nahunhee.circle I/System.out: value : java.lang.String
06-27 20:25:26.314 4393-4995/nahunhee.circle I/System.out: Name : userName
06-27 20:25:26.314 4393-4995/nahunhee.circle I/System.out: value : java.lang.String
06-27 20:25:26.314 4393-4995/nahunhee.circle I/System.out: Name : accountLocked
06-27 20:25:26.314 4393-4995/nahunhee.circle I/System.out: value : java.lang.Boolean
06-27 20:25:26.334 4393-5014/nahunhee.circle I/System.out:  ########## Setting Session ##########
06-27 20:25:26.334 4393-5014/nahunhee.circle I/System.out: sortedparams: apiKey97830c4223ea683b7a3051691c25bb0b06c1a539187eea47c37d8856c882b492sessionIdc4a47b21-989d-4fbb-add0-b9669810c9e1timeStamp2016-06-27T11:25:26.341ZuserName1111version1.0
06-27 20:25:26.334 4393-5014/nahunhee.circle I/System.out:  QueryString is ?
06-27 20:25:26.334 4393-5014/nahunhee.circle I/System.out:  Requested URL is https://api.shephertz.com/cloud/1.0/user/1111?
06-27 20:25:26.334 4393-5014/nahunhee.circle I/System.out: Policy.NETWORK_FIRST
06-27 20:25:26.344 4393-5014/nahunhee.circle I/System.out:  Setting Header value : deviceId : 674e06977dae1df
06-27 20:25:26.344 4393-5014/nahunhee.circle I/System.out:  Setting Header value : signature : cNa6qswhLBOnxCBb43DmKi6WnP0%3D
06-27 20:25:26.344 4393-5014/nahunhee.circle I/System.out:  Setting Header value : SDKName : Android
06-27 20:25:26.344 4393-5014/nahunhee.circle I/System.out:  Setting Header value : version : 1.0
06-27 20:25:26.344 4393-5014/nahunhee.circle I/System.out:  Setting Header value : sessionId : c4a47b21-989d-4fbb-add0-b9669810c9e1
06-27 20:25:26.344 4393-5014/nahunhee.circle I/System.out:  Setting Header value : apiKey : 97830c4223ea683b7a3051691c25bb0b06c1a539187eea47c37d8856c882b492
06-27 20:25:26.344 4393-5014/nahunhee.circle I/System.out:  Setting Header value : loggedInUser : 1111
06-27 20:25:26.344 4393-5014/nahunhee.circle I/System.out:  Setting Header value : timeStamp : 2016-06-27T11:25:26.341Z
06-27 20:25:26.794 4393-5014/nahunhee.circle I/System.out:  GetResponse is {"app42":{"response":{"success":true,"users":{"user":{"userName":"1111","email":"1111@smartmath1111.com","createdOn":"2016-05-15T13:08:47.000Z","accountLocked":false,"profile":{"firstName":"false","lastName":"","sex":null,"dateOfBirth":null,"mobile":null,"officeLandLine":null,"homeLandLine":null,"line1":"7ZmN6ri464+Z7LSI65Ox7ZWZ6rWQLzE=","line2":"7ZWZ7IOdLzE=","city":null,"state":null,"pincode":null,"country":null}}}}}}
06-27 20:25:26.794 4393-5014/nahunhee.circle I/System.out: Updating Cache
06-27 20:25:26.794 4393-5036/nahunhee.circle I/System.out: sortedparams: SDKNameAndroid_App42_Cache_MethodGET_App42_Cache_URLhttps://api.shephertz.com/cloud/1.0/user/1111?apiKey97830c4223ea683b7a3051691c25bb0b06c1a539187eea47c37d8856c882b492deviceId674e06977dae1dfloggedInUser1111sessionIdc4a47b21-989d-4fbb-add0-b9669810c9e1version1.0
After going through with the logs I have found that you are getting NullPointerException. Could you please share the API details that you are using that help us to trace the exact problem you are facing.
You can share the code snippet as well.
I replied on above question!
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...