×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Registered User
    Join Date
    Dec 2007
    Location
    Bangalore, India
    Posts
    14

    java.io.IOException: Out of response entries in 6300

    Hi All,
    I am developing the application using the GPRS internet for Nokia 6300. While connecting to server I am getting the exception in Nokia S40 3rd Edition Emulator.

    at com.nokia.mid.impl.isa.io.protocol.internal.wap.Protocol.openPrim(Protocol.java:135)
    at com.sun.midp.io.InternalConnector.openPrim(+157)
    at com.sun.midp.io.InternalConnector.openInternal(+9)
    at com.sun.midp.io.j2me.http.Protocol.connect_wap(+210)
    at com.sun.midp.io.j2me.http.Protocol.connect(+63)
    at com.sun.midp.io.j2me.http.Protocol.getResponseCode(Protocol.java:1160)
    at handler.HttpHandler$Status.prepareRequest(HttpHandler.java:613)
    at handler.HttpHandler$Status.run(HttpHandler.java:653)
    java.io.IOException: Out of response entries

    This is happening in after some server request and response.
    Please help me, How can i resolve this issue.

    Thanks in Advance,
    Muthu Kumar K.

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: java.io.IOException: Out of response entries in 6300

    Just guessing: are you closing all connection-related resources after every network request?

    Pit

  3. #3
    Registered User
    Join Date
    Dec 2007
    Location
    Bangalore, India
    Posts
    14

    Re: java.io.IOException: Out of response entries in 6300

    Hi jappit,
    Thanks for your reply. Yes, I am closing all the connections, o/p steams and i/p streams. The same code working fine in Sony Ericsson and samsung devices also. I am getting problem with Nokia 6300 and 6233.
    Thanks,
    Muthu Kumar K.

  4. #4
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: java.io.IOException: Out of response entries in 6300

    Don't get any clues right now.. Maybe you could post related code to check for possible issues with it?

    Pit

  5. #5
    Registered User
    Join Date
    Dec 2007
    Location
    Bangalore, India
    Posts
    14

    Re: java.io.IOException: Out of response entries in 6300

    Hi Pit,
    For connecting to server i am using POST method. I am able to make the connection. And i am getting the response also. Here i have an Queue for holding the request URLs, It will wait until the previous request has to complete. This process is going well while starting the application. After some few request I am getting the exception.

    I am using the code as follows,
    creating the connection:

    public boolean connect(String url, String urlMethod, int stype) throws IOException, SecurityException {
    try{
    String conUrl = "";
    if (url != null && url.trim().length() > 0) {
    if (url != null) {
    if (url.indexOf("?") >= 0)
    conUrl = url.substring(0, url.indexOf("?"));
    else
    conUrl = url;
    }
    // opens the httpconnection
    conn = (HttpConnection) Connector.open(conUrl);
    while (conn == null && conUrl != null) {
    conn = (HttpConnection) Connector.open(conUrl);
    }
    }
    }catch (IOException io){
    return false;
    }catch (SecurityException se){
    System.out.println("I got the Security Exception");
    return false;
    }
    if (conn != null)
    return true;
    else
    return false;
    }

    Preparing the request:
    public int prepareRequest(String url, String urlMethod,int stype)throws IOException {
    System.out.println("stype.in prepare request...url....."+url);
    try {
    if (conn != null) {
    conn.setRequestProperty("User-Agent",
    "Profile/MIDP-1.0 Configuration/CLDC-1.0");
    conn.setRequestProperty("Content-Language", "en-US");
    conn.setRequestProperty("Connection", "close");
    conn.setRequestProperty("Accept",
    "application/octet-stream");
    if (urlMethod == HttpConnection.POST) {
    bStrm = new ByteArrayOutputStream();
    dout = new DataOutputStream(bStrm);
    postData = url.substring(url.indexOf("?") + 1, url
    .length());
    if(rc.menuId==DataUtility.ADD_PHOTO){
    if (!(imageName.equals(null))&&imageName.length()>0){
    if (imageName.startsWith("|"))
    imageName=imageName.substring(1,imageName.length());
    byte[] image = null;
    image = getImageBytes(imageName);
    dout.writeUTF("IMAGE");
    dout.writeUTF(imageName);
    dout.writeInt(image.length);
    dout.write(image,0,image.length);
    }
    }
    dout.writeUTF(postData);
    pdata = bStrm.toByteArray();
    conn.setRequestMethod(HttpConnection.POST);
    conn.setRequestProperty("Content-Length", Integer.toString(pdata.length));
    os = conn.openOutputStream();
    os.write(pdata);
    conn.setRequestProperty("Connection", "close");
    postData=null;
    pdata=null;
    } else {
    conn.setRequestMethod(HttpConnection.GET);
    }
    }// end if connection
    } catch (Exception e) {
    if(uiflag){
    System.out.println("exception::::::::::"+e);
    HttpHandler.requestqueue.removeAllElements();
    errormsg("Sorry,We have trouble processing with the request.please try^again later.") ;
    e.printStackTrace();
    }
    return -1;
    }
    finally{
    try{
    if (urlMethod == HttpConnection.POST) {
    bStrm.close();
    bStrm = null;
    System.out.println("before dout.flush::::::::::::");
    dout.flush();
    System.out.println("before dout.close::::::::::::");
    dout.close();
    System.out.println("before thread sleep::::::::::::");
    dout=null;
    Thread.currentThread().sleep(1000);
    System.out.println("before os.flush::::::::::::");
    os.flush();
    Thread.currentThread().sleep(1000);
    System.out.println("before os.close::::::::::::");
    os.close();
    System.out.println("after closing::::::::::::");
    os = null;
    pdata = null;
    }
    }
    catch(IOException ioe){
    System.out.println(":::::::::exception in finally block:::"+ioe);
    errormsg("Sorry,We have trouble processing with the request.please try^again later.") ;
    }
    catch(Exception e){
    System.out.println("Exception here......."+e);
    errormsg("Sorry,We have trouble processing with the request.please try^again later.") ;
    }
    }
    try{
    System.out.println("conn.getResponseCode:::::::::::::::: "+conn.getResponseCode());
    }catch(Exception e){
    System.err.println("errr::::::::::::::::::::::: "+e.getMessage());
    }
    return conn.getResponseCode();
    }

    In Prepare request while returning conn.getResponseCode(), it is throwing the following Exception.

    at com.nokia.mid.impl.isa.io.protocol.internal.wap.Protocol.openPrim(Protocol.java:135)
    at com.sun.midp.io.InternalConnector.openPrim(+157)
    at com.sun.midp.io.InternalConnector.openInternal(+9)
    at com.sun.midp.io.j2me.http.Protocol.connect_wap(+210)
    at com.sun.midp.io.j2me.http.Protocol.connect(+63)
    at com.sun.midp.io.j2me.http.Protocol.getResponseCode(Protocol.java:1160)
    at handler.HttpHandler$Status.prepareRequest(HttpHandler.java:613)
    at handler.HttpHandler$Status.run(HttpHandler.java:653)
    before os.flush::::::::::::
    :::::::::exception in finally block:::java.io.IOException: Out of response entries
    java.io.IOException: Out of response entries

    Please Help me.
    Thanks,
    Muthu Kumar K.

  6. #6
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: java.io.IOException: Out of response entries in 6300

    Hi Muthu,

    i'll take a look at your code. Meanwhile (and for next times too ), enclose your code within CODE blocks (like QUOTE ones, but with CODE keyword) so you'll increase its readability.

    Thanks

    Pit

  7. #7
    Registered User
    Join Date
    Dec 2007
    Location
    Bangalore, India
    Posts
    14

    Re: java.io.IOException: Out of response entries in 6300

    Hi Pit,
    Attached the code again
    creating the connection:

    HTML Code:
    public boolean connect(String url, String urlMethod, int stype) throws IOException, SecurityException {
    try{
    String conUrl = "";
    if (url != null && url.trim().length() > 0) {
    if (url != null) {
    if (url.indexOf("?") >= 0)
    conUrl = url.substring(0, url.indexOf("?"));
    else
    conUrl = url;
    }
    // opens the httpconnection
    conn = (HttpConnection) Connector.open(conUrl);
    while (conn == null && conUrl != null) {
    conn = (HttpConnection) Connector.open(conUrl);
    }
    }
    }catch (IOException io){
    return false;
    }catch (SecurityException se){
    System.out.println("I got the Security Exception");
    return false;
    }
    if (conn != null)
    return true;
    else
    return false;
    }

    Preparing the request:

    HTML Code:
    public int prepareRequest(String url, String urlMethod,int stype)throws IOException {
    System.out.println("stype.in prepare request...url....."+url);
    try {
    if (conn != null) {
    conn.setRequestProperty("User-Agent",
    "Profile/MIDP-1.0 Configuration/CLDC-1.0");
    conn.setRequestProperty("Content-Language", "en-US");
    conn.setRequestProperty("Connection", "close");
    conn.setRequestProperty("Accept",
    "application/octet-stream");
    if (urlMethod == HttpConnection.POST) {
    bStrm = new ByteArrayOutputStream();
    dout = new DataOutputStream(bStrm);
    postData = url.substring(url.indexOf("?") + 1, url
    .length());
    if(rc.menuId==DataUtility.ADD_PHOTO){
    if (!(imageName.equals(null))&&imageName.length()>0){
    if (imageName.startsWith("|"))
    imageName=imageName.substring(1,imageName.length());
    byte[] image = null;
    image = getImageBytes(imageName);
    dout.writeUTF("IMAGE");
    dout.writeUTF(imageName);
    dout.writeInt(image.length);
    dout.write(image,0,image.length);
    }
    }
    dout.writeUTF(postData);
    pdata = bStrm.toByteArray();
    conn.setRequestMethod(HttpConnection.POST);
    conn.setRequestProperty("Content-Length", Integer.toString(pdata.length));
    os = conn.openOutputStream();
    os.write(pdata);
    conn.setRequestProperty("Connection", "close");
    postData=null;
    pdata=null;
    } else {
    conn.setRequestMethod(HttpConnection.GET);
    }
    }// end if connection
    } catch (Exception e) {
    if(uiflag){
    System.out.println("exception::::::::::"+e);
    HttpHandler.requestqueue.removeAllElements();
    errormsg("Sorry,We have trouble processing with the request.please try^again later.") ;
    e.printStackTrace();
    }
    return -1;
    }
    finally{
    try{
    if (urlMethod == HttpConnection.POST) {
    bStrm.close();
    bStrm = null;
    System.out.println("before dout.flush::::::::::::");
    dout.flush();
    System.out.println("before dout.close::::::::::::");
    dout.close();
    System.out.println("before thread sleep::::::::::::");
    dout=null;
    Thread.currentThread().sleep(1000);
    System.out.println("before os.flush::::::::::::");
    os.flush();
    Thread.currentThread().sleep(1000);
    System.out.println("before os.close::::::::::::");
    os.close();
    System.out.println("after closing::::::::::::");
    os = null;
    pdata = null;
    }
    }
    catch(IOException ioe){
    System.out.println(":::::::::exception in finally block:::"+ioe);
    errormsg("Sorry,We have trouble processing with the request.please try^again later.") ;
    }
    catch(Exception e){
    System.out.println("Exception here......."+e);
    errormsg("Sorry,We have trouble processing with the request.please try^again later.") ;
    }
    }
    try{
    System.out.println("conn.getResponseCode:::::::::::::::: "+conn.getResponseCode());
    }catch(Exception e){
    System.err.println("errr::::::::::::::::::::::: "+e.getMessage());
    }
    return conn.getResponseCode();
    }
    Thanks,
    Muthu Kumar K.

  8. #8
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: java.io.IOException: Out of response entries in 6300

    It seems you never close your HttpConnection instances conn, am I right?

    Pit

  9. #9
    Registered User
    Join Date
    Dec 2007
    Location
    Bangalore, India
    Posts
    14

    Re: java.io.IOException: Out of response entries in 6300

    Hi Pit,
    After parsing every server response data I am closing the connection,I/O streams using the below clear method:

    HTML Code:
    public void clear() {
            try {
                if(dataStream != null){
                    dataStream.close();
    		dataStream = null;
                }
                if(bStrm != null){
                    bStrm.flush();
    		bStrm.close();                   
       		bStrm = null;
                }
                if(dout != null){
                    try {
                        try{
                            dout.flush();
                        }catch(Exception e){
                            
                        }
                        dout.close();
                    } catch (IOException ex) {
                        
                    }
                    dout = null;
                }
                if(os != null){
                    os.flush();                    
                    os.close();
                    os = null;
                }
                if(iStrm != null){
                    iStrm.close();
                    iStrm = null;
                }
                if(is != null){
                    is.close();
                    is = null;
                }
                if (conn != null) {
                    conn.close();
                    conn = null;
                }
                if(th != null){
                    th = null;
                }
                if(status != null){
                    status = null;
                }
                if(instance != null){
                    instance = null;
                }
                System.gc();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    Thanks,
    Muthu Kumar K.

  10. #10
    Regular Contributor
    Join Date
    Apr 2007
    Posts
    220

    Re: java.io.IOException: Out of response entries in 6300

    Hi mutthu
    as you said that the same code working fine in Sony Ericsson and samsung devices also, in my views its not the problem of programming logic, instead a S40 specific problem- am I right jappit?

    Mutthu! To be more clear, can you do a favour..try to run the same application in some Nokia S60 3rd Ed. phone.

    Regards
    Amit

  11. #11
    Registered User
    Join Date
    Dec 2007
    Location
    Bangalore, India
    Posts
    14

    Re: java.io.IOException: Out of response entries in 6300

    Hi Amit,
    Thanks for your suggestion. I tried with Nokia N73 (S60 3rd Edition)device, but i am getting the same problem .

    Thanks,
    Muthu Kumar K.

  12. #12
    Registered User
    Join Date
    Sep 2005
    Posts
    11

    Re: java.io.IOException: Out of response entries in 6300

    Did you got the reason for above exception Java.io.IOException: Out of response enteries

    Am also getting the same. Please help

  13. #13
    Registered User
    Join Date
    Dec 2007
    Location
    Bangalore, India
    Posts
    14

    Thumbs up Re: java.io.IOException: Out of response entries in 6300

    Hi All,
    I have fixed the problem by closing the stream.
    Now I am able to run the application using all the Nokia devices.
    Thanks,
    Muthu Kumar K.

  14. #14
    Registered User
    Join Date
    Oct 2004
    Location
    Greece
    Posts
    15

    Unhappy Re: java.io.IOException: Out of response entries in 6300

    Hi all,
    I have the same problem as you even though I close the stream [is.close(); etc...]
    What do you exactly mean by "close"?

    I've noticed in your forum Nokia code that you were already closing the stream while still having the problem.

    Could you please post a small code snippet?
    I would be thankful!

    Thank you very much on beforehand.

    Vassilis

  15. #15
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: java.io.IOException: Out of response entries in 6300

    Are you sure you close everything?

    You must close every connection and every stream, always. I recommend structuring the code like this:

    PHP Code:
    try {
        
    HttpConnection con = (HttpConnectionConnector.open(URL);
        try {
            
    InputStream in con.openInputStream();
            try {
                
    // read server response
            
    finally {
                
    in.close();
            }
        } 
    finally {
            
    con.close();
        }
    } catch (
    Exception e) {
        
    // handle exception

    Using non-local variables, and setting things to null, and checking if their null or not and trying to clean up... these tend to be unreliable and to cause problems. Keep variables as local as possible, and use structured exception handling to ensure that everything is closed properly.

    Cheers,
    Graham.

Similar Threads

  1. Handling asynch USSD response from operator
    By espenwe in forum Symbian Networking & Messaging (Closed)
    Replies: 9
    Last Post: 2009-02-05, 09:46
  2. How delete all calendar entries?
    By pavarang in forum Symbian
    Replies: 4
    Last Post: 2008-05-28, 12:31
  3. Problem retreiving custom HTTP response header
    By hmeet2 in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2007-01-03, 10:35
  4. 'Response Unknown' when downloading midlet
    By Weevil in forum Mobile Java General
    Replies: 3
    Last Post: 2004-05-30, 17:01
  5. nokia 7210 modem via IR doesn't work !
    By oussamaaiadi in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2003-03-06, 11:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×