Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

BlackBerry Push Development

Reply
Contributor
ngoossens
Posts: 10
Registered: ‎11-09-2012
My Device: 9300
Accepted Solution

Push registration: Network Error (Berr java.lang.IllegalArgumentException)

Hi,

 

We are trying to get WebWorks push working but are having an issue with blackberry.push.openBISPushListener. The onRegister function is returning a status of 1 (network error). 

 

The log file is showing the following:

 

11/9 10:00:54 W net.rim.blackberry.api.push - Berr java.lang.IllegalArgumentException
11/9 10:00:21 a Contapp - PushDaemon is started.
11/9 10:00:21 a Contapp - Register push application
11/9 10:00:21 a Contapp - open BIS push listener

 

This application used to work so I am wondering if something might have changed in the push server upgrade.

 

The application code is as follows:

 

<!DOCTYPE HTML>
<html lang="en">
<head>
    <script type="text/javascript">
        var port = 00000; // Actual port used
        var serverUrl = "http://pushapi.eval.blackberry.com";
        var appId = "2xx2-5xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx7";
        var max = 100;
        var wakeUpPage = "index.html";

        function openBISPushListener()
        {
            try
            {
                var ops = { port: port, appId: appId, serverUrl: serverUrl, wakeUpPage: 'index.html', maxQueueCap: max };
                blackberry.push.openBISPushListener(ops, onData, onRegister, onSimChange);
            }
            catch (err)
            {
                alert(err);
            }
        }

        function onRegister(status)
        {
            if (status == 0)
            {
                alert("success");
            }
            else if (status == 1)
            {
                alert("network error"); // This happens
            }
            else if (status == 2)
            {
                alert("rejected by server");
            }
            else if (status == 3)
            {
                alert("invalid parameters");
            }
            else if (status == -1)
            {
                alert("general error");
            }
            else
            {
                alert("unknown status");
            }
        }

        function onData(data)
        {
            var resultDiv = document.getElementById("resultDiv");
            try
            {
                resultDiv.innerHTML += "<br>" + blackberry.utils.blobToString(data.payload);
                return 0; //indicate acceptance of payload for reliable push
            }
            catch (err)
            {
                alert(err);
            }
        }

        function onSimChange()
        {
            var resultDiv = document.getElementById("resultDiv");
            resultDiv.innerHTML += "<br>" + "SIM card is changed!";
        }
    </script>
</head>
<body onload="openBISPushListener()">
    <div id="resultDiv"></div>
</body>
</html>

 

And the following push configuration is in config.xml:

 

<feature id="blackberry.push" required="true" version="1.0.0.0"/>
<feature id="blackberry.utils" required="true" version="1.0.0.0" />
<feature id="blackberry.invoke" required="true" version="1.0.0.0"/>

<access subdomains="true" uri="*" />

<content src="index.html" rim:allowInvokeParams="true"></content>

<rim:connection>
  <id>BIS-B</id>
  <id>MDS</id>
  <id>TCP_WIFI</id>
  <id>TCP_CELLULAR</id>
  <id>WAP2</id>
  <id>WAP</id>
</rim:connection>

<rim:permissions>
  <rim:permit>read_device_identifying_information</rim:permit>
  <rim:permit>access_shared</rim:permit>
</rim:permissions>

 

This is all being tested on a 9300 device.

 

Any ideas as to why we could be getting this error?

 

Thanks in advance for the assistance!

 

Nick

Retired
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10

Re: Push registration: Network Error (Berr java.lang.IllegalArgumentException)

Hi Nick,

 

First I would make sure your SIM has a valid BlackBerry BIS data plan available. 

 

Second you should make sure that you have no other applications on the device listening on the same port. It may be a good step to delete the app, hard-reset the device, then install and launch again to see if it begins to work.

Garett
@garettBeuk
--
Goodbye everybody!
Contributor
ngoossens
Posts: 10
Registered: ‎11-09-2012
My Device: 9300

Re: Push registration: Network Error (Berr java.lang.IllegalArgumentException)

Hi Garett,

 

Thanks for the information. Unfortunately it doesn’t seem to be any of these issues. We have ensured that BIS is active on the device and even got a new SIM card and registered it with BIS to confirm.

 

We also hard reset the device and just installed our test application.

 

The diagnostic log taken from, Settings -> Mobile Network -> Menu Button -> Diagnostics Tests -> Menu Button -> Run, is shown below.

 

Diagnostic Started: Nov 13, 2012 2:34 PM
Diagnostic Completed: Nov 13, 2012 2:34 PM
PIN: 29ccd462
MSISDN: Unknown Number
Device Type: BlackBerry 8520
Application Version: v5.0.0.592
Platform Version: 5.2.0.64
Service Books: RIM_IM,WPTCP,BrowserConfig,WAPPushConfig,WPTCP,BrowserConfig,WPTCP,MMS,IPPP,YHO,BBIMConfig,OTASL,BBIM,BBIMConfig,BISClientConfig,BrowserConfig,BrowserConfig,APPWORLD,LbsConfig,BBIMConfig,BrowserConfig,BrowserConfig,IPPP,BrowserConfig,PROVISIONING,KEYNEGO
Free File Space: 140751864 bytes
Radio Data Activation: Yes
Signal Level: -54 dBm
Radio Access: EDGE
Network: VodaCom-SA
IP Address: 10.128.225.183
ICMP Ping Echo: Yes
BlackBerry Registration: Yes
Connected to BlackBerry: Yes
BlackBerry PIN-PIN: Yes

 

We have also tried the sample-push-enabled-app on both a 8520 and a 9300 with no luck, still getting the IllegalArgumentException error. This was after setting up the sample-push-initiator Tomcat application which correctly receives the registration.

 

Please let us know if you have any further ideas.

 

Thanks!

 

Nick

Retired
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10

Re: Push registration: Network Error (Berr java.lang.IllegalArgumentException)

Hi Nick,

 

Let's stick with testing the Java sample-push-enabled-app as it will be easier to diagnose the issue. 

 

What line is throwing the IllegalArgumentException and what are the details contained in this exception?

Are you using the 5.0+ APIs or the pre-5.0 APIs? I would recommend using the pre-5.0 APIs to help with more granular access to the Push Registration.

Garett
@garettBeuk
--
Goodbye everybody!
Contributor
ngoossens
Posts: 10
Registered: ‎11-09-2012
My Device: 9300

Re: Push registration: Network Error (Berr java.lang.IllegalArgumentException)

Hi Garett,

 

We were using SamplePushEnabledApp5_0.cod from the SDK but following your message also tried the other two (4_2 and 4_6) which both gave the same message. We will proceed with the older versions.

 

Was building on PhoneGap and WebWorks so just getting my Eclipse environment set up at the moment along with the code from the sample application to get more detail on which line is throwing the error and what additional detail it may contain. Will get back to you in the morning with some more information.

 

Thanks for all the help thus far.

 

Kind regards,
Nick

Contributor
ngoossens
Posts: 10
Registered: ‎11-09-2012
My Device: 9300

Re: Push registration: Network Error (Berr java.lang.IllegalArgumentException)

[ Edited ]

Hi All,

 

Just an update to anyone following this thread (I know there are some others with this problem, bomoko and this thread http://supportforums.blackberry.com/t5/Java-Development/Push-BPAS-rejected-registration-timeout-on-h...

 

We have tracked the problem down to a 503 (Service unavailable) error when trying to register with 

http://pushapi.eval.blackberry.com/mss/PD_subReg?serviceid=xxx-xxxxxxxxx&osversion=5.0.0.592&model=8... [removed mds dash public as not allowed in forum messages]

 

We get this using both the pre-5.0 APIs at httpConnection.getResponseCode(); and with the 5.0 APIs we get IllegalArgumentException in the onStatusChange(PushApplicationStatus status) method with the following data:

 

PushApplicationStatus
error="java.lang.IllegalArgumentException"
reason=1
status=8

 

Looking at those constants reason=1 (REASON_NETWORK_ERROR) status=8 (STATUS_FAILED) it seems that this is likely also because of a 503 error.

 

The settings we are using have been tested by gbeukeboom and work on the Bell network but seem to be giving an issue here in South Africa. I have tested on Vodacom and bomoko has tested on MTN.

 

Most recently we confirmed that BIS data is working by adding “;deviceside=false;ConnectionType=[removed mds dash public as not allowed in forum messages]” to the end of an ordinary request in a simple Java application.

 

So now we need to figure out why this 503 error is occurring. Any help or suggestions in this regard would be appreciated.

 

Kind regards
Nick

Retired
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10

Re: Push registration: Network Error (Berr java.lang.IllegalArgumentException)

This issue should now be resolved, please let me know if you continue to experience any issues with registering with the EVAL server.

Garett
@garettBeuk
--
Goodbye everybody!