• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in Connecting Application on J2ME WT Emulator with Servlet on Tomcat

 
Nauman Aftab
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a problem of establishing a Connection with MIDLET using
J2ME Wireless Toolkit 2.0 . The Code is right. I am getting this warning on the toolkit ...


Warning: To avoid potential deadlock, operations that may block, such as
networking, should be performed in a different thread than the
commandAction() handler.

and when i run the MIDLET on Emulator, the emulator stucks by giving my four uptions..

ABC wants to send information. this will require airtime which will cost money. IS this OK?

1.Yes Always, Donot ask again.
2.This time, Ask me next time. (Default Selected)
3. Not this time, Ask me next time.
4. Shut down Application

I have this msg and my Emulator stucks. I press the OK button but nothing happens.

If somebody will help me i will be thankful. I am trying my Midlet to get some date using servlet on Tomcat
 
Michael Yuan
author
Ranch Hand
Posts: 1427
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to do exactly what WTK told you to do: put the network code in a separate thread and start that thread from commandAction() (as opposed to do the networking inside the commandAction() method).
 
Nauman Aftab
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Michael Yuan,

Thank you for your suggestions. I have tried this with thread and i got it right this time . I am also looking forward to read your book. Hope it will help me to increase my knowledge toward Mobile Commerce.

Bye
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic