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

 
Glenn Castro
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Gurpreet Saini
Ranch Hand
Posts: 295
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1427
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Glenn Castro
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1427
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In start --> J2ME WTK --> Prepferences window, select the "security" tab and set security domain to "untrusted".
 
Glenn Castro
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1427
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1427
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

Rana
 
alvin simon
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there is a file in emulator's directory. (prefsw.exe) Run it and open security options. Change untrusted to trusted.
 
Maddi Ranjan
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make it trusted from untrusted
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic