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
New Developer
Posts: 35
Registered: ‎07-11-2009
My Device: Not Specified

Re: Push Messages Not Delivered Anymore.. However setup seems okay.. It worked before.

I found the exact line which throws the Exception @ PushLib43.java

Connector.open() returns null, which causes a NullPointerException to be thrown at Object o = socket.acceptAndOpen()

 

Looking at RIM Javadoc, Connector is not supposed to return null. *Except* , and I'm not sure about the meaning of this:

 

Platform specific behaviour with opening connections

On some RIM devices, if your application listens for incoming push connections using a StreamConnectionNotifier, you must append the "deviceside=false" parameter after the URL connection string. Without this parameter, the StreamConnectionNotifier returns null.

 

I can confirm that the demo app is appending deviceside=false;

 

Hope this helps.

L.

 

            try {

                socket = (ServerSocketConnection) Connector.open( url );

            } catch( IOException ex ) {

                // can't open the port, probably taken by another application

                onListenError( ex );

            }

 

            while( running ) {

                try {

                    Object o = socket.acceptAndOpen();

                    conn = (HttpServerConnection) o;

                    inputStream = conn.openInputStream();

                    pushInputStream = new MDSPushInputStream( conn, inputStream );

                    PushMessageReader.process( pushInputStream, conn );

                } catch( Exception e ) {

                    if( running ) {

                        Logger.warn( "Failed to read push message, caused by " + e.getMessage() );

                        running = false;

                    }

                } finally {

                    PushUtils.close( conn, pushInputStream, null );

                }

            }

 

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

Re: Push Messages Not Delivered Anymore.. However setup seems okay.. It worked before.

What's the value of "URL"? If it is malformed you will need to trace back to its creation to see why.

Garett
@garettBeuk
--
Goodbye everybody!
New Developer
Posts: 35
Registered: ‎07-11-2009
My Device: Not Specified

Re: Push Messages Not Delivered Anymore.. However setup seems okay.. It worked before.

I want to clarify that registration the first push always work. Subsequent pushes fail with NullPointerException.

 

Let me re-test in a moment.

 

 

New Developer
Posts: 35
Registered: ‎07-11-2009
My Device: Not Specified

Re: Push Messages Not Delivered Anymore.. However setup seems okay.. It worked before.

url variable content when exception has been thrown (replaced unpermitted content at the forum):

http://:31983;deviceside=false;ConnectionType=m**-p*****

 

Environment: BB 9810 OS 7

 

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

Re: Push Messages Not Delivered Anymore.. However setup seems okay.. It worked before.


luciano wrote:

I want to clarify that registration the first push always work. Subsequent pushes fail with NullPointerException.

 

Let me re-test in a moment.

 

 


The strange part is that:

Connector.open( url );

 

Should only ever get called once per app launch, it opens the connection then stays in the "while" loop indefinitely until the app closes. When you send multiple pushes do you re-launch the application in between? 

Garett
@garettBeuk
--
Goodbye everybody!
Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10

Re: Push Messages Not Delivered Anymore.. However setup seems okay.. It worked before.

Just to add to my last post, the Connector.open() call happens before any pushes can be listened for on the device, this registers the application to listen for the messages so the exception, if thrown from here, would be thrown independent of whether a push is received.

 

Could you please clarify?

Garett
@garettBeuk
--
Goodbye everybody!
New Developer
Posts: 35
Registered: ‎07-11-2009
My Device: Not Specified

Re: Push Messages Not Delivered Anymore.. However setup seems okay.. It worked before.

Yes sure.

 

At some point, the debugger starts missing breakpoints. This is a common issue I've been experiencing randomly through the years with numerous OS versions, devices and Eclipse plugin versions. So I've to close Eclipse, reopen, and reload app. That's how I manage to pass twice over Connector.open().

 

This strange breakpoint behavior can also be replicated using simulators.

 

Before reloading, I rebooted the device to ensure TCP is available. Doesn't work anymore.

 

Thanks.

 

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

Re: Push Messages Not Delivered Anymore.. However setup seems okay.. It worked before.

So reloading the app could be the issue as another instance of the app could still be in memory and listening on the same port. If you delete the app then reload it should start to work again. This could be a similar issue with the OS 5.0 APIs, the duplicate app tries to re-register with the system while traces of the original are still on the device. 

 

Could you confirm if the OS 5.0 issue is also triggered after a device reload?

Garett
@garettBeuk
--
Goodbye everybody!
Developer
Posts: 226
Registered: ‎10-01-2011
My Device: Passport

Re: Push Messages Not Delivered Anymore.. However setup seems okay.. It worked before.

To resolve this breakpoint issue, make sure your breakpoints pause the JVM not just the thread. You can configure this on each breakpoint.

When you get this issue and simply exit eclipse then restart the port is often still in use. I had this very same issue some months back and traced this as the cause.

One other point. I noticed on 7.0 that is I have a push pending on the MDS simulator, waiting for the phone simulator to start, when the phone simulator starts it seems to have an issue openning the port. After upgrading to 7.1 this issue is resolved.

New Developer
Posts: 35
Registered: ‎07-11-2009
My Device: Not Specified

Re: Push Messages Not Delivered Anymore.. However setup seems okay.. It worked before.

It's true that the app starts working again if you delete it and reload. After reloading, works for first push then starts failing. Problem not solved.

 

What do you mean with device reload?  reloading the OS ?

Sorry I also don't uderstand what "traces of the original app" means.

 

I've noticed the very same problem on two different devices, OS5@8900, OS7@9810 .

 

Thanks.