BluetoothStateException: Symbian OS Error= -44 !!!

guys, i'm studying the code on how to communicate using a Bluetooth device, i'm using MIDP2.0 and J2ME's WTK 2.2... and I got this error after I run my application on my phone.. it works fine on the emulator
BluetoothStateException: Symbian OS Error = -44 : General : System ErrorI have no idea what's goin on in my code.. any help would be greatly appreciated..
Many THanks ...
below is my code
import java.io.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.bluetooth.*;
public class BluetoothMIDlet extends MIDlet implements
    Runnable, CommandListener {
    public BluetoothMIDlet() {
         // Create a Form and add the Exit command to the Form
        Form f = new Form("Server");
        f.addCommand(new Command("Exit", Command.EXIT, 1));
        f.setCommandListener(this);
        Display.getDisplay(this).setCurrent(f);
        try {
            // Make the local device discoverable for the
            // client to locate
            f.append("getLocalDevice...");
            LocalDevice local = LocalDevice.getLocalDevice();
            if (!local.setDiscoverable(DiscoveryAgent.GIAC)) {
                f.append("Failed to change to the " +
                    "discoverable mode");
                return;
               f.append("LocalDevice... done.");
            // Create a server connection object to accept
            // a connection from a client
            StreamConnectionNotifier notifier =
                (StreamConnectionNotifier)
                Connector.open("btspp://localhost:" +
                    "86b4d249fb8844d6a756ec265dd1f6a3");
            f.append("StreamConnectionNotifier... done.");       
               System.out.println ("!!! Bluetooth is now running....");
            // Accept a connection from the client -
            // !!! Must have a client !!!
            //System.out.println ("\n... testing....");
            StreamConnection conn = notifier.acceptAndOpen();
            // Open the input to read data from
            InputStream in = conn.openInputStream();
            ByteArrayOutputStream out = new
                ByteArrayOutputStream();
            // Read the data sent from the client until
            // the end of stream
            int data;
            while ((data = in.read()) != -1) {
                out.write(data);
            // Add the text sent from the client to the Form
            f.append(out.toString());
            // Close all open resources
            in.close();
            conn.close();
            notifier.close();
        } catch (BluetoothStateException e) {
             System.out.println ("\n!!! BluetoothStateException");
            f.append("BluetoothStateException: ");
            f.append(e.getMessage());
        } catch (IOException e) {
             System.out.println ("\n!!!IOException");
            f.append("IOException: ");
            f.append(e.getMessage());
     * Starts a background thread when the MIDlet is
     * started.
    public void startApp()
        throws MIDletStateChangeException {
        new Thread(this).start();
    public void pauseApp() {}
    public void destroyApp(boolean unconditional) {}
    public void run() {}
     * Destroys the MIDlet when a Command occurs.
    public void commandAction(Command c, Displayable d) {
        notifyDestroyed();
}

-- ok, I think I know now,, the reason why it throws that exception is I need to "turn-ON" first my Bluetooth connectivity before I run my application...
now, my question is, can my application implicitly turn-ON the Bluetooth ?
thanks

Similar Messages

  • Java.io.ioexception :Symbian OS error=-5105

    Hello friends...
    I encountered above error when i run my application on mobile device. I develop program that connect to remote server. When i run program it takes lots of time to connect and then Symbian OS Error -5105(about route not available) is occured. Any one can tell me,what should i do to solve this probelm.
    Thanks in advance.

    There is no need to double post!
    http://forum.java.sun.com/thread.jspa?threadID=704340&messageID=4083594#4083594
    te means (and you'd know if it you would have searched with google):
    -5105      IPv6: No route available
    So apparently you are using IPv6 and it can't find a route to the host you are connecting to.

  • Symbian OS error = -5105:no_route

    Hello friends...
    I encountered above error when i run my application on mobile device. I develop program that connect to remote server. When i run program it takes lots of time to connect and then Symbian OS Error -5105 is occured. Any one can tell me,what should i do to solve this probelm.
    Thanks in advance.

    There is no need to double post!
    http://forum.java.sun.com/thread.jspa?threadID=704340&messageID=4083594#4083594
    te means (and you'd know if it you would have searched with google):
    -5105      IPv6: No route available
    So apparently you are using IPv6 and it can't find a route to the host you are connecting to.

  • Symbian OS Error: -14

    i m new to java and j2me. i m developing chatting client. i have almost completed it. but when i m testing it on Nokia 9300 Communicator it gives exception like java.microedition.media Exception: Symbian OS Error: -14. this exception occurs while chatting with other person with rapid pace.
    and one more problem while connecting to GPRS it gives me warning messages. same with while accessing memory.
    plz give me solutions.

    can anyone help me abt this error. javax.microedition.media Exception: Symbian OS Error: -14

  • Problem updating N8 to Symbian Belle-Error code 20...

    Hello.
    I tried to update my Nokia N8 from Symbian Anna to Symbian Belle using Nokia Suite as it became available. The update got downloaded but while it was preparing to install, there was an error and its code was 2000. I retried several times but no luck. Same error 2000.
    How do I fix this problem please!?
    Solved!
    Go to Solution.

    @TroubleGirl
    At this point in update process N8 has to disconnect from Nokia Suite connectivity mode and load an additional driver Nokia USB ROM to flash software and this doen't seem to be happening.
    You could try repairing Nokia Suite installation, remove and re-install or perhaps use standalone Nokia Software Updater application:http://nds1.nokia.com/files/support/...erSetup_EN.exe
    Happy to have helped forum with a Support Ratio = 42.5

  • Re: Symbian error= -36

    The link below may help.
    http://newlc.com/Symbian-OS-Error-Codes.html
    It gives the definitions for the Symbian error codes. Sorry that I could not be of more help.

    hi it is a great help, at leats i know what error -36 means.
    KErrDisconnected -36 Disconnected
    connection disconnected. i do not understand why.
    Maybe i should not sleep in my thread, or the socket times out?
    In the wireless toolkit emulator it works perfect. What is wrong with my Nokia N80 phone, E50 also?
    Problem with the socket implementation of that phone?
    regards
    seb

  • HttpConnection error on P900

    Hi
    I run the following code on the p900 device.
    this application connects to a url and gets a simple text message then displays it.
    ( this code is a modified example from the core j2me site examples ...)
    it doesn't work.
    on nokia 6310i device it works , also on every emulator I tried .
    I get a java.io.IOException.SymbianOSerror (something like this ...).
    the last debug message I see is :
    "Attempting to create HttpConnection object" . and then the finally related messages.
    what should I do in order to make this work on p900 ?
    package home;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    import javax.microedition.io.*;
    import javax.microedition.io.HttpConnection;
    import java.io.*;
    import java.lang.StringBuffer;
    public class HttpConn extends MIDlet implements CommandListener , Runnable
      private Display display;
      //TextBox tbMain;
      Form tbMain;
      private Command cmExit;
      private String url = "http://www.corej2me.com/midpbook_v1e1/ch14/getHeaderInfo.txt";
      StringBuffer dbgInfo = new StringBuffer();
      StringBuffer strBfr;
      public HttpConn()
        display = Display.getDisplay(this);
        cmExit = new Command("Exit" , Command.SCREEN , 1);
        tbMain = new Form("HTTP Connection");
        tbMain.addCommand(cmExit);
        tbMain.setCommandListener(this);
      public void run()
        try
          processRequest();
        catch (Exception e)
          dbgInfo.append("run : caught Exception\n");
          dbgInfo.append("run : Exception : " + e.getClass().getName());
          dbgInfo.append("run : Exception message : " + e.getMessage());
          dbgInfo.append("run : Exception string : " + e.toString());
          // also, you should probably display the exception on-screen using an alert or form
          // so that you can see it when running on the phone
          Form f = new Form("Error");
          f.append("An error occurred while connecting : ");
          f.append(new String(dbgInfo));
          f.addCommand(cmExit);
          f.setCommandListener(this);
          display.setCurrent(f);
      public void startApp()
        // set a displayable before you start the connection
        Form f = new Form("Connecting");
        f.append("    Connecting ...\n    Please wait");
        display.setCurrent(f);
        // run the connection in a separate thread
        Thread th = new Thread(this);
        // starts a new thread and calls the run() method in it.
        th.start();
      private void processRequest() throws Exception
        HttpConnection http = null;
        InputStream iStrm = null;
        try
          // Create the connection
          dbgInfo.append("Attempting to create HttpConnection object\n");
          http = (HttpConnection) Connector.open(url);
          // Client Request
          // 1) Send request method
          http.setRequestMethod(HttpConnection.GET);
          // 2) Send header information (this header is optional)
          http.setRequestProperty("User-Agent", "Profile/MIDP-1.0 Configuration/CLDC-1.0");
          //http.setRequestProperty("If-Modified-Since", "Mon, 16 Jul 2001 22:54:26 GMT");
          // If you experience IO problems, try
          // removing the comment from the following line
          http.setRequestProperty("Connection", "close");
          http.setRequestProperty("Cache-Control", "no-transform");
          // 3) Send body/data - No data for this request
          // Server Response
          // 2) Get header information
          if (http.getResponseCode() == HttpConnection.HTTP_OK) {
            // 3) Get data (show the file contents)
            //String str = new String("initial value");
            dbgInfo.append("Attempting to open the input stream\n");
            iStrm = http.openInputStream();
            int length = (int) http.getLength();
            dbgInfo.append("http.getLength() : "+length+"\n");
            if (length != -1)
                // Read data in one chunk
                byte serverData[] = new byte[length];
                dbgInfo.append("Attempting to read da input stream\n");
                iStrm.read(serverData);
                char chars[] = new char[length];
                for (int i = 0 ; i < length ; i++ )
                  chars[i] = (char) serverData;
    dbgInfo.append("Attempting str = new String(serverData)\n");
    strBfr = new StringBuffer(new String(chars));
    dbgInfo.append("end if\n");
    else // Length not available...
    dbgInfo.append(
    "Attempting to read the input stream one char at a time\n");
    ByteArrayOutputStream bStrm = new ByteArrayOutputStream();
    // Read data one character at a time
    int ch;
    while ( (ch = iStrm.read()) != -1)
    bStrm.write(ch);
    dbgInfo.append("Attempting str = new String(bStrm.toByteArray())\n");
    strBfr = new StringBuffer(new String(bStrm.toByteArray()));
    dbgInfo.append("Attempting bStrm.close()\n");
    bStrm.close();
    dbgInfo.append("Attempting tbMain.setString\n");
    tbMain.append("core j2me site file content :\n" + strBfr);
    dbgInfo.append("display.setCurrent(tbMain)\n");
    display.setCurrent(tbMain);
    dbgInfo.append("end else\n");
    finally
    dbgInfo.append("finally\n");
    if (iStrm != null)
    iStrm.close();
    if (http != null)
    http.close();
    dbgInfo.append("out of finally\n");
    public void pauseApp()
    public void destroyApp(boolean unconditional)
    public void commandAction( Command c, Displayable s )
    if ( c == cmExit )
    destroyApp(false);
    notifyDestroyed();

    Guys I finally managed to get a HTTP connection working on my P900. The problem was to do with my Mobile Network SP. It seems that they are limited in intelligence so when you say that you want access to the internet they will set you up to go to a WAP gateway which translates your requests and responses for your handset. I kept getting a -36 Symbian OS error which implied that the connection was being cut, since a the host name was resolved. After I had argued with the Data Support people for my network, explaining to them that WAP is not the a full Internet access, they finally managed to give me the right dns etc entries and my application was successfully able to communicate.
    Hope this helps, I have another problem to do with installing the same applications on the P900i but I will leave that for another forum :)

  • JSR172 or HttpConnection error

    Hello,
    I use a J2ME application as webservice client with JSR172 Webservice API support. When I try to send a large String with more than 1680 characters to webserver I get a java.rmi.MarshalException: SAXParseException and the message has not received the server. Maybe there is some limit in length?
    To check it out I try to build the soap query manually and send it over a httpConnection with POST to webserver (without JSR172). Now I get the result "Bad Request". The string contains only normal characters.
    Any idea why this happens? I can say that the webserver has no error.
    Thanks for reply.
    Background:
    I try to send a picture as base64String manually encoded to webserver. This is the reason for the long string. The support or byte[] in stub generator seems not to work correct.

    Guys I finally managed to get a HTTP connection working on my P900. The problem was to do with my Mobile Network SP. It seems that they are limited in intelligence so when you say that you want access to the internet they will set you up to go to a WAP gateway which translates your requests and responses for your handset. I kept getting a -36 Symbian OS error which implied that the connection was being cut, since a the host name was resolved. After I had argued with the Data Support people for my network, explaining to them that WAP is not the a full Internet access, they finally managed to give me the right dns etc entries and my application was successfully able to communicate.
    Hope this helps, I have another problem to do with installing the same applications on the P900i but I will leave that for another forum :)

  • Midlet on Symbian UIQ

    I tried a midlet with emulator and it run correctly (SonyEricsson P910 and Nokia 6600) but when i tried it on the phone the midlet return the exception " java.io.IOException: Symbian OS error= -33: errore sistema" . Why? i have to do something on the phone? It give the error when the midlet try to connect to an URL. It send data in output (to url) but it doesn�t receive response. Can someone help me?
    Thanks
    Paolo

    Better to use IBM's J9 VM instead of CrEme and check the results.
    ~Mohan

  • Capture picture with nokia 6680

    I'm developing an application for Nokia 6680, and need to access the videoplayer through my gui so I can capture a picture and send it to a webserver.
    I'm having trouble initializing the player. It throws a MediaException with Symbian OS error -5, "the operation requested is not supported".
    It works just fine in WTK 2.2 and with SE K700.
    I've also checked the supports.video.capture system-property, and it returns true.
    Here's the code:
    class CameraForm extends Form implements CommandListener {
      private final MyMIDlet midlet;
      private final Command exitCommand;
      private Command captureCommand = null;
      private Player player;
      private VideoControl videoControl;
      private boolean active=false;
      private StringItem messageItem;
       public CameraForm(MyMIDlet midlet){
          super("Camera");
          this.midlet=midlet;
          messageItem = new StringItem("Message","start");
          append(messageItem);
          exitCommand=new Command("Exit",Command.EXIT,1);
          addCommand(exitCommand);
          setCommandListener(this);
          //initialize camera
          try {
             player = Manager.createPlayer("capture://video");
             player.realize();
             //Grab the videoControl and set it to the current display
             videoControl=(VideoControl)(player.getControl("VideoControl"));
             if(videoControl != null){
                 append((Item)(videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE,null)));
            captureCommand = new Command("Capture",Command.SCREEN,1);
            addCommand(captureCommand);
            messageItem.setText("OK");
        }  else{
            messageItem.setText("No video control");
    } catch(IOException ioe){
          messageItem.setText("IOException:"+ioe.getMessage());
    } catch(MediaException me){
          messageItem.setText("MediaException cameraForm(): "+me.getMessage());
    } catch(SecurityException se){
          messageItem.setText("Securityexception:"+se.getMessage());
    }Thanks!

    Peter,
    Sorry for the late reply, have been really busy the past weeks.
    Yesterday I got another Nokia 6680 on which my MIDlet wouldn't run. Got the MediaException -5 (meaning "Not Supported") again.
    I tried the code *#7370# to hard reset the phone (see Step 1 below), with no success. But I did manage to get it working (after continuing with the procedure below).
    The following explains the steps I followed:
    NOTE: Backup all data on your phone before continuing as all will be lost!
    Step 1:
    a.) Enter the code *#7370#
    b.) Answer [Yes] to the following prompt: "Restore all original phone settings? Phone will restart."
    c.) Enter the security code when the phone prompts for it. (Default: 12345)
    d.) The phone will now restart.
    e.) Once restarted, all data will have been erased and the phone will ask you for some settings.
    Step 2: This is a bit tricky...
    a.) Turn off the phone.
    b.) Press and hold the following keys: [Answer] + [*] + [3]
    [Answer] = Answer key (green phone)
    [*] = Star key
    [3] = Numeric 3 key
    c.) While holding the above keys, press the [Power] button to switch on the phone.
    d.) Once again all data will have been erased and the phone will ask you for some settings.
    Step 3:
    Follow Step 1 again.
    Install your application after each step and test to see if it isn't maybe working. My MIDlet only started working after completing Step 3. I am not sure if Step 1 is actually necessary, but I have listed it as this is the path I did folow.
    That is it, hope this works for you.

  • MIDLET working fine in emulator but not working on mobile!

    hi,
    i have an application which sends http request (get), it works fine in an emulator but when i install that application onto P900 sonyerricson it doesnot send the request and after sometime gives symbian os error:-33
    pls. let me know the solution!!
    thanks
    regards
    bhaskar

    A WAP access point means you're using a WAP stack, and you have to go through a WAP gateway to get to the internet. With an internet access point you use a TCP/IP stack and so you can "talk" directly to the internet. Look up tutorials about WAP if you want to know more.
    But as far as your MIDlet is concerned, all you have to know is how to change the phone's configuration (manually I mean, not with the J2ME code), so that it uses an internet access point. I don't have a P900 lying around right now, so I don't remember exactly how to configure it, but I'm sure if you search through the SE forums you'll find an explanation,
    shmoove

  • Installation help(urgent)

    hi e1
    i have developed a application using wireless toolkit.it is running well on my notebook.but when i try to install that jar file in my device which is Nokia 6600
    it gives a message "not supported"..
    anybody help .urgent

    i have changed it to CLDC 1.0 and the application got installed fine on my device
    now when i try to connect it through GPRS it is giving the following error
    Connect Symbian OS error=-1520: System error
    i am using HTTP connection and it connects to a servlet which is there on server.
    i am having full GPRS connection
    any suggestiong please help
    thank very much for previous replies

  • S60 3rd Edition MIDP + Netbeans 5.5 + Mobility CLDC !URGENT!

    My Environment       Device: Nokia E61
           SDK: S60 3.0 MIDP SDK (S60 3rd Ed MIDP)
           Java: javac 1.5.0_12
           OS: Microsoft Windows XP Professional [Version 5.1.2600]/ Service Pack 2
           Computer: AMD Athlon 64bit CPU 3200+ 2.1GHz, 1.00GB Mem
           NetBeans (5.5 dev build ):
              Number: 200704122300
              Date: ${buildday}
              Branding:
              Branch: release551
              Tag:
           Mobility: NetBeans Mobility Pack 5.5.1I am having problems building application with netbeans. The jar file is coming out excessively large and it fails to run on the emu, get -10504 error (already tried to lookup error code at http://newlc.com/Symbian-OS-Error-Codes.html and it is not listed there). I inspected the .jar file and did not see anything there that did not belong; only .class, .png, kxml library and manifest files were present (no Thumbs.db or other clutter).
    When I build the same application with CarbideJ the jar file size is significantly smaller and it executes on the Emulator. Are any of the CarbideJ tasks, namely <ndsj2mejavac> and/or <ndsj2mepackage>, doing something special to source, jar or images that maybe netbeans is skipping; running a different preverifier, different archiver, using it's on version of javac.exe or something?
    When I compile using Carbide.j this is what I get (NO obfuscated/NO debug info);
         AppXXX.jad (400 bytes)
         AppXXX.jar (728,538 bytes)however, when I compile with Netbeans, I get the following(obfuscated set to level 9/NO debug info);
         AppXXX.jad (471 bytes)
         AppXXX.jar (927,530 bytes)The jad files generated were different but only because one had more descriptor tags in it, nothing major about that. The problem is that the jar file generated by netbeans is significantly larger than the one generated by carbide. Also, I compiled the exact same program under the Sun Wireless toolkit v2.5.1 and got the exact same jar file sizes and runtime error on emu that netbeans generated; I installed s60 sdk for wtk and selected it before before creating package for application. Also I state before, the version created with Carbide.j runs in the Emu; however, the NB version does not.
    Already posted to Nokia forum and no help there
    I would be very appreciative if I can quickly get some help!
    Files:
    build.xml (output of netbeans build process is append to the end of the build file in an xml comment): http://home.comcast.net/~eramsey1535/JavaME/Nokia/build.xml
    CFG_DEV.properties: http://home.comcast.net/~eramsey1535/JavaME/Nokia/CFG_DEV.properties.txt
    project.properties: http://home.comcast.net/~eramsey1535/JavaME/Nokia/project.properties.txt
    image of error displayed on emu: http://home.comcast.net/~eramsey1535/JavaME/Nokia/error_displayed_on_emu.gif
    image of error in emu popup dialog: http://home.comcast.net/~eramsey1535/JavaME/Nokia/error_displayed_in_emu_popup_dialog.gif
    Thanks!

    Hi,
    I'm facing exactly the same problem, and was wondering whether you found the solution to this problem.
    Thanks in adance,
    Iwan

  • Using mobile camera to send images to the web server at regular intervals

    Hi All,
    I am developing an application in which the camera is kept on and it takes picture at regular intervals 30 sec to be exact. And that picture is sent to the web server so that can be viewed at the server. Now I am testing this application on Nokia E50 but after running for 3 hours there was an error given as below
    MediaException: (in takes Symbian OS error :-2
    Whats this error about? Is this an OS error or theres some fault within the coding. Please reply its urgent.
    Thanks in advance
    Sunil

    Hi Db,
    I have tried what you have said but now the problem is that it gives Symbian OS : -4 error which is a memory error. Actually what happens in the project is that once the connection between web server and the mobile breaks down the mobile will continuosly try to establish the connection and in doing so it will create new objects. There is no limitation on the number of times the connection attempts can be made. It will keep on trying till the connection is established. If that is the reason which is causing the problem then I think I may have to find another way for the connection to be established.
    Thanks in advance
    Sunil

  • MIdlet running problem

    Hi, I've created a J2ME app which uses a client/server system. The client runs on a mobile device. I have set up Over the Air for the suite, and when testing the app etc on the JWT OTA test everything works fine.
    However when i went to run the app on a real phone (Siemens CX65), the installation went fine but it failed to connect to the server!
    The code in the midlet regarding the connection is as follows:
        DataInputStream is;
        DataOutputStream os;
        SocketConnection sc;
    sc = (SocketConnection) Connector.open("socket://xxxxxxx.xxx:8000");            
                is = sc.openDataInputStream();
                os = sc.openDataOutputStream();It is confusing me why the OTA emulator connects to the server fine while the phone app cannot. I am using GPRS on the phone, is there any specific settings there that might be affecting things?

    Hey Friend.
    I'm also facing same problem. I also use socket to connect to remote server While connection to server i faced 2 symbian OS errors >Error -33(timeout) and then Error -5105(no route found).
    Please, if you get solution then inform me.
    My email: [email protected]

Maybe you are looking for