My MIDlet can't open an HTTP connection

I'm trying to get a MIDlet to open a connection with a server on another machine. But I can't get beyond a ConnectionNotFoundException that gets thrown. I've googled the web and Sun's site every which way I can looking for the answer to a similar experience somebody else may have had, but not found an answer. So I'd like to present the problem here in the hope that somebody might be able to help.
Here's what information I have...
* I'm developing using NetBeans 3.6 on Win2KP.
* I'm using WTK2.1 as downloaded from Sun's web site.
* The MIDlet is configured as CLDC 1.1, MIDP 2.0 will the Wireless Messaging, Mobile Media and J2ME Web Services optional libraries selected.
* I've gotten the same behavior with no MIDlet permissions specificed in the jad and with all combinations of the following permissions...
javax.microedition.io.Connector.comm
javax.microedition.io.Connector.http
javax.microedition.io.Connector.https
javax.microedition.io.Connector.socket
javax.microedition.io.Connector.ssl
* I've run the wireless toolkit network monitor, but no activity shows up.
* The debug machine I'm testing this on is on the same subnet as the server I'm trying to connect to and neither machine has any kind of IP filters or firewall enabled.
* The server is definiately running on the machine having address 192.168.0.102. and the server has a listen waiting on port 9700 of that machine.
I've tried to distill the problem down as much as I can. And in so doing I'm left with this...
import javax.microedition.midlet.*;
import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;
public class MyMidlet extends MIDlet implements CommandListener {
     public MyMidlet() {
          System.out.println("Midlet constructor called.");
          try {
                    int                    code;
                    HttpConnection     conn     = (HttpConnection) Connector.open("http://192.168.0.102:9700/unknown-unknown?0,-1,http://192.168.0.102:9700/EndpointService:jxta-NetGroup/uuid-DEADBEEFDEAFBABAFEEDBABE0000000F05/pid", Connector.READ_WRITE);
                    conn.setRequestMethod(HttpConnection.GET);
                    conn.setRequestProperty("Connection", "close");
                    conn.setRequestProperty("Content-Length", "0");
                    code = conn.getResponseCode(); // Throws exception
          catch (Exception e) {
                    System.out.println("getResponseCode() failed: " + e + ".");
                    e.printStackTrace();
     public void startApp() {
     public void pauseApp() {
     public void destroyApp(boolean aUnconditional) {
     public void commandAction(Command aCmd, Displayable aDisplayable) {
Here's the output from the i/o pane of the MIDlet...
c:\WTK21\bin\emulator -Xdebug -Xrunjdwp:transport=dt_socket,address=5500,server=y -Xdevice:DefaultColorPhone -Xdescriptor:"Z:\Projects\Project\MyProject.jad"
Connecting to 127.0.0.1 on port 2800
Waiting for debugger on port 5500
KVM not ready
Running with storage root DefaultColorPhone
Connection received.
Midlet constructor called.
getResponseCode() failed: javax.microedition.io.ConnectionNotFoundException: TCP open.
javax.microedition.io.ConnectionNotFoundException: TCP open
at com.sun.midp.io.j2me.socket.Protocol.connect(+99)
at com.sun.midp.io.ConnectionBaseAdapter.openPrim(+52)
at com.sun.midp.io.j2me.socket.Protocol.openPrim(+108)
at com.sun.midp.io.ConnectionBaseAdapter.openPrim(+14)
at com.sun.midp.io.ConnectionBaseAdapter.openPrim(+8)
at com.sun.midp.io.j2me.http.Protocol.connect(+73)
at com.sun.midp.io.j2me.http.Protocol.streamConnect(+57)
at com.sun.midp.io.j2me.http.Protocol.startRequest(+12)
at com.sun.midp.io.j2me.http.Protocol.sendRequest(+38)
at com.sun.midp.io.j2me.http.Protocol.sendRequest(+6)
at com.sun.midp.io.j2me.http.Protocol.getResponseCode(+8)
at com.momentiv.midp.MyMidlet.<init>(+56)
at java.lang.Class.runCustomCode(+0)
at com.sun.midp.midlet.MIDletState.createMIDlet(+19)
at com.sun.midp.midlet.Selector.run(+22)
I've seen that others have experienced the same exception. But none of their postings have ever gotten a useful response beyond, "make sure the workstation you're debugging on is connected to the internet and that the machine it is trying to connect to is not on the other side of a firewall."
Any help is greatly appreciated.
Sparky

Could it be the MIDP security mechanism?
Try opening the connection in a separate thread
Otherwise the UI freezes and the MIDP security mechanism won't let you "get out". If it works ok with the security, you should probably be getting the confirmation dialog that "midlet X is trying to use airtime...Is that OK?"

Similar Messages

  • What is the best way to open a HTTPS connection?

    What is the best way to open a HTTPS connection and retrieve the content as XML? This is how most of the online API is done nowadays, how can this be done on the iphone SDK?
    Thanks

    Have a look at the SeismicXML example that comes with the iPhone SDK. It uses http instead of https but it may work for you.
    You can also look at the NSURLRequest and NSURLConnection classes.
    Enjoy.

  • RV120W can't open web management, can't open SSH/http to server on LAN port

    Hi,
    I just buy cisco RV120W, but seem I found alot of issue. Hope some one can help.
    Topology:
    Internet------RV120W(192.168.1.1/24)--------(192.168.1.5/24)PC
                          |---------------(192.168.1.2)L3switch(10.10.10.1/24)--------(10.10.10.2/24)Server
    Here is the issue:
    1. from PC after I login to 192.168.1.1 the WEB can't be opened. it show as web server not responding. I have try with 3browser 2PC but all same. But I use HP it can be opened.
    2. on RV120W I added static route and now I from PC I can ping to Server. I can telnet but SSH/HTTP always failed.
    On firewall I never set anything, all is permited.
    I try version 1.0.3.10 and 1.0.4.10 but all same.

    Hi Bernadi, thank you for using our forum, my name is Luis I am part of the Small business Support community. I have some question for you:
    1.1) What kind of computer are those that didn't work?
    1.2) If you connect those, are you receiving an IP address from DHCP?
    1.3) What gateway is showing?
    2.1) Do you have any debug or error?
    2.2) Did you try creating an Forwarding rule for 443 to the server address?
    I recommend you always use the last firmware.
    I hope you find this answer useful
    Greetings,
    Luis Arias.
    Cisco Network Support Engineer.

  • Safari can't open a site-connection to server error-help,

    Hi, having problems opening one page. "Read", one page only. All other sites open fine. When I try to connect to this site I get the error:
    Safari can’t open the page “http://offres.neuf.fr/offres/internet/Nos-offres-ADSL.html?cmp=OF100” because it could not connect to the server “offres.neuf.fr”.
    I used to be able to open this page fine. I tried it on another computer, no problem, and a response in another very long link indicated "he" could open it fine. Anybody have an idea why this page is being so stubborn and giving me this error? Thanks. Hope to hear a fix.
    M

    What will happen if I empty the cache and clear the history in Safari?
    Will I lose all the info stored when I visit sites, and have to retype?
    NO, You will not lose your Autofill preferences ( found in Safari's Preferences/Auto fill tab ) they are not affected if you empty cache and clear history.
    "Reset Safari" would affect the user name & passwords stored in Autofill.
    ~•~
    Matthew, your welcome; ), is this the only site you can not access?
    Please try the site In another account. If you do not have another account please create a test account:
    Go to System Preferences/ Accounts/Login Options use the [+] to make one. you can later remove it with the [-] if you choose to.
    Login into that account can you access the site there?
    This helps to narrow down the problem, by showing us if it is a system wide issue or user name specific.
    Eme: )

  • Opening an https connection from within a Servlet.

    I am having problems trying to establish an HTTPS connection to a servlet from within a different servlet.
    I get the java.net.MalformedURLException: unknown protocol: https. SSL is setup for the web server. Direct connections from the browser to a servlet work fine with SSL, but a connection from one servlet to another servlet fails. I'm stumped. Is there a separate SSL install/configuration required for the servlet engine? Could anyone explain?

    When you set up SSL enabled web server, you should be getting a trust cert file that knows the hand shake protocol to talk to that server. Once you have that file, you can load that file from that servlet using System.load and then you would be able to talk to anything that runs on that SSL enabled Web server.
    Also you must have JSSE jar files installed in your system .
    Check out this url:
    http://java.sun.com/products/jsse/INSTALL.html
    Let me know if you still have problems

  • Can't open a new connection

    it is not possible to open a new connection: contribute answers: is used by the connection "http:xx", give another internet-address.
    what do i have to do to open again.
    i reinstalled contirbute 4, doesnt work.
    i tried contribute 6.5, doesnt work.
    thanks for help!
    r.f.

    thanks! r.

  • Safari can't open any https or secure web page

    I am running OS 10.3.9 and Safari 1.3.2. Today I can not load any https sites with Safari but able to open these pages with IE. I have try to empty cache without success. Please help.
    Imac G5   Mac OS X (10.3.9)  

    I am having the exact same problem. This is new. All of a sudden I cannot get into any https sites! Has anyone figured this out? Tech support, any suggestions?

  • How can I open an AS400 connection w/o using the ODBC in the Control Panel

    Hi.
    Is it possible that i manipulate the ODBC settings in Windows NT using Java?
    I've been using the Client Access ODBC Driver (32 bit) of IBM to connect to AS400 database. Normally i would just configure my DSN and input the default library inside the Server tab that i would be using . All was working perfectly. But i was informed that the default library would vary depending on the data inputed in the library database.
    As in, in our SQL Server they have there a tbl_library where in lib_type is one of it's field. This(lib_type) is where they can specify which library my program would be opening. So in this case, I can't just manually configure my DSN library when retrieving data from AS400 because it would always vary.
    Thank you very much for your time.
    -marlin
    ps.
    Btw, i am doing a servlet for this connectivity.

    If you use the JDBC driver that's included in the AS/400 Toolbox for Java you don't need to use ODBC at all, you can access the AS/400 directly. See this link:
    http://www-1.ibm.com/servers/eserver/iseries/toolbox/

  • Can AMS establish persistent https connection?

    I am wondering if AMS is able to make a connection through https that can remain persistent. Are there any gotchas or special considerations to using https as opposed to http? We want to switch to https, but due to the overhead in the handshake, want to keep a persistent connection to send data at random times.

    So from what I can tell, FMS just isn't set up to do this. It looks like if you want security they want you to use rtmps through ssl. There may be some other ways to do it, but https doesn't seem to be officially supported and I can't find anyone able to do it successfully.
    The WebServices class definitely can't do it. I tried the LoadVars class, which works great on an http page, but fails to do anything with https. It won't even throw an error.
    here's a few random pages I looked through, though none of them give any solid info:
    http://forums.adobe.com/thread/773705 - says it's possible to flash but the config xml stuff they're talking about seems to be just for rtmps, not https
    http://forums.adobe.com/message/3704669 - also says it's possible to do dual connections, one https, but looks like they may have meant rtmps instead of https
    these guys seem to be saying it's not possible:
    http://stackoverflow.com/questions/5619776/webservice-and-fms 
    //seems to think it can be done, but again, looks like they're talking about ssl over rtmp
    http://nycphotoshop.groups.adobe.com/index.cfm?event=post.display&postid=5194
    someone trying to make it work but never does:
    http://forums.adobe.com/thread/782037?decorator=print&displayFullThread=true

  • IPod works well with Mac but Windows can't Open it when connected

    My iPod details: Capacity - 74.37GB, Software Version - 1.3, Format - Windows (MS-DOS FAT 32 format)
    MAC details given below.
    PC details - Windows XP, Service Pack 3.
    My iPod was formatted to work with Windows and Mac as I only had a PC when I bought it. It's been working quite well since I bought it and later with the Mac too. However, since the past few weeks, when plugged in to a PC via USB, the iPod is recognised as a folder and fails to OPEN or be EXPLOREed. The only thing allowed is a SEARCH option which helps me transfer files between PC and MAC.
    Help guys!

    There may or may not be a physical fault with the WD drive, but Macs can read but not write to NTFS disks unless you use a third party driver like Paragon NTFS for Mac, or NTFSMounter.
    Your post seems to imply that before the current problems it used to be OK (ie you could read and write to it). Have you got NTFS for Mac or similar?
    Did you have a reson for formatting NTFS? Mac drives are formatted HFS+. If you want Windows to read Mac disks you can install MacDrive in Windows, and Paragon HFS for Windows.

  • ITunes store can not open because the "connection was reset"

    I keep getting this message when I try to access the store. It says that the connection was reset and to make sure my internet connection is active. My internet IS active and I have downloaded the latest version of iTunes. Please help.
    Thanks,
    Caroline

    Okay here it is, thanks for the help!
    Microsoft Windows Vista Home Premium Edition Service Pack 1 (Build 6001)
    Gateway M-6816
    iTunes 9.2.1.5
    QuickTime 7.6.6
    FairPlay 1.8.20
    Apple Application Support 1.3
    iPod Updater Library 9.2d4
    CD Driver 2.2.0.1
    CD Driver DLL 2.1.1.1
    Apple Mobile Device 3.1.0.62
    Apple Mobile Device Driver 1.49.0.0
    Bonjour 1.0.5.11 (214.3)
    iTunes Serial Number
    Current user is not an administrator.
    The current local date and time is 2010-08-09 17:24:46.
    iTunes is not running in safe mode.
    WebKit accelerated compositing is enabled.
    HDCP is not supported.
    Video Display Information
    Intel Corporation, Mobile Intel(R) 965 Express Chipset Family
    Intel Corporation, Mobile Intel(R) 965 Express Chipset Family
    ** External Plug-ins Information **
    No external plug-ins installed.
    iPodService 9.2.1.5 is currently running.
    iTunesHelper 9.2.1.5 is currently running.
    Apple Mobile Device service 3.1.0.0 is currently running.
    ** Network Connectivity Tests **
    Network Adapter Information
    Adapter Name: {9A3FCC4C-2719-4A50-8C7D-CE45E2EC7898}
    Description: Intel(R) PRO/Wireless 3945ABG Network Connection
    IP Address: 10.0.0.5
    Subnet Mask: 255.255.255.0
    Default Gateway: 10.0.0.1
    DHCP Enabled: Yes
    DHCP Server: 10.0.0.1
    Lease Obtained: Mon Aug 09 16:58:11 2010
    Lease Expires: Tue Aug 10 09:14:29 2010
    DNS Servers: 10.0.0.1
    10.0.0.1
    Adapter Name: {4D02B4E3-A221-4A85-9C6E-2C9F603265F5}
    Description: Realtek RTL8101 Family PCI-E Fast Ethernet NIC (NDIS 6.0)
    IP Address: 0.0.0.0
    Subnet Mask: 0.0.0.0
    Default Gateway: 0.0.0.0
    DHCP Enabled: Yes
    DHCP Server:
    Lease Obtained: Wed Dec 31 18:00:00 1969
    Lease Expires: Wed Dec 31 18:00:00 1969
    DNS Servers:
    Active Connection: LAN Connection
    Connected: Yes
    Online: Yes
    Using Modem: No
    Using LAN: Yes
    Using Proxy: Yes
    HTTP Proxy: 127.0.0.1:5555
    SSL 3.0 Support: Enabled
    TLS 1.0 Support: Enabled
    Firewall Information
    Windows Firewall is on.
    iTunes is enabled in Windows Firewall.
    Connection attempt to Apple web site was unsuccessful.
    The network connection was reset.
    Connection attempt to iTunes Store was unsuccessful.
    The network connection was reset.
    Secure connection attempt to iTunes Store was unsuccessful.
    The network connection timed out.
    Secure connection attempt to iPhone activation server unsuccessful.
    The network connection timed out.
    Last successful store access was 2010-06-18 17:01:11.

  • Can't open fly transfer connection on computer

    purchased fly transfer (transfers pictures, documents, etc. via wifi.) url code does not open app on computer. attemped to contact app support. no response so far. help

    Error "Licensing has stopped working" | Mac OS

  • Can't open HTTP connection to a proxied server

    Greetings,
    Trying to open an HTTP connection to a web server. The connection is rejected
    by the proxy. In order to bypass the proxy, I used to code something like:
    System.setProperty("http.proxyHost", hostname) ;
    System.setProperty(“http.proxyPort”, port);
    Doing that, works properly in a standalone Java application. As soon as the same
    code is implemented in a WebLogic 8.1 deployed EJB, it fails with the following
    stack dump:
    <May 10, 2004 7:12:07 PM CEST> <Info> <net> <000903> <Could not open connection
    with host: www.rect.cofacescrl.com and port: 80.>
    04-05-10 19:12:07,788 FATAL SearchCompanyBean - Error while attempting to connect
    to Source
    java.net.ConnectException: Tried all: '1' addresses, but could not connect over
    HTTP to server: 'www.rect.cofacescrl.com', port: '80'
    at weblogic.net.http.HttpClient.openServer(HttpClient.java:255)
    at weblogic.net.http.HttpClient.openServer(HttpClient.java:307)
    at weblogic.net.http.HttpClient.<init>(HttpClient.java:126)
    at weblogic.net.http.HttpClient.New(HttpClient.java:192)
    at weblogic.net.http.HttpURLConnection.connect(HttpURLConnection.java:115)
    at com.coface.STR.scrl.ScrlSearchAdapter.search(Unknown Source)
    at com.coface.STR.tuxedo.SearchCompanyBean.service(Unknown Source)
    at com.coface.STR.tuxedo.SearchCompanyBean_fbx9fb_EOImpl.service(SearchCompanyBean_fbx9fb_EOImpl.java:46)
    at com.coface.STR.tuxedo.SearchCompanyBean_fbx9fb_EOImpl_WLSkel.invoke(Unknown
    Source)
    at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:159)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:263)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:230)
    at com.coface.STR.tuxedo.SearchCompanyBean_fbx9fb_EOImpl_WLStub.service(Unknown
    Source)
    at weblogic.wtc.gwt.InboundEJBRequest.execute(InboundEJBRequest.java:419)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:234)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:210
    Suggestions anybody before my boss gets nervous about that ?
    Many thanks in advance,
    Alexandre CUENCA

    I think the data you are seeing is part of the telnet negotiation sequence. http://www.faqs.org/rfcs/rfc854.html
    A telnet session is more complex than opening a TCP socket.
    I would suggest using the LabVIEW Internet Toolkit for telnet communications.
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • Can untrusted app open http connections?

    Hello,
    JWS has various services to do things that are normally not allowed by untrusted applicatons - such as FileOpenService, FileSaveService, etc... Is there any way or any service to allow an untrusted application to open an http connection to a server other than the one from which it was downloaded???
    Thank you,
    Elana

    No, there is no such service defined in the jnlp spec, but it sounds like it might be a usefull one for
    them to consider for rev 2 of the spec.

  • How do i use an alredy open HTTP connection belong to aother class

    When my apps logs in the User by checking that the username and password are correct against the server then there has been a connection opened to perform this task.
    Then the user is returned to the Main Menu.
    After that they can send some data to the server.
    Class 1 handles the sending of Username and Password.
    And has already opened a HTTP connection.
    Class 2 that will send more data to the server will need to open a connection if there is not one already open.
    How do i check if there is an open connection?
    Do i need to check?
    Can both classes use the same connection? As its to the same server and same php script.
    Thanks for you help on this (once again :-/ )
    Brian

    endPointURL = "http://www.druidev.com/php/verification_script.php";
    try
                        c = (HttpConnection)Connector.open(endPointURL);
                        c.setRequestMethod(HttpConnection.POST);
                        c.setRequestProperty("IF-Modified-Since", "20 Jan 2001 16:19:14 GMT");
                        c.setRequestProperty("User-Agent","Profile/MIDP-1.0 Configuration/CLDC-1.0");
                        c.setRequestProperty("Content-Language", "en-CA");
                              c.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
                        os = c.openOutputStream();
                   String name = "string=name=";
                   String password_tmp = "#password=";
                   String end ="#";
                   String num_origin ="#num_origin=";
                   String num_destination= "#num_destination=";
                   String t1 = name.concat(Start.current_Username);                                                                  String t2 = password_tmp.concat(Start.current_Password);
                   String t3 = t1.concat(t2);     
                   String t4 = t3.concat(num_origin);
                   String t5 = t4.concat(phoneNum1);     
                   String t6 = t5.concat(num_destination);
                   String t7 = t6.concat(phoneNum2);
                   String Final_str = t7.concat(end);                              
                        byte postmsg[] = Final_str.getBytes();
                        for(int i=0;i<postmsg.length;i++)
                               os.write(postmsg);
              is = c.openDataInputStream();
              int ch;
              while ((ch = is.read()) != -1)
              b.append((char) ch);
    I am not using flush etc.
    I need to update a phone book that is downloaded to the phone(MIDlet) once the User is verified.
    The user can edit the phonebook on the phone then each change needs to be sent back to the php script on the server.
    Can i have a loop for the number of updates i need to do then just loop through the code?
    Or will i need to repeat the whole above operation for every update i need to make.
    E.g. 5 edits?

Maybe you are looking for

  • Is there a way to slow down the playback of video in Captivate 5?

    I just made several recordings (FMR) and would like to slow them down for the viewer.  The video was actually of someone else's software demo that moved way too fast.  On the Captivate skin there is "2x" to move the video twice as fast, but no "1/2x"

  • Motion is so slow and is using over 100% of my cpu?

    hi i am just learning motion but am hitting a brick wall, any help would really appreciate it, i am using motion 3 on a g5 dual 2.7 ghz with 5.5 gb of ram and have replaced the original graphics card with the ATI Radeon X800 XT, it either quits when

  • Error consuming Web service with object hierarchy

    I am creating a Web reference to a Web service deployed on JBoss application server. Incidentally, I am able to consume this Web service and run a client against it in .NET. Sun Java Studio Creator has a problem with one of methods in my Web service.

  • Is it possible to assign user-defined data elements to table control?

    Hi SDN, Is it possible to assign a user defined data element other than basic data types in table control column.

  • Changed mime type associations !

    I recently installed gimp, and now when I open any downloaded pdf files, they are opened in gimp. Files previously downloaded and saved are however opened in 'evince'. I use open-box, Chromium, Rox-filer and evince, as DE, browser, file-manager and d