Meaningless Drivel is fun!*
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

Glenn Castro
Ranch Hand

Joined: Aug 24, 2003
Posts: 78
Hi everyone!
I got the following exception when running my application:
javax.microedition.io.ConnectionNotFoundException: The requested protocol does not exist http://192.168.0.6:3250/link/j2me
How can I resolve this problem?


Glenn Castro<br />Sun Certified Web Component Developer
Gurpreet Saini
Ranch Hand

Joined: Jun 09, 2002
Posts: 295
Hi there,
You are facing the same problem as I was. First, You cannot test your J2ME application on J2SE. Second, You must extend Midlet class and test it on J2ME wireless toolkit supplied by Sun microsystems. You can download this toolkit from java.sun.com website. It is free. . Once your code works fine then you can download it to the cell phone and execute the program which supports Java API.
gurpreet
Glenn Castro
Ranch Hand

Joined: Aug 24, 2003
Posts: 78
Originally posted by Gurpreet Saini:
Hi there,
You are facing the same problem as I was. First, You cannot test your J2ME application on J2SE. Second, You must extend Midlet class and test it on J2ME wireless toolkit supplied by Sun microsystems. You can download this toolkit from java.sun.com website. It is free. . Once your code works fine then you can download it to the cell phone and execute the program which supports Java API.
gurpreet

Hi, thanks for your reply.
I am using the wireless toolkit in compiling and preverifying the code and it does not produce any exceptions or errors. When I run it on the emulator it produces the javax.microedition.io.ConnectionNotFoundException. Of course I extends my class to MIDlet and use only the classes from J2ME and not J2SE.
Michael Yuan
author
Ranch Hand

Joined: Mar 07, 2002
Posts: 1427
Maybe it will help if you post the code that causes the problem. Also, you should make sure that your MIDlet security system is not blocking the connection (set the emulator to trust any MIDlet).


Seam Framework: http://www.amazon.com/exec/obidos/ASIN/0137129394/mobileenterpr-20/
Ringful: http://www.ringful.com/
Glenn Castro
Ranch Hand

Joined: Aug 24, 2003
Posts: 78
Originally posted by Michael Yuan:
Maybe it will help if you post the code that causes the problem. Also, you should make sure that your MIDlet security system is not blocking the connection (set the emulator to trust any MIDlet).

Thanks Michael for your reply.
This is the exception i got when running the application on WTK.
java.lang.SecurityException: Application not authorized to access the restricted API
How can I setup the MIDlet security system so that it will allowed the necessary permission.
Glenn Castro
Ranch Hand

Joined: Aug 24, 2003
Posts: 78
Still got this problem after setting up midlet permission on http
java.lang.SecurityException: Application not authorized to access the restricted API
at com.sun.midp.security.SecurityToken.checkIfPermissionAllowed(+40)
at com.sun.midp.security.SecurityToken.checkIfPermissionAllowed(+7)
at com.sun.midp.midletsuite.MIDletSuiteImpl.checkIfPermissionAllowed(+8)
at com.sun.midp.midlet.MIDletState.<init>(+66)
at javax.microedition.midlet.MIDletProxy.<init>(+5)
at javax.microedition.midlet.MIDlet.<init>(+13)
at com.kmunications.client.midp.KmunicationsLinkMidlet.<init>(+4)
at com.kmunications.client.midp.ui.UIController.<init>(+35)
at com.kmunications.client.midp.KmunicationsLinkMidlet.startApp(+19)
at javax.microedition.midlet.MIDletProxy.startApp(+7)
at com.sun.midp.midlet.Scheduler.schedule(+266)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+116)
What should i do?
Michael Yuan
author
Ranch Hand

Joined: Mar 07, 2002
Posts: 1427
In start --> J2ME WTK --> Prepferences window, select the "security" tab and set security domain to "untrusted".
Glenn Castro
Ranch Hand

Joined: Aug 24, 2003
Posts: 78
Originally posted by Michael Yuan:
In start --> J2ME WTK --> Prepferences window, select the "security" tab and set security domain to "untrusted".

Hi Michael,
I set the security domain to untrusted but have the same result.
I sent the code in private message and i hope you can help me solve this problem.
Thanks
Michael Yuan
author
Ranch Hand

Joined: Mar 07, 2002
Posts: 1427
I cannot see any further problem with your code. Can you write a simple network MIDlet to fetch the homepage of google.com and see if it works? That is to make sure that your system is setup correctly.
Glenn Castro
Ranch Hand

Joined: Aug 24, 2003
Posts: 78
I created a simple class that connects to the homepage of google and it execute successfully.
I tried to change the url of the code that i gave you but it produces the same problem:
javax.microedition.io.ConnectionNotFoundException: The requested protocol does not exist http://www.google.com
at javax.microedition.io.Connector.open(+61)
at javax.microedition.io.Connector.open(+6)
at com.kmunications.client.api.connector.http.j2me.J2MERequestSender$J2MEHttpSender.run(+39)
Michael Yuan
author
Ranch Hand

Joined: Mar 07, 2002
Posts: 1427
OK, then I would build a simple MIDlet to fetch a single page from your target server (the http://192.168.0.6:3250/xxxx). The idea is to isolate problems and test them one by one until it breaks.
M Rana
Greenhorn

Joined: Sep 21, 2004
Posts: 2
Hi,

I am having the same problem,
Please if you have found a solution, help me.

Rana
alvin simon
Greenhorn

Joined: Dec 09, 2004
Posts: 1
there is a file in emulator's directory. (prefsw.exe) Run it and open security options. Change untrusted to trusted.
Maddi Ranjan
Greenhorn

Joined: Jun 05, 2005
Posts: 19
Make it trusted from untrusted
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ConnectionNotFoundException