×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2003
    Location
    Torino, Italy
    Posts
    14

    Http error | Kxml parsing

    Hi all,
    I've a strange problem, with the Sun Emulator I've not problems but with the 7210 Yes.

    I connect in this way to http://localhost:8080/AnXmlSimpleFile.xml

    Code:
    public void downloadPage(String url) throws IOException {
    		InputStream is = null;
    		HttpConnection c = null;
    		try {
    			c = (HttpConnection) Connector.open(url);
    			is = c.openInputStream();
    			ptt = new KxmlParser();
    			ptt.parse(is);
    		} catch (Exception e) {
    			error = 1;
    			System.out.println("Download error: " + e);
    			e.printStackTrace();
    		} finally {
    			is.close();
    			c.close();
    		}
    	}
    I get no problems parsing the file, I get this IOExceptions:

    Exception: java/lang/ClassNotFoundException

    at com.sun.midp.io.InternalConnector.openPrim(+188)

    at com.sun.midp.io.InternalConnector.openInternal(+9)

    at com.sun.midp.io.j2me.http.Protocol.connect_wire(+47)

    at com.sun.midp.io.j2me.http.Protocol.connect(+41)

    at com.sun.midp.io.j2me.http.Protocol.openInputStream(+64)

    at TakeOneCanvas.downloadPage(+18)

    at TakeOneCanvas.<init>(+17)

    at FluidTime.startCanvas(+118)

    at FluidTime.commandAction(+203)

    at javax.microedition.lcdui.Display.consumeScreenChange(+70)

    at javax.microedition.lcdui.Display.consumeDisplayEvent(+61)

    at javax.microedition.lcdui.Display$DisplayAccessor.consumeEvent(+66)

    at com.nokia.mid.impl.isa.ui.EventDispatcher.run(+141)

    But the connection is open, It takes only too much time...

    Thank-you
    Antonio

  2. #2
    Registered User
    Join Date
    Mar 2003
    Location
    Torino, Italy
    Posts
    14
    Ok. The problem was... :

    Code:
          // If you experience IO problems, try 
          // removing the comment from the following line
          //http.setRequestProperty("Connection", "close");
    Code:
    * Example from the book:     Core J2ME Technology
    * Copyright John W. Muchow   http://www.CoreJ2ME.com
    * You may use/modify for any non-commercial purpose

Posting Permissions

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