File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ConnectionNotFoundException

 
moh sak
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

i am new to j2me and i am trying to open httpConnection and check the status when i try it on the emulator it works realy great but when i run it on my sonyericsson k500i it takes a long time trying to connect to the url and then exception thrown "ConnectionNotFoundException "

here is my code :



can any one help me ?? i am using midp 2.0

thanx in advance
 
Debojit Nag
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
It seems to work fine. Apparantly what I feel the reason behind the exception is at the http open connection line. The connection is opened in READ_WRITE mode. But the server may not give u the WRITE access permission. So better to open it READ mode. Let me know what happens?

Debojit
 
moh sak
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanx for you replay, i'll let you know as soon as i can. but it seems that i finish the work today and i am going home so i'll send the replay tomorow

thanx again
 
sailesh sirari
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


i think you haven't used the way of sending request

try adding

hc.setRequestMethod(HttpConnection.POST)

or whatever your servlet accepts.

 
moh sak
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,thanx for your replays, i tried both solutions and i still have the same problem with the same exception !!!


any other ideas to do ??


thanx for replay again

i realy need to know what is the problem to stay working in the company that i am working in now please help!!!


 
sailesh sirari
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

if your code is working fine on emulator i think

u should call that connection on seperate thread and put a timer also if

possible ,

try to call the connection inside run() or on a seperate class then make a

thread of that class inside your event or whatever logic u have

try this thread concept and see if it helps.
 
moh sak
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again , i did the Thread thing and i still have the same problem !!!


here is the MIDlet class Code :



here is the Thread Class code :






thanx for help, more ideas realy important

 
moh sak
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

Is there any more ideas or what ?? any one say something please!!


thanx in advance
 
moh sak
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

no one replay on this problem any more ! is that mean that there is no more solution to send ?? however i read in some article that i must check the internet access protocolof my phone but i did not know what are these settings that i sould make ??
i have sonyericsson k500i. please can any one help ?? not only n the internet settings but in the whole problem

thanks in advance
 
James Hodgkiss
Ranch Hand
Posts: 401
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe you haven't set which Internet Profile the phone should use for Java HttpConnections.

To do this, from the phone's main menu, select 'Connectivity, 'Settings for Java'. The Internet Profile you use will need to be associated with an appropriate 'Data Account'.

You may be better of creating a new Internet Profile and Data account from scratch. A good resource for the settings you will need is http://www.taniwha.org.uk/gprs.html .

Cheers,
James
 
moh sak
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
thanx for your replay, i find out that the connection cann't be made using the wab gprs but it works fine when i use the web gprs.
so is there any way to make it work through the wab by editting the settings from the j2me application ?!!


thanx in advance and thanx again for your replay.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic