Parse method hangs

I am trying to to parse a file using DocumentBuilder. The parse() method hangs for no reason. There are no errors or exceptions thrown. I even used a StringReader but in vain. Pl see code below:
The file is read correctly and i could even print the XML string out.
System.out.println("Parsing XML file from performParsing():" +s);
          Document doc = null;
          DocumentBuilderFactory factory = null;
          DocumentBuilder builder = null;
          try{
               factory = DocumentBuilderFactory.newInstance();
               System.out.println("Parsing XML factory:" +factory);
               builder = factory.newDocumentBuilder();
               System.out.println("Parsing XML builder:" +builder);
               URL url = new URL(s);
               URLConnection urlConnection = url.openConnection();
               InputStream in = urlConnection.getInputStream();
               String XMLStr = getStringReaderFromFile(in); //private method that gives a string
               StringReader stReader = new StringReader(XMLStr);
               InputSource ins = new InputSource(stReader);
     doc = builder.parse(ins);--->IT HANGS HERE

Not an expert on this but presumably you have the properties set up correctly.
From javadoc ...
DocumentBuilderFactory uses the system property javax.xml.parsers.XmlDocumentParserFactory to find the class to load. So you can change the parser by calling:
System.setProperty("javax.xml.parsers.XmlDocumentParserFactory",
"com.foo.myFactory");

Similar Messages

  • DOMParser.parse(URL) hangs

    Anytime I call DOMParser.parse(URL) where URL is of type "http://", the parse call hangs (as near as I can tell) indefinitely. Are URLs of this type not supported? Is there a work around to this problem?

    No. Within the same class, the following DOES work:
    DOMParser dp = new DOMParser();
    dp.setErrorStream(new PrintWriter(errs));
    // Set Schema Object for Validation
    dp.setXMLSchema((XMLSchema)((new XSDBuilder()).build(schema.location)));
    Note that schema.location is a String like "http://www.wherever.com/file.xsd" which points to the web server that is hanging on DOMParser.parse(URL);

  • InputStreamReader read(char[] cbuf, int offset, int length) method hangs

    Hi all,
    I am posting this message again.
    I would appreciate any help, as I am stuck with a customer issue.
    This method hangs for the following values
    read(xchar, 0, 1)
    Does not throw any exception.
    The inputstream does have data in it.
    the characterset is cp037.
    I know for sure that the InputStream has data in it. In fact the read method reads couple of fields with length greater than 1 and hangs when it tries to read data with length 1.
    Bug # 4401798 talks about some error similar to this being fixed. Any one has any idea, which jdk had this problem and which one has a fix for this?
    Thanks.

    You should have continued in your original thread, rather than starting a new one. What you have posted in this new thread could have gone in the old one:
    http://forum.java.sun.com/thread.jspa?threadID=665303

  • InputStreamRead read(char[] cbuf, int offset, int length) method hangs

    This method hangs for the following values
    read(xchar, 0, 1)
    Does not throw any exception.
    The inputstream does have data in it.
    the characterset is cp037.

    So the problem is probably in your implementation of InputStream. Do you implement the available() method? What will your class do if you attempt to read more bytes than there are? (say, call read(chars, 0, 1000000))
    The InputStreamReader keeps an internal buffer (of 1024 bytes?) which it uses for decoding the bytesto characters..if your stream blocks when InputStreamReader is filling its buffer you'd get this sort of behaviour.

  • URGENT:  javax.xml.parsers.DocumentBuilder.parse() method issue

    Hi folks,
    I have an urgent parsing problem. I developed an app with JDK1.4 and now it needs to run on JDK1.3.1. The problem is this:
    If I use the DocumentBuilder.parse() method shipped with JDK1.4 it will parse a document containing namespaces WITHOUT a namespace declaration in the root element. However, since XML support doesn't ship with JDK1.3.1 I need to use JAXP. If I try this with the DocumentBuilder.parse() version shipped with JAXP (latest version) the parse method throws a NullPointerException. If I put the namespace declaration in the document it will parse fine. I tried setting the DocumentBuilderFactory.setNamespaceAware() explicitly to false (should be the default) but no luck. Any ideas other than adding the declaration (long story why I don't want it there...)
    thanks

    example, with declaration of namespace:
    <?xml version="1.0" encoding="UTF-8"?>
    <pre:root xmlns:inn="http://blablabla/inn/version/1.0/">
    <pre:metadata>
    <pre:dublin-core>
    <pre:title>mytitle</pre:title>
    <pre:description>mydesc</pre:description>
    <pre:creator>bjmann</pre:creator>
    </inn:dublin-core>
    </pre:root>
    example, without declaration:
    <?xml version="1.0" encoding="UTF-8"?>
    <pre:root>
    <pre:metadata>
    <pre:dublin-core>
    <pre:title>mytitle</pre:title>
    <pre:description>mydesc</pre:description>
    <pre:creator>bjmann</pre:creator>
    </inn:dublin-core>
    </pre:root>
    this may help...

  • Syntax Error with JSON.Parse method to parse SharePoint List Items

    Hi All,
    I want to get SharePoint List data and bind that retrived data to the JQuery Grid Control.
    For this I used SPServices to get the SharePoint List data in SOAP Envelope. Now I need to parse the soap envelope and store the retrieved items in array to pass it to the Grid Control.
    While using the JSON.Parse(resporseText) method, Iam consistenly getting an Syntax Error!
    Could anyone help me with this ?
    Please find the SOAP Envelope I received from SP List as below:
    "<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/"><GetListItemsResult><listitems xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
    xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
    xmlns:rs='urn:schemas-microsoft-com:rowset'
    xmlns:z='#RowsetSchema'>
    <rs:data ItemCount="2">
    <z:row ows_OBNumber='112211.000000000' ows_Project_x0020_Name='Project 1' ows_MetaInfo='11;#' ows__ModerationStatus='0' ows__Level='1' ows_Title='Project 1' ows_ID='11' ows_UniqueId='11;#{FBBCBCF9-666D-42F9-92D7-67188C51BC9B}' ows_owshiddenversion='1' ows_FSObjType='11;#0' ows_Created='2015-01-12 10:25:06' ows_PermMask='0x7fffffffffffffff' ows_Modified='2015-01-12 10:25:06' ows_FileRef='11;#sites/Lists/Projects/11_.000' />
    <z:row ows_OBNumber='1122343.00000000' ows_Project_x0020_Name='Project 2 ' ows_MetaInfo='12;#' ows__ModerationStatus='0' ows__Level='1' ows_Title='Project 2' ows_ID='12' ows_UniqueId='12;#{0D772B76-68E4-4769-B6FF-6A269F9C7ABD}' ows_owshiddenversion='1' ows_FSObjType='12;#0' ows_Created='2015-01-12 10:33:48' ows_PermMask='0x7fffffffffffffff' ows_Modified='2015-01-12 10:33:48' ows_FileRef='12;#sites/Lists/Projects/12_.000' />
    </rs:data>
    </listitems></GetListItemsResult></GetListItemsResponse></soap:Body></soap:Envelope>"
    Any help on this will be greatly appreciated.
    Thanks In Advance.!

    Hi,
    According to your description, there is an issue when parsing result from the data retrieved using SPServices.
    By default, SPServices returns data as XML format, however, the JSON.parse() method “Throws a SyntaxError exception if the string to parse is not valid JSON”:
    https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse
    To extract the data needed from the response, you can either take the demo below for as a reference:
    http://spservices.codeplex.com/wikipage?title=GetListItems
    Or use the jQuery.parseXML() function:
    http://api.jquery.com/jquery.parsexml/
    Best regards
    Patrick Liang
    TechNet Community Support

  • When passing Node to parse() method get NULL pointer exception.

    All,
    I trying to pass a Node to parse method to get the NodeType object back and getting
    null pointer exception.
    Example
    xml
    <root>
    <Test>
    <someData>ABC</someData>
    </Test>
    </root>
    if pass the Test node to get Test object back I am getting null pointer exception.
    Thanks for all ur help
    Shoeb

    file 2
    ~~~~
    import javax.swing.*;
    public class ExtendedPage extends BasePage
    private JTextField objJTextField = null;
    private JButton objJButtonBrowse = null;
    Change the line in bold to
    private JTextField objJTextField;
    And everything works.

  • Adobe Offline Form - Parse method is not possible for this type

    Hi All,
    I have developed an application for the offline scenario of interactive adobe form. I tried to load the adobe form from my desktop. After pressing the button "Display form" it throws an error "Parse method is not possible for this type".
    If I include wdContext.getNodeInfo().getAttribute("pdfObject").getModifiableSimpleType() in the doInit() method of the view I receive this error -
    com.sap.tc.webdynpro.progmodel.context.ContextException: MappedAttributeInfo(UploadView.pdfObject): must not modify the datatype of a mapped attribute
    When I comment it out and upload I receive the error enclosed -
    Parse method is not possible for this type
    Can someone please help me with a step by step solution to this problem?
    Any help is highly appreciated.
    Many thanks,
    Divya

    Hi Divya,
    Please try to do it as stated below:
         IWDAttributeInfo attInfo = wdContext.getNodeInfo().getAttribute("pdfObject");
         ISimpleTypeModifiable type = attInfo.getModifiableSimpleType();
         IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType)type;
    Try putting the code in wdInit() or wdDoModifyView().
    Let me know if you still face the issue.
    Regards,
    Arafat

  • Possible to overwrite parse method in DOM with SAX Handler?

    Hi,
    Is it possible to overwrite the parse method within DOM?
    What a want to do is:
         private Node parseXml( String text ) throws SAXParseException, SAXException, IOException, ParserConfigurationException
              SAXParserFactory factory = SAXParserFactory.newInstance();
                   factory.setNamespaceAware(true);
                   SAXParser parser = factory.newSAXParser();
                   TestHandler handler = new TestHandler();
                   // Parse the file
                   parser.parse(new InputSource(new StringReader(text)), handler);
              return (Node)handler.getRoot();
         } //end parseXml()The reason I want to use this is that within SAX I can write my own line counter so I keep a count of which node is on which line of text.
    What I was thinking is that I could use SAX to return DOM Nodes with the line number attached, possibly using the node.setUserData() method?!
    I have tried to play around with it and it doen't seem to work, can anyone help?
    Cheers Alex

    I have managaed to re-write my SAX parser to create a JTree, this works perfectly I can move through the tree and each line of text that corresponds to the node is highlighted.
    My problem is however that in my application I have used the DOM structure throughout so some of the functionality is lost.
    Is I understand that JAXP uses both SAX and DOM together, so I was wondering if it is possible to combine my sax parse method within the DOM?
    If anything is unclear please say and I will try and explain better. The main reason for doing this is that I want to keep a reference to which line of text each node of the dom tree represents. I have not been able to implemnet one in DOM however using SAX I have managed.
    Many thanks,
    Alex

  • Failed to parse method name:

    Hi,
    I've the following environment:
    - Sun Solaris
    - WL 61 without service pack
    - jdk 1.3.1
    I wrote a simple Session Bean and make it IIOP enabled.
    For the Java-Corba client I use an IDL which describes
    the interfaces of the remote and home interface of the
    Session Bean.
    Everything works fine, that means I get the WL's NameService,
    home and the remote object. If I call a method of the remote
    object I got the following message:
    <Info> <IIOPEndPoint> <failed to parse method name: foundUnkownSubscriber>
    I found something in you newsgroup and you said the we should
    use SP2. Where can I get this SP2?
    Regards
    Andre Genser

    Andy Piper <[email protected]> wrote:
    "Andre Genser" <[email protected]> writes:
    I've the following environment:
    - Sun Solaris
    - WL 61 without service pack
    - jdk 1.3.1
    I wrote a simple Session Bean and make it IIOP enabled.
    For the Java-Corba client I use an IDL which describes
    the interfaces of the remote and home interface of the
    Session Bean.
    Everything works fine, that means I get the WL's NameService,
    home and the remote object. If I call a method of the remote
    object I got the following message:
    <Info> <IIOPEndPoint> <failed to parse method name: foundUnkownSubscriber>Are you sure you are spelling correctly? Seems like this should be
    foundUnknownSubscriber.
    andy
    -- Sorry Andy, it was the name but I didn't solved the problem. Now I got the following
    exception:
    <Apr 16, 2002 8:47:29 AM CEST> <Warning> <Dispatcher> <Error thrown by rmi server:
    'weblogic.rmi.cluster.ClusterableServerRef@111 - jvmid: '-5101001595216439928S:10.2.9.70:[8045,8045,9045,9045,8045,9045,-1]:agenser8045:myserver',
    oid: '273', implementation: '[BaseEJBObject] home: prototype.CallBackBean_w4a7u3_HomeImpl@29bced''
    java.lang.OutOfMemoryError
    <<no stack trace available>>
    >
    <Apr 16, 2002 8:47:29 AM CEST> <Error> <Kernel> <ExecuteRequest failed
    java.lang.OutOfMemoryError
    <<no stack trace available>>
    >
    What is wrong in my solution? Here is my simple IDL-File:
    module prototype{
         exception CallBackException {
         interface CallBack {
              void foundUnknownSubscriber( in string MSISDN) raises(CallBackException);
         interface CallBackFactory {
              CallBack create();
    Thanks.
    Andre

  • Regarding DocumentBuilder.parse method returns reference as null value.

    Hi
    We are in the process of migrating code which works on WebSphere/JBOSS to WLS..
    We are using DocumentBuilder object for parsing the Locale related xml data. I understand that the DocumentBuilder is provided by DocumentBuilderFactory which is an interface whose implementation is server specific.
    But when the Document Builder parse method is called with a valid file path, we are getting System.Out of doc.getFirstChild().getLocalName() as null (which ideally should have been the name of the first node). No Errors are observed .
    For WLS, the parser is giving the document object reference as null whereas in other servers like Websphere and JBOSS we are able to parse the same xml with proper object reference.
    Could you please help in this regard?
    Thanks and regards
    Anil

    Hi Vmotamar,
    If you think that the parsers available as part of WebLogic are causing the issues, Then you can use your Own Parsers while migrating to WebLogic Server. I mean Get the Parser Jar files which u used as part of JBoss or WebSphere and put it inside the "APP-INF\lib" directory of your EAR Application or Put them inside "WEB-INF\lib" of your WEBApplication...and then Apply ClassLoader Filtering feature provided by WebLogic ...which allows an application to use It's Own Jars\Classes ...
    Please refer to: http://forums.oracle.com/forums/thread.jspa?threadID=1109267&tstart=150 and in http://weblogic-wonders.com/weblogic/parsers_issues
    Thanks
    Jay SenSharma
    http://weblogic-wonders.com/weblogic/parsers_issues/ (WebLogic Wonders Are Here)

  • HTMLEditorKit.Parser.parse() method is not giving a proper HTMLDocument alw

    Hi,
    I am developing util program for HTML filter, for my project. I have find using HTMLDocument we can do that.
    But when I created I found few starnge things.
    HTMLEditorKit.Parser.parse() method is not giving a proper HTMLDocument always. the below application will show the HTML one if you comment the String str ="" ; and uncomment the next line.
    I am wondering why this happens.
    import java.io.StringReader;
    import java.io.StringWriter;
    import javax.swing.text.html.HTMLDocument;
    import javax.swing.text.html.HTMLEditorKit;
    import javax.swing.text.html.HTMLWriter;
    import javax.swing.text.html.parser.ParserDelegator;
    public class HTMLDocExample {
    public static void main(String args[]) throws Exception {
    System.out.println("start the parsing");
    String data = "dsfdssfsdf<A HREF='http://yahoo.com'>HTMLEditorKit.Parser</A><h1>dsfdsf</h1><table border='1' class='test'><tr><td><input type='text'>dfsf</input><select id='id1' name='name1'><option>fff</option><option>aaaaa</option></select><input type='text'/><a href=#></a></td></tr></table>";
    String str ="" ;
    //String str ="<TABLE >test</TABLE><TABLE >test</TABLE><TABLE >test</TABLE><TABLE >test</TABLE><TABLE >test</TABLE><TABLE >test</TABLE><TABLE >test</TABLE><TABLE >test</TABLE><TABLE >test</TABLE><TABLE >test</TABLE>" ;
    StringReader br = new StringReader(data + str );
    HTMLEditorKit htmlKit = new HTMLEditorKit();
    HTMLDocument htmlDoc = (HTMLDocument) htmlKit.createDefaultDocument();
    HTMLEditorKit.Parser parser = new ParserDelegator();
    HTMLEditorKit.ParserCallback callback = htmlDoc.getReader(0);
    parser.parse(br, callback, true);
    StringWriter writer = new StringWriter();
    HTMLWriter hWriter = new HTMLWriter(writer, htmlDoc);
    hWriter.write();
    String outPut = writer.toString();
    System.out.println(outPut);
    System.exit(0);
    }

    import java.io.StringReader;
    import java.io.StringWriter;
    import javax.swing.text.html.HTMLDocument;
    import javax.swing.text.html.HTMLEditorKit;
    import javax.swing.text.html.HTMLWriter;
    import javax.swing.text.html.parser.ParserDelegator;
    public class HTMLDocExample {
      public static void main(String args[]) throws Exception {
        System.out.println("start the parsing"); 
        String data = "dsfdssfsdf<A HREF='http://yahoo.com'>HTMLEditorKit.Parser</A><h1>dsfdsf</h1><table border='1' class='test'><tr><td><input type='text'>dfsf</input><select id='id1' name='name1'><option>fff</option><option>aaaaa</option></select><input type='text'/><a href=#></a></td></tr></table>";
        //String str ="" ;
        String str ="<TABLE >test</TABLE><TABLE >test</TABLE><TABLE >test</TABLE><TABLE >test</TABLE><TABLE >test</TABLE><TABLE >test</TABLE><TABLE >test</TABLE><TABLE >test</TABLE><TABLE >test</TABLE><TABLE >test</TABLE>" ;
        StringReader br = new StringReader(data + str );   
        HTMLEditorKit htmlKit = new HTMLEditorKit();
        HTMLDocument htmlDoc = (HTMLDocument) htmlKit.createDefaultDocument();
        HTMLEditorKit.Parser parser = new ParserDelegator();
        HTMLEditorKit.ParserCallback callback = htmlDoc.getReader(0);
        parser.parse(br, callback, true);
        StringWriter writer = new StringWriter();
        HTMLWriter hWriter = new HTMLWriter(writer, htmlDoc);
        hWriter.write();
        String outPut = writer.toString();       
        System.out.println(outPut);
        System.exit(0);
    }

  • DateFormat parse method usage

    Hi all,
    I am using the following code to parse the date String object to Date Object -
    ======================================================================
    if(dateString == null || dateString.trim().equals(""))
    return null;
    DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.SHORT,
    Locale.getDefault());
    Date d = null;
    try
    dateFormatter.setLenient(false);
    d = dateFormatter.parse(dateString);
    catch(ParseException pe)
    e.printStackTrace();
    =================================================================
    This code works perfectly for all formats of String objects I give except for the format - "12/12/12/1" in which case it converts to following date object -
    "Wed Dec 12 00:00:00 IST 2012" although its an invalid date String.
    Please let me know how I could have correct validation done in such cases or if this is the right behavior for DateFormat class.
    Thanks in advance!!

    I'm not going to comment on how exactly the parse method does its business, but I can suggest you use a regex pattern to validate the input you will send the parse method.
    Here is some info from the CodeProject website on date validation(Note that this is aimed at .NET - but regex works the same in Java as it does in .NET [i think]):
    Dates: As with numbers, we need two validators: a key-press validator, and a completion validator. The key-press validator can be pretty simple, if we limit how our user enters the date. Let’s say that we want to validate for the U.S. date format mm/dd/yyyy. Here is a validator that will do that:
    ^([0-9]|/)*$
    The regex reads: “Match any string that contains a sequence of zero or more characters, where each character is either a digit or a slash.” This validator will give the user immediate feedback if they enter an invalid character, such as an ‘a’.
    Copy that regex to Regex Tester and give it a try. Note that the validation fails if the user enters dashes, instead of slashes, between the parts of the date. How could we increase the flexibility of our regex to accommodate dashes? Think about the question for a minute before moving on.
    All we need to do is add a dash to the alternates group:
    ^([0-9]|/|-)*$
    We could add other alternates to make the regex as flexible as it needs to be.
    The completion validator does a final check to determine whether the input matches a complete date pattern:
    ^[0-2]?[1-9](/|-)[0-3]?[0-9](/|-)[1-2][0-9][0-9][0-9]$
    The regex reads as follows: "Match any string that conforms to this pattern: The first character can be a 0, 1, or 2, and it may be omitted. The second character can be any number and is required. The next character can be a slash or a dash, and is required…” And so on. This regex differs from the ones we used before in that it specifies each character of the pattern—the pattern is more of a template than a formula.
    Note the first character of the regex: ‘[0-2]’. This character points out that we can limit allowable digits to less than the full set. We can also expand them; for example, ‘[0-9A-F]’ would allow any hexadecimal digit. In fact, we can use this structure, known as a character class, to specify any set of characters we want. For example, the character class ‘[A-Z]’ allows capital letters, and ‘[A-Za-z]’ allows upper or lower-case letters.
    Our date regex also points out some of the limitations of regex validation. Paste the date regex shown into Regex Tester and try out some dates. The regex does a pretty good job with run-of-the-mill dates, but it allows some patently invalid ones, such as ‘29/29/2006’, or ‘12/39/2006'. The regex is clearly not ‘bulletproof’.
    We could beef up the regular expression with additional features to catch these invalid dates, but it may be simpler to simply use a bit of .NET in the completion validator:
    bool isValid = DateTime.TryParse(dateString, out dummy);
    We gain the additional benefit that .NET will check the date for leap year validity, and so on. As always, the choice comes down to: What is simpler? What is faster? What is more easily understood? In my shop, we use a regex for the key-press validator, and DateTime.TryParse() for the completion validator.
    Oh - and there is another regex validator:
    ^[0-9]{4}-(((0[13578]|(10|12))-(0[1-9]|[1-2][0-9]|3[0-1]))|(02-(0[1-9]|[1-2][0-9]))|((0[469]|11)-(0[1-9]|[1-2][0-9]|30)))$
    which matches the yyyy-mm-dd date format and also validates month and number of days in a month. Could be improved as currently all leap year dates (yyyy-02-29) will validate.
    Sorry if I couldn't be of more help...
    Edited by: JoKiLlSyA on Oct 9, 2008 11:22 PM

  • Dequeue method hangs

    All,
    on our sun solaris OS 5.6 we run oracle database server 8.1.6 and AQ server 8.1.6. We use jdbc thin (classes12.zip) oracle8i 8.1.6.2.0 JDBC Driver for jdk 1.2.x .
    We use the AQ api from our java backend to dequeue messages from the AQ server. It happens time to time that this method hangs. The error is hard to reproduce and does happen after the backend has been running for a while, usually a few hours.
    Any hints for the reason of this are greatly appreciated.
    Thanks Ben: [email protected]
    Below is the stack thrace of the thread that hangs:
    Thread-2:
    [1] java.net.SocketInputStream.socketRead (native method)
    [2] java.net.SocketInputStream.read (SocketInputStream:90)
    [3] oracle.net.ns.Packet.receive (pc 32)
    [4] oracle.net.ns.NetInputStream.getNextPacket (pc 48)
    [5] oracle.net.ns.NetInputStream.read (pc 21)
    [6] oracle.net.ns.NetInputStream.read (pc 5)
    [7] oracle.net.ns.NetInputStream.read (pc 6)
    [8] oracle.jdbc.ttc7.MAREngine.unmarshalUB1 (MAREngine:718)
    [9] oracle.jdbc.ttc7.MAREngine.unmarshalSB1 (MAREngine:690)
    [10] oracle.jdbc.ttc7.Oall7.receive (Oall7:372)
    [11] oracle.jdbc.ttc7.TTC7Protocol.doOall7 (TTC7Protocol:1330)
    [12] oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch (TTC7Protocol:757)
    [13] oracle.jdbc.driver.OracleStatement.executeNonQuery (OracleStatement:1313)
    [14] oracle.jdbc.driver.OracleStatement.doExecuteOther (OracleStatement:1232)
    [15] oracle.jdbc.driver.OracleStatement.doExecuteWithBatch (OracleStatement:1353)
    [16] oracle.jdbc.driver.OracleStatement.doExecute (OracleStatement:1760)
    [17] oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout (OracleStatement:1807)
    [18] oracle.jdbc.driver.OraclePreparedStatement.executeUpdate (OraclePreparedStatement:332)
    [19] oracle.jdbc.driver.OraclePreparedStatement.executeQuery (OraclePreparedStatement:283)
    [20] oracle.AQ.AQOracleQueue.dequeue (AQOracleQueue:1356)
    [21] oracle.AQ.AQOracleQueue.dequeue (AQOracleQueue:1132)

    Folks,
    I have read this post with great interest related to the AQ dequeue problems reported. We got the same problem and I am wondering that whether you have found the solution to the problem.
    Your help is highly appreciated.
    Thanks,
    Yibing

  • Parse method of JAXP DocumentBuilder using InputStream

    I am having some problem. I am working on a generic XML messaging client server pair. The crux of it is that I am using the Transformer object to send data from the client to the server, using a Socket InputStream. The I do exactly the same from the server side to the client side.
    Example (client side):
    OutputStream out = socket.getOutputStream();
    Transformer transformer =
    TransformerFactory.newInstance().newTransformer();
    transformer.transform(new DOMSource(request),
    new StreamResult(out));
    Example (server side, in the thread for the connection):
    InputStream in = socket.getInputStream();
    DocumentBuilder builder =
    DocumentBuilderFactory.newInstance
    ().newDocumentBuilder();
    Document request = builder.parse(in);
    The problem I am experiencing is that the parse method on the server side is never completing. The parse method does not return at all. I can understand that this is due to the InputStream still being open, and need to know how can I let the parse method know that I am done writing to the OutputStream at the client side. Should I be sending an EOF character of sorts? If I should, what byte value represents this, and what do I need to do?
    Thank you
    Heinrich Pool

    Sorry hadn't noticed the Code Tags before. So the code formatted
    package de.gaskin.xml;
    import de.gaskin.buf.Buffer;
    import de.gaskin.io.LineArray;
    import de.gaskin.util.Debug;
    import java.net.Socket;
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.io.ByteArrayOutputStream;
    import java.io.ByteArrayInputStream;
    import java.io.File;
    import java.util.Vector;
    import org.w3c.dom.Document;
    A Simple to use generic XML Document transfer based on sockets.
    <H2>Theory of Operation.</h2>
    <p>A client sends an array of lines (an XML document) prepended by a line
    that ONLY contains an integer (the number of lines in the document that
    follows).
    <p>The server reads the first line (so that it knows how many lines belong to
    the next document) it then reads the specified number of lines into memory and
    when all lines have been read in passes them (as an InputStream) to an
    XMLParser to produce an XML DOM that is made available through the<br>
    <code>getDocument()</code> method.
    <h2>API</h2>
    The API is very simple to use as the following templates demonstrate.
    <h3>Client</h3>
    <pre>
        public class MyXmlSocketClient extends XmlSocket {
           MyXmlSocketClient(String serverAddress, String fileName) {
              super(serverAddress, 4711);
              run(fileName);
    </pre>
    <h3>Server Worker</h3>
        <pre>
        public class MyXmlSocketServer extends XmlSocket {
           MyXmlSocketServer(Socket s) {
              super(s);
           public void run() {
              Document doc = getDocument();
              // Process document
        </pre>
    <h3>Server Listener</h3>
        <pre>
        public class MyXmlServer {
           ServerSocket ss;
           boolean      stop;
           MyXmlSocketServer() {
              stop = false;
              try {
                 ss = new ServerSocket(4711);
                 while (! stop) {
                    Socket s = ss.accept();
                    new Thread(new MyXmlServerSocket(s));
              catch (Exception x) {
                 x.printStackTrace();
        </pre>
    <P>Last updated 10th Jan 2001.
    @author  David. M. Gaskin.
    @version Version 1.0 Oct 2000
    @since    Version 1.0
    public class XmlSocket implements Runnable {
       final static boolean debug = false;
       protected BufferedReader  data;
      /* protected */ public PrintWriter     pw;
                 Socket          socket;
       public XmlSocket(String domain, int port) {
          try {
             socket = new Socket(domain, port);
             common(socket);
          catch (Exception x) {
    //       x.printStackTrace();
             throw new Error(x.toString());
       public XmlSocket(Socket s) {
          socket = s;
          common(s);
       void common(Socket s) {
          try {
             data = new BufferedReader(new InputStreamReader(s.getInputStream()));
             pw   = new PrintWriter(s.getOutputStream(), true);
          catch (Exception x) {
    //       x.printStackTrace();
             throw new Error(x.toString());
       public Document getDocument() {
          Document rc = null;
          try {
             String line = data.readLine();
             int    linesInDoc = Integer.parseInt(line.trim());
             if (linesInDoc != -1) {
                ByteArrayOutputStream os = new ByteArrayOutputStream();
                for (int i = 0;i < linesInDoc;i++) {
                   line = data.readLine();
                   System.out.println(line);
                   byte[] byteLine = line.getBytes();
                   os.write(byteLine, 0, byteLine.length);
    //          System.out.println("END");
                rc = XmlFactory.readIn(new ByteArrayInputStream(os.toByteArray()));
          catch (Exception x) {
             x.printStackTrace();
          return rc;
       public void run(Vector lines) {
          int loopCnt = lines.size();
          if (debug) {
             println("" + loopCnt);
             for (int i = 0;i < loopCnt;i++) {
                println((String)lines.elementAt(i));
    //       pw.flush();
             println("-1");
          else {
             pw.println("" + loopCnt);
             for (int i = 0;i < loopCnt;i++) {
                pw.println((String)lines.elementAt(i));
    //       pw.flush();
             pw.println("-1");
          pw.flush();
       void println(String s) {
          System.out.println(s);
          pw.println(s);
       public void run() {
          Debug.d(this, "run", "S H O U L D   N E V E R   B E   I N V O K E D");
       public void run(String filename) {
          Buffer[] input = LineArray.readIn(filename);
          send(input);
       public void run(File file) {
          Buffer[] input = LineArray.readIn(file.getAbsolutePath());
          send(input);
       void send(Buffer[] input) {
          int loopCnt = input.length;
          pw.println("" + loopCnt);
          for (int i = 0;i < loopCnt;i++) {
             pw.println(input.toString());
    pw.flush();
    pw.println("-1");
    pw.flush();
    public int getDocIdx(String[] roots, Document doc) {
    int rc = -1;
    String rootName = doc.getDocumentElement().getTagName();
    int loopCnt = roots.length;
    for (int i = 0;i < loopCnt;i++) {
    if (rootName.equals(roots[i])) {
    rc = i;
    break;
    if (rc < 0)
    System.out.println(rootName + " N O T F O U N D");
    return rc;
    public Socket getSocket() {
    return socket;
    For testing only
    public static void main(String[] args) {
    XmlSocket xmlS = new XmlSocket("localhost", 36);
    xmlS.getDocument();

Maybe you are looking for

  • In Lion, how do I access a user library in a backup?

    I am trying to retrieve an iPad backup, but Apple hid the user library not only in my account, but also in my backups! How do I get to my library in a backup? I already know how to get it to show in my active account(option+click "Go"), I just want o

  • I WANT TO DELETE MY ACCONT

    IM SO SICK OF THIS! I'VE TRIED ALL OF THE INSTRUCTIONS OF HOW TO DELETE/UNLINK MY SKYPE ACCOUNT FROM MY MICROSOFT ACCOUNT. NO INFORMATION IS HELPFULL. NORE DOES THE INFORMATION STAND FOR SOMETHING REAL. I'M REALLY ANGRY AS YOU CAN TELL. I ALSO TRIED

  • List of files in Windows folder

    Hi, It wanted to know if it is possible to get the liste of file from a folder on the server with PL-SQL Thanks,

  • Finally a solution!

    Hello everyone, Many of you have heard of my issue that first began when I personally screwed up my Superdrive and then a snowball of issues cropped up while in repair; bad RAM, bad Logic board, etc. Well, after about nearly a month of waiting and co

  • Oracle Inferface Invoices Rejects Canadian Tax Code

    Hi to All, Today we incountered Oracle Interface Invoice issue where a invoice with Canadian Tax Code "HST" was rejected. Researching the Open Interface Invoice Lines we can see for the invoice the tax code "HST". But when we go to quick invoices and