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

Java Development

Reply
BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: MIDP and DNSException

Are you able to reproduce this using the httpdemo included with the BlackBerry JDE?  If not, can you post a code snippet of your implementation that triggers this exception?  What carrier(s) are you seeing this on?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 10
Registered: ‎02-12-2009
My Device: Not Specified

Re: MIDP and DNSException

Hello Mark,

 

I'll try to get any testresults with the httpdemo.

We are getting this issue with Vodafone DE and T-Mobile DE, but only near the Airport. We can't reproduce this issue in our office. I think it is due to a higher load of the carriers network at the airport (A lot of people checking mails etc. while they are waiting for their plane).

 

The code looks as follows:

 

HttpConnection conn = null; DataInputStream istream = null; DataOutputStream ostream = null; try { // ... conn = _$createConnection(_syncURL); ostream = conn.openDataOutputStream(); if(_delegate.request(ostream) == false) // this writes data to the output stream // close the output stream as early as possible ostream.close(); ostream = null; code = conn.getResponseCode(); istream = conn.openDataInputStream(); if(_delegate.response(istream) == false) // response reads from the input stream and processes the data return; // close the output stream as early as possible istream.close(); istream = null; } finally { // close the input stream if open if(istream != null) { try { istream.close(); istream = null; } catch(Exception e) {} } // close the output stream if open if(ostream != null) { try { ostream.close(); ostream = null; } catch(Exception e) {} } // close the connection if(conn != null) { try { conn.close(); conn = null; } catch(Exception e) {} } } private final HttpConnection _$createConnection(String url) throws IOException { if(url == null) throw new MobileException(MobileException.CODE_SYNCURL, "no sync url available"); Connection c = Connector.open(url); try { if((c instanceof HttpConnection) == false) { c.close(); throw new MobileException(MobileException.CODE_HTTP, "no http connection: " + c); } HttpConnection conn = (HttpConnection) c; conn.setRequestMethod(HttpConnection.POST); return conn; } catch(IOException e) { if(c != null) { c.close(); // close because c hasn't been returned yet } throw e; } catch(Exception e) { if(c != null) { c.close(); // close because c hasn't been returned yet } throw new MobileException(MobileException.CODE_HTTP, "Unknown error while connecting: " + e.toString()); } }

As you can see, all streams and connections are being closed. The Connections uses HTTP Post. We tested the device with URL's in the following format:

http://1.2.3.4/MyServer/sync?user=5

 

http://1.2.3.4/MyServer/sync?user=5;deviceside=true

http://mydomain.com/MyServer/sync?user=5

http://mydomain.com/MyServer/sync?user=5&random=8d9elw

http://mydomain.com/MyServer/sync?user=5;deviceside=true

http://mydomain.com/MyServer/sync?user=5&random=8d9elw;deviceside=true

 

It works fine when we are using the IP Address and not the domainname. If we use the domainname of our server then we have devices running into this issue - even if we use deviceside=true or anything...

We also tried to append a random string to the url, so that errors don't get cached, but unfortunetaly it recognizes it as the same domain. Once a call to mydomain.com fails, no further calls to it are possible, even if the URL changes.

 

I hope this helps,

Christian

 

 

 

 

 

BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: MIDP and DNSException

Do you receive the exception for other domains, or just when connecting to the same one?  If this only occurs in a certain geographic region, it sounds like a network issue and not something to do with your application.

 

You could try connecting over a different route other than direct TCP when you receive this exception.  You can see the options available here:

 

What Is - Different ways to make an HTTP or socket connection
Article Number: DB-00396

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_Is...

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 10
Registered: ‎02-12-2009
My Device: Not Specified

Re: MIDP and DNSException

[ Edited ]

Yes, we tried using deviceside=true/false. Both produces the DNSException. Wifi connections are not available, so we can't try that.

 

And yes, the root cause of this error must be some kind of network error.We tested the internet connection at this location and it turned out to be pretty bad. Every 5th connection seems to fail.

 

Nevertheless, the Blackberry should not get into this state where it refuses to do any further connections.

 

Like I said before: The problem is that the device refuses to do any further requests, once a DNS-Request fails due to a network error.

 

btw: I googled a bit for this issue, and I found people complaining about this in 2005. This must be known issue. I would be glad if you could tell me whether this issue this issue is known or not. Even if it means that this bug won't be fixed.

 

Thanks for your help,

Christian

Message Edited by christian1234 on 02-26-2009 07:03 PM
BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: MIDP and DNSException

Can you confirm if you receive the exception for other domains, or just when connecting to the same one?

 

Are you able to make connections using the BlackBerry Browser when the device is in this state?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 10
Registered: ‎02-12-2009
My Device: Not Specified

Re: MIDP and DNSException

It happens on our regular domain and also on a dyndns account I created for testing.

 

When this error occurs, we are still able to use to the WebBrowser.

Developer
Posts: 163
Registered: ‎07-16-2008
My Device: Not Specified
My Carrier: Sprint

Re: MIDP and DNSException

We have encountered this issue as well.

With us, it is affecting users on Wi-Fi connections.  They receive the DNS error, and then all further connections that the application makes within a period of time will automatically fail with the DNS exception.

A client has reported that he is able to go to Options->Mobile Network->Tools->DNSLookup->Clear DNS Cache to fix the issue.

 

Other devices on the network are able to hit the addresses that the affected BlackBerry will receive DNS errors on.

Andrew Cowart | Metova
www.metova.com
Developer
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: MIDP and DNSException

I'd pretty much started blaming the carriers for this...

Can you verify this is a DNS caching problem with BB? The other BB products would still work

if they have a proxy somewhere or do a different name lookup that doesn't get corrupted.

 

New Developer
Posts: 10
Registered: ‎02-12-2009
My Device: Not Specified

Re: MIDP and DNSException

Hi marchywka,

 

 

"I'd pretty much started blaming the carriers for this..."

Well, networks can always fail. But the BB should not lock up his DNS client.


"Can you verify this is a DNS caching problem with BB? The other BB products would still work if they have a proxy somewhere or do a different name lookup that doesn't get corrupted."
I could imagine that BB products have workarounds for that, or maybe they use IP adresses internally not domain names.

 

cheers,

Christian

New Developer
Posts: 10
Registered: ‎02-12-2009
My Device: Not Specified

Re: MIDP and DNSException

Hi Andrew,

 

Thanks for the tip. I'll try the Clear DNS Cache as soon as I get one of devices into my hands...

 

btw: It's  quite interesting to hear that the problem also occurs when using Wifi connections.

 

regards,

Christian