0

I am using WSO2 EMM version 1.1.0

I am following the guide to enable GCM, but after everything is configured, I am getting a null reference exception on the server side

Pulling every X seconds consumes lots of battery, so GCM is a must. is this going to be fixed or is there any fix for that?

Thanks!

 TID: [0] [EMM] [2015-02-05 13:32:09,473] ERROR {org.jaggeryjs.jaggery.core.manager.WebAppManager} -  org.mozilla.javascript.WrappedException: Wrapped java.lang.NullPointerException (gcm#7) {org.jaggeryjs.jaggery.core.manager.WebAppManager}
org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.WrappedException: Wrapped java.lang.NullPointerException (gcm#7)
    at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:571)
    at org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)


Caused by: org.mozilla.javascript.WrappedException: Wrapped java.lang.NullPointerException (gcm#7)
    at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1754)
    at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:148)
    at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)
    at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52)
    at org.mozilla.javascript.gen.gcm_21._c_anonymous_2(gcm:7)
    at org.mozilla.javascript.gen.gcm_21.call(gcm)

Caused by: java.lang.NullPointerException
    at org.wso2.mobile.gcm.GCMServerBridge.sendDataViaGCM(GCMServerBridge.java:61)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)

Here are the logs when I try to connect the server when it's set to GCM:

W/System.err(26481): java.lang.IllegalArgumentException: Host name may not be null
D/audio_hw_primary(  204): select_devices: out_snd_device(2: speaker) in_snd_device(0: )
W/System.err(26481):  at org.apache.http.HttpHost.<init>(HttpHost.java:83)
W/System.err(26481):  at org.apache.http.impl.client.AbstractHttpClient.determineTarget(AbstractHttpClient.java:497)
W/System.err(26481):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
W/System.err(26481):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
W/System.err(26481):  at org.wso2.emm.agent.proxy.ServerUtilitiesTemp.postData(ServerUtilitiesTemp.java:100)
W/System.err(26481):  at org.wso2.emm.agent.proxy.APIController$NetworkCallTask.doInBackground(APIController.java:72)
W/System.err(26481):  at org.wso2.emm.agent.proxy.APIController$NetworkCallTask.doInBackground(APIController.java:1)
W/System.err(26481):  at android.os.AsyncTask$2.call(AsyncTask.java:288)
W/System.err(26481):  at java.util.concurrent.FutureTask.run(FutureTask.java:237)
W/System.err(26481):  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
W/System.err(26481):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
W/System.err(26481):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
W/System.err(26481):  at java.lang.Thread.run(Thread.java:841)
E/AlreadyRegisteredActivity(26481): The responseStatus is null in onReceiveAPIResult()
Community
  • 1
  • 1
Sharas
  • 1,985
  • 3
  • 20
  • 43

1 Answers1

0

Have you added your GCM API key and Sender ID in WSO2 EMM server's configuration file which you can find at EMM_HOME/repository/deployment/server/jaggeryapps/emm/config/config.json.? Configuration should be as follows.

"ANDROID": {
            "NOTIFIER_INTERVAL" : "30000",
            "NOTIFIER" : "GCM",
            "APIKEY" : "YOUR-KEY",
            "SENDERID" : "YOUR-SENDER-ID"
        },
Kasun Delgolla
  • 219
  • 1
  • 8
  • Hi, thanks for your reply. I tried it again now, I don't get the exception, but now, i'm getting an error when trying to register (device admin gets enabled, but the client fails to register to the server) – Sharas Mar 24 '15 at 14:17
  • Can you share the server logs? You can try tail -f command to the file, repository/logs/wso2carbon.log and try register the device. And share the log you get there. Are you trying with HTTP? – Kasun Delgolla Mar 25 '15 at 04:18
  • Hi, sorry for the late response. I changed the settings back to GCM, and now it seems i can't register to the server. i added the logs to my original question – Sharas Jun 11 '15 at 14:18
  • BTW, is there an email that i can attach the log output from the server? – Sharas Jun 11 '15 at 14:35
  • Hi Sharas, Use this guide[1] when you are enrolling. And use [2] and [3] when you configure GCM. [1] - http://wso2.com/library/articles/2014/03/how-wso2-emm-addresses-the-android-challenge/ [2] - https://docs.wso2.com/display/EMM110/Android+Settings [3] - https://docs.wso2.com/display/EMM110/Android+Configurations – Kasun Delgolla Jun 14 '15 at 04:08
  • Hi @Kasun Delgolla, thank you. I followed [1] [2] guides, before getting this problem, and i made sure now that this is what i did again. regarding [3] i'm not sure i need these steps if i want to communicate via GCM and not via https, no? – Sharas Jun 14 '15 at 06:15
  • Even though you configure GCM, device again contacts the server using HTTP/HTTPS. So if you need that communication to be HTTPS, you need to follow that. For your information, GCM is a one way communication method (server to device only) – Kasun Delgolla Jun 15 '15 at 06:44
  • i'm ok with http, for now http is fine, i just want to make GCM to work – Sharas Jun 15 '15 at 07:08
  • Then you just need to follow the steps in https://docs.wso2.com/display/EMM110/Android+Settings – Kasun Delgolla Jun 16 '15 at 08:17
  • Did you create a Google API project properly? And added the project number as the sender ID and then the API key? If so we need to debug this properly. At what step you get this error? – Kasun Delgolla Jun 18 '15 at 09:55
  • Yes i did, I'm getting this error when i'm trying to connect with the client – Sharas Jun 21 '15 at 07:23
  • If it helps, when i'm trying to connect with the client, it fails and i get the following error in logcat: AlreadyRegisteredActivity﹕ The value of status is : 404 – Sharas Jun 22 '15 at 14:13
  • Hi, another update... I managed to fix the problem on the client side, and now i'm able to connect the client to the MDM with GCM. but now, I can't get device details (from device operations) and I can't send any apk to the device, from the logs, it seems that the client doesn't get any message. – Sharas Jun 23 '15 at 08:35
  • Can you post the device logs + server logs when you try to send a command? Just need to verify whether the client gets the GCM notification properly. – Kasun Delgolla Jul 30 '15 at 06:08