Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Java Micro Edition and the fly likes ConnectionNotFoundException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "ConnectionNotFoundException " Watch "ConnectionNotFoundException " New topic
Author

ConnectionNotFoundException

moh sak
Ranch Hand

Joined: May 11, 2005
Posts: 78
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

Joined: Jul 19, 2005
Posts: 44
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


Thanks,<br />Debojit Nag
moh sak
Ranch Hand

Joined: May 11, 2005
Posts: 78
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

Joined: Aug 16, 2005
Posts: 9
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

Joined: May 11, 2005
Posts: 78
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

Joined: Aug 16, 2005
Posts: 9
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

Joined: May 11, 2005
Posts: 78
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

Joined: May 11, 2005
Posts: 78
Hi ,

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


thanx in advance
moh sak
Ranch Hand

Joined: May 11, 2005
Posts: 78
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

Joined: Jan 22, 2004
Posts: 401
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

Joined: May 11, 2005
Posts: 78
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
 
subject: ConnectionNotFoundException