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
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
posted
0
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.
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).
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
posted
0
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
posted
0
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
posted
0
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
posted
0
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
posted
0
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
posted
0
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.