Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

No Network Connection

 
Stephan Bardubitzki
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have developed a midlet and a web application and have tested both successfully on my development machine using NetBeans 5.5 and WTK2.2. After uploading the web app to my server I could download the midlet via OTA to my Motorola RAZR V3c without problems.

I can navigate through the midlet and when I try to connect to the server I'm being asked to permit the network access, but can't retrieve any data afterwards. Looking at Tomcat's log files there are no exception thrown at all.

The midlet is not signed yet, but this should not be the problem I think.

At the moment I haven't any clue what I'm missing or did wrong.

I hope someone can help out.

Thanks in advance.

Stephan
 
Faraz Masood
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you post the code so that we can have some clues , how are you reading the data !!

I think that after opening the connection , you are not waiting enough for the stream to be available (connectivity via mobile device is much slower than the emulator on PC)

so I suggest waiting a while for the stream , by doing something like that

is = conn.openInputStream();

while(is.available < 0){
// no data to read , so keep waiting
}

readData(is);
 
Stephan Bardubitzki
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,

since the midlet doesn't seem to hit the server there is no input stream to read from.

On my development machine everything works as supposed. The midlet connects to the server via HTTP, the servlet forwards the request to a handler which in turn queries the back-end database. The servlet then response with the requested data as expected. The only difference between the local and the server version are some custom attributes in the .jad file, but I can assure you they have been made correctly.

When I'm being asked to permit the network connection I get the
following output on the cell phone:
"The application wants to exchange information
with //www.mydomain.com/myservlet ..."
As you can see the http: prefix is missing, but I don't know why and
whether this could be a hint for the problem.

Thanks.

Stephan
 
Stephan Bardubitzki
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I could trace back IOExceptions on the real device and the midlet doesn't throw any IOException, getResponseCode() returns -1 and the server never got hit. Meanwhile it seems to me it is a problem originated on the carriers network(1X), but Bell Mobility here in Canada doesn't has a developer forum or a "contact us" page on its developer website.

I tried both domain name and static IP to connect to the server but no difference.

Here is the code which handles HTTP:


Any suggestions are highly appreciated.

Thanks.
Stephan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic