SAX parsers hanging (crimson and xerces) on InputStream

Hi,
While searching I've seen a lot of postings about sax parsers hanging on InputStreams. Many have no replies, some do. So far I've tried several fixes mentioned to no avail. I've seen it hang in the startDocument() and hang after reading the entire document. All sorts of hangs . . . Oh and in some situations it works fine, but that's not good enough.
1. I tried wrapping the InputStream as described at the jdom.org FAQ with my own InputStream that hides the close() call. Then I pass my wrapper InputStream to the saxparser.parse() method. This didn't work, because you need to wrap SocketInputStream, not InputStream and SocketInputStream has package permissions which keep me from inheriting from it. If somebody can shed some light on how to do this, I'll try again, but for now that approach is shelved.
2. I tried adding an EOF character, 0x1A, to the end of the xml string being sent over the socket. The parser still hangs.
Any more suggestions?
Thanks,
Steve

Here's a faq question and answer from jdom.org. Can anybody explain how to do this in more detail? He mentions two workarounds. I've done the second and it works fine, but I'd prefer to get the first workaround working instead -- the wrapper InputStream idea.
Why does passing a document through a socket sometimes hang the parser?
The problem is that several XML parsers close the input stream when they read EOF (-1). This is true of Xerces, which is JDOM's default parser. It is also true of Crimson. Unfortunately, closing a SocketInputStream closes the underlying SocketImpl, setting the file descriptor to null. The socket's output stream is useless after this, so your application will be unable to send a response. To workaround, protect your socket's input stream with an InputStream wrapper that doesn't close the underlying stream (override the close() method), or read everything into a buffer before handing off to the JDOM builder:
byte[] buf = new byte[length];
new DataInputStream(inputStream).readFully(buf);
InputStream in = new ByteArrayInputStream(buf);
(Contributed by Joseph Bowbeer)

Similar Messages

  • 10g AS & FOP SAX Parsers

    Hi,
    Im deploying an application with FOP on 10g AS, FOP uses SAX parsers to generate PDF docs. On 10g I get the following error:-
    2008-01-28 18:05:22,648[<UNKNOWN>][DEBUG] FOIOHelper.convertFOToPDF run
    2008-01-28 18:05:22,649[<UNKNOWN>][INFO] Using oracle.xml.parser.v2.SAXParser as SAX2 Parser
    2008-01-28 18:05:22,649[<UNKNOWN>][INFO] building formatting object tree
    2008-01-28 18:05:22,649[<UNKNOWN>][INFO] setting up fonts
    2008-01-28 18:05:22,652[<UNKNOWN>][ERROR] Exception>>
    java.lang.NullPointerException
    at org.apache.fop.fo.PropertyManager.getTextDecoration(PropertyManager.java:365)
    at org.apache.fop.fo.FObjMixed.<init>(FObjMixed.java:72)
    Sometime when the batch process that calls this code runs, on the same server without bouncing, i get the following error:-
    2008-01-28 15:56:44,798[<UNKNOWN>][DEBUG] FOIOHelper.convertFOToPDF run
    2008-01-28 15:56:44,799[<UNKNOWN>][INFO] Using org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser as SAX2 Parser
    2008-01-28 15:56:44,809[<UNKNOWN>][INFO] building formatting object tree
    2008-01-28 15:56:44,812[<UNKNOWN>][INFO] setting up fonts
    2008-01-28 15:56:44,907[<UNKNOWN>][ERROR] Exception>>
    java.lang.NullPointerException
    at org.apache.fop.fo.PropertyManager.getTextDecoration(PropertyManager.java:365)
    at org.apache.fop.fo.FObjMixed.<init>(FObjMixed.java:72)
    This code works in the dev env which is RAD on Websphere, using xerces, and I have been told it used to work on Oracle 9.
    I have the xerces jar in the orion-application.xml as a library path, and in the manifest classpath of the application jar in the ear, but Oracle seems to be randomly running different SAX parsers. Is there a way to 100% guarantee only the jar files in the ear are run by the application, as I know these work?

    Here's a faq question and answer from jdom.org. Can anybody explain how to do this in more detail? He mentions two workarounds. I've done the second and it works fine, but I'd prefer to get the first workaround working instead -- the wrapper InputStream idea.
    Why does passing a document through a socket sometimes hang the parser?
    The problem is that several XML parsers close the input stream when they read EOF (-1). This is true of Xerces, which is JDOM's default parser. It is also true of Crimson. Unfortunately, closing a SocketInputStream closes the underlying SocketImpl, setting the file descriptor to null. The socket's output stream is useless after this, so your application will be unable to send a response. To workaround, protect your socket's input stream with an InputStream wrapper that doesn't close the underlying stream (override the close() method), or read everything into a buffer before handing off to the JDOM builder:
    byte[] buf = new byte[length];
    new DataInputStream(inputStream).readFully(buf);
    InputStream in = new ByteArrayInputStream(buf);
    (Contributed by Joseph Bowbeer)

  • Org.apache.crimson and 1.5

    I am trying to test an application in 1.5 and am getting compile errors for crimson references in classes someone else wrote.
    Looking at the JDK src, it looks like the apache packages are not bundeled in to the 1.5 beta.
    Wth the preface that I am mostly a Swing developer my questions are...
    I know it has to do with XML, but what specific functionality did crimson bring to the tale?
    Why did Sun remove the apache libs from the distribution?
    Is there anything in 1.5 to take crimsons place.
    Thanks for your time if you answer,
    Todd

    Looking at the JDK src, it looks like the apache
    packages are not bundeled in to the 1.5 beta.That's correct. The only contract is to supply an XML processor, not a specific one. Crimson is just one; Xerces is the most popular one out there. Looks like 1.5 includes a subset of Xerces (with a different package - com.sun.org.apache.xerces.internal).
    I know it has to do with XML, but what specific
    functionality did crimson bring to the tale?Nothing special. It was just a lightweight XML implementation.
    Why did Sun remove the apache libs from the distribution?
    Is there anything in 1.5 to take crimsons place.It's just replaced them with something they felt they could maintain better.
    You should not ever be referring to Crimson classes directly. You should ONLY use org.w3c.dom or org.w3c.sax classes directly, and use the advertised Factory APIs to create or manipulate Documents, Elements, etc.
    Your best bet is to rip out all references to org.apache.crimson, and use an elementary XML textbook to replace them with references to standard org.w3c.* classes.

  • Process Chain hangs on AND process

    Help Super gurus!
    I've tried several versions of a chain that loads multiple InfoPackages serially then multiple DTP in parallel using filtering from the PSA to a DSO. All load successfully. Then I have the DTPs all meet at an 'AND' process before processing should continue to a cube.
    The 'AND' process also shows green but it does not continue to the next process step. It just stops there, no more jobs running, no yellow, nothing. It thinks it's all done, everything after that is still blue.
    Why does it hang there and what can I do to get it to continue?
    Thanks,
    Al
    Points available.

    Hi,
    Not sure what is the root cause in your case.
    Try this. It may work. Normally this is done after a step turns red and no repeat is available.
    Method 1 (when it fails in a step/request)
    /people/siegfried.szameitat/blog/2006/02/26/restarting-processchains
    How is it possible to restart a process chain at a failed step/request?
    Sometimes, it doesn't help to just set a request to green status in order to run the process chain from that step on to the end.
    You need to set the failed request/step to green in the database as well as you need to raise the event that will force the process chain to run to the end from the next request/step on.
    Therefore you need to open the messages of a failed step by right clicking on it and selecting 'display messages'.
    In the opened popup click on the tab 'Chain'.
    In a parallel session goto transaction se16 for table rspcprocesslog and display the entries with the following selections:
    1. copy the variant from the popup to the variante of table rspcprocesslog
    2. copy the instance from the popup to the instance of table rspcprocesslog
    3. copy the start date from the popup to the batchdate of table rspcprocesslog
    Press F8 to display the entries of table rspcprocesslog.
    Now open another session and goto transaction se37. Enter RSPC_PROCESS_FINISH as the name of the function module and run the fm in test mode.
    Now copy the entries of table rspcprocesslog to the input parameters of the function module like described as follows:
    1. rspcprocesslog-log_id -> i_logid
    2. rspcprocesslog-type -> i_type
    3. rspcprocesslog-variante -> i_variant
    4. rspcprocesslog-instance -> i_instance
    5. enter 'G' for parameter i_state (sets the status to green).
    Now press F8 to run the fm.
    Now the actual process will be set to green and the following process in the chain will be started and the chain can run to the end.
    Of course you can also set the state of a specific step in the chain to any other possible value like 'R' = ended with errors, 'F' = finished, 'X' = cancelled ....
    Check out the value help on field rspcprocesslog-state in transaction se16 for the possible values.
    Thanks,
    JituK

  • I am trying to install Adobe Reader my wife's laptop but "installer" hangs up and fails with a blank black screen. The machine is capable and has a Vista OS. My wife blames the machine and wants to "throw it out." She's an idiot but I need to get this fix

    I am trying to install Adobe Reader my wife's laptop but "installer" hangs up and fails with a blank black screen. The machine is capable and has a Vista OS. My wife blames the machine and wants to "throw it out." She's an idiot but I need to get this fixed.

    run the cleaner (Download Adobe Reader and Acrobat Cleaner Tool - Adobe Labs) and then retry installing.

  • HT1338 Facebook doesn't open in safari on my MacBook Pro, why? Sometimes it opens and aftersome time just hang on and after that doesn't open at all.

    Facebook doesn't open in safari on my MacBook Pro, why? Sometimes it opens and aftersome time just hang on and after that doesn't open at all.

    There seems to be a few bugs with iCloud Mail at times, so send Apple feedback. They won't answer, but at least will know there is a problem. If enough people send feedback, it may get the problem solved sooner.
    Feedback
    Apple support article, but I don't think it really addresses your problem.
    iCloud - Mail Troubleshooting

  • Why does firefox hang up and say it "got confused", when I try to switch from using facebook as myself to using facebook as a page I manage?

    firefox hangs up and says it "got confused", when I try to switch from using facebook as myself to using facebook as a page I manage.

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    * Don't make any changes on the Safe mode start window.
    * https://support.mozilla.com/kb/Safe+Mode
    If it does work in Safe-mode then disable all extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    * Use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    * Close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")
    In Firefox 4 you can use one of these to start in <u>[[Safe mode]]</u>:
    * Help > Restart with Add-ons Disabled
    * Hold down the Shift key while double clicking the Firefox desktop shortcut (Windows)
    * https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • HT4623 I was installing the ios 6 on my iphone 3GS and an error occured and since then it's hanged up and not working. Please suggest some solution

    I was installing the ios 6 on my iphone 3GS and an error occured and since then it's hanged up and not working. Please suggest some solution

    the same thing here! each time its suppose to register with my network, it cant. im wondering if its a hardware problem

  • One user's created PDFs have started to crash/hang Preview and PDFPen

    All the PDFs scanned in and sent to me by a particular user crash or hang Preview and PDFPen – but not Acrobat which opens them just fine. The odd thing is that this user's PDFs did not have such an effect on the apps until I did a Software Update (don't know what got updated but some Java libs were updated). The other odd thing is that no other PDFs except those scanned in by this one user, including those that used to open before, crash/hang the apps. And the third odd thing is that they crash/hang Preview and PDFPen but not Acrobat. (Do Preview and PDFPen share some common libs but not Acrobat?)
    I would attach one such PDF for PDF techies to see what the problem may be but Apple Discussions doesn't allow file attachments as far as I can see. Therefore I've appended below the beginning of one such PDF file if it helps.
    %PDF-1.3
    2 0 obj
    << /Length 4 0 R /Filter /FlateDecode >>
    stream
    ???7?߫???????????>k0@.??7??:?3??HQRk???ɮކ
    ??????}???????????ǿ??W?????????n?W??_????W|??wmMF_?M????y?7?ӋF??M?A?S/??ǟ????????~}??????????????/?鿽\???Q-?`0?Dp?????Z?M??????R6?BЎ>?9?|?A??0'?!?qJ??B6?וg?.??BsJt^?M+{hWP? ????C4???(g?+?ў?l?0?
    U#n?|?~d?;$????9nV?=Z?"-b
    ?Q?kBQ???Br4?dX8?3Q?{hg;?ZF&??????3)8x2????:*(???t?W?ڡ?O??Uh?&d?>????
    ?P?]@5B???6(?7?L???`2-!G;?\??-??}.?
    ?c?`2??α??z?q?$?&@h?ҥ?eA?։րM?- _?q??޾R??֫D??zM??r?Zg(????
    qA/? ?$??O??za2.??Ƚ??????F?? ?(??2??9?.??th??]0??J
    rVG,B?z?h??t?dxK?

    @BDAqua, Thank you for checking and for your reply. I'm using Preview 3.0.9 (409) on 10.4.11. Did you cover that?
    What do you mean by 'here'? I'm not a regular here (I mean the forum) so do you by any chance mean Infinite Loop? If so, maybe you could tell me what/which lib I can look at or into? Interesting to know that PDFPen indeed uses the system's PDF libs but Acrobat doesn't.
    There's definitely something different about the referred-to PDF and all other PDFs created by this user (which are scanned in on some Xerox scanner) and I'd love to know what it is.
    Thanks.

  • XALAN and XERCES on WL6

    Hi!
    I just can't get WLS6.0 to use new versions of XALAN and XERCES. I keep
    getting errors that are obviously because Weblogic is loading an older
    version of XALAN before my app ever gets loaded, and as a result I'm having
    trouble with <xsl:param> and <xsl:variable> tags not being able to recognise
    other params and variables in the top level scope. This is crucial to my
    application but after a day of messing around with everything from
    classpaths to startweblogic.cmd, I'm pretty much stuck.
    Does ANYONE know how to fix this?
    TIA,
    Navneet

    Hmm.. what's this I'm hearing about an XML registry for weblogic?
    "Jeffrey Winter" <[email protected]> wrote in message
    news:3ae702c5$[email protected]..
    >
    If you put the latest xerces.jar and xalan.jar file before anything elsein the
    CLASSPATH in your startup command file it will work. I'm doing in rightnow with
    Xerces 1.3.1 and Xalan 2.0.1.
    If you're trying to use JAXP however, you'll have problems because WLalways returns
    their own internal version of the DocumentBuilderFactory even if you putthe JAXP
    1.1 jar file in the class path and specify theorg.apache.xerces.jaxp.DocumentBuilderFactory
    in your registry.
    We got around this by defining a stub subclass of DocumentBuilderFactoryand instantiating
    is directly instead of through DocumentBuilderFactory.newInstance(). It'sa pain,
    but after that you can get around using the older versions that they'vebaked
    in.

  • [svn:fx-trunk] 7796: get the correct locales of batik and xerces jars into the build

    Revision: 7796
    Author:   [email protected]
    Date:     2009-06-12 13:01:48 -0700 (Fri, 12 Jun 2009)
    Log Message:
    get the correct locales of batik and xerces jars into the build
    bug: https://bugs.adobe.com/jira/browse/SDK-21565
    qa: i18n team (make sure they're all there)
    checkintests: pass
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-21565
    Modified Paths:
        flex/sdk/trunk/build.xml

    Originally posted by: rosec.messagingdirect.com
    I'll look into it; I'm a bit under the gun here and can't easily upend
    my development environment at this time, but hopefully I can look into
    it early next week. Thanks for the pointer.
    Daniel Megert wrote:
    > Chris Rose wrote:
    >> I don't know if this has been asked before (and you'd be amazed at how
    >> hard it is to find specific information when your search query is
    >> "eclipse 100% cpu usage opening class files in a jar"!) but, well,
    >> that's what I'm getting:
    >>
    >> When I open a class file in the editor that is contained in a jar file
    >> anywhere on a Java project's classpath, one of my processor pegs at
    >> 100% usage for anywhere from 15-120 seconds and eclipse becomes
    >> non-responsive for that period of time, not even redrawing the UI.
    >>
    >> This occurs for jars as large as the jboss client jar and the weblogic
    >> 80Mb uber-jar and for jars as small as a 241kb library jar.
    >>
    >> Is there anything I can do to track down WHY this is happening? I end
    >> up having to trace into third party code a lot while debugging
    >> container behaviour and this plays merry havoc with the timeouts for
    >> remote calls, so I'm quite motivated to suss out why it's happening.
    >>
    >> Eclipse details are attached.
    > There was a bug regarding big JARs on the build path. Can you try
    > whether this still happens using 3.4 M7. If so, please file a bug report
    > with steps to reproduce. Also, please create some stack dumps while
    > waiting and attach them to the bug report.
    >
    > Dani
    Chris Rose
    Developer Planet Consulting Group
    (780) 577-8433
    [email protected]

  • I can build my iPhoto book book but it will not upload. It hangs up and asks me to retry. endless loop.

    I can build my iphoto book, but it will not upload. It hangs up and asks me to retry. endless loop.

    Five Steps to a Great Book / Cards / Calendars - http://support.apple.com/kb/HT2536.
    How To Preview a Book / Card / Calendar Order - http://support.apple.com/kb/HT1040.
    First preview the book to ensure that all the pictures appear fine in the preview. 
    What is the exact error you are getting, as this may help determine what you need to do for a resolution.
    Also, try to connect to the internet direct wire instead of wireless for best results. 

  • Weblogic 8.1 with Xalan 2.6.1 and Xerces 2.6.2 ?!?

    Hi,
    I'm trying to use Xalan 2.6.1 and Xerces 2.6.2 with Weblogic 8.1SP2, but no result yet...
    I found docs on bea website:
    http://edocs.bea.com/wls/docs81/pdf/faq.pdf
    http://e-docs.bea.com/wls/docs81/xml/xml_admin.html
    where I found this:
    "Warning: In version 8.1 of WebLogic Server, you can plug in only the following versions of the Apache Xerces parser:
    Xerces 2.2.0
    Xerces 2.3.0
    Xerces 2.4.0
    In addition, you can plug in only those versions of the Apache Xalan transformer that are compatible with the preceding versions of the Apache Xerces parser."
    I can't find any solution to this?
    I tried various option:
    - xercesImpl2.6 in the classpath variable
    - xalan2.6.2 in the endorsed lib
    - registered factory impl names in xml registry
    - prefer web-inf set to true
    Errors result in following exception:
    - NoMethodFound (rhino classes inside weblogic.jar)
    - ClassCast (xalan/xerces conflicts)
    Any one has suggestions?
    Regards
    Leonardo

    According to that link your right it is not supported.
    Have you tried adding the xerces jars at the beginning of the classpath?

  • HT4623 Ater installing IOS 6 for my iphone 4,some apps are hang sometimes and Mail apps totally hang ,tried to reset again and again but still hang

    Ater installing IOS 6 for my iphone 4,some apps are hang sometimes and Mail apps totally hang ,tried to reset again and again but still hang.How to solve this problem??

    well in thatcase, i need another help .
    thanks for your instant reply.
    i have currently bought a new laptop (windows 8) and my iphone is not being recognized by itunes.
    because i have no backup on my previous laptop, i downloaded touchcopy but even touch copy is not recognizing my iphone.

  • Weblogic and xerces and xalan

    I understand that xerces and xalan are a part of the weblogic's distribution.
    Will BEA also upgrade to newer versions of these softwares as they are available?
    If not how do I use newer versions of these softwares with weblogic.
    This is becoming a critical issue for us as I already see a remarkable difference
    in performance while doing transformations. The newer versions of xalan and xerces
    are performing much better with the same xml and xsl documents as compared to
    the previous versions.

    According to that link your right it is not supported.
    Have you tried adding the xerces jars at the beginning of the classpath?

Maybe you are looking for

  • Firefox29, on a new win7 computer which has never had ff installed, will not install the latest flash plugin from adobe.

    I promise to refrain from venting my disgust :-) but when FF 9 blew up the entire web. I had all kinds of issues so I did things like Bill Gates taught us to do. I re-installed windows 7, brand new, formatted HD and all. The very first thing I did wa

  • Q ab. Hard Drive upgrade; PATA/SATA, S.M.A.R.T., HDD Controler

    I have a few questions about replacement hard drives for my PowerBook G4 12" 1.0 GHz DVI. (I am also going to upgrade the hard drive in my wife's Powerbook G4 15" 1.33 GHz Combodrive, but I think the questions/answers below will apply to both. I'll j

  • Help Moving iWeb site to a windows PC

    My objective is to create a site using iWeb and move that site to a standalone PC and use Firefox to read the site folder and run the site. Not needing any internet. The files are too large anyway. I have created the iWeb site with many videos from i

  • Link with table CAWN and MSEG

    Hi Friend how can i link with clasification fields(CAWN-ATWRT) with meterial document no(MSEG-MBLNR) in MM in the transaction migo. Thanks and Regards D Tarun Kumar Edited by: Devalla Tarun Kr. on Sep 9, 2008 2:29 PM

  • New iOS 7.0.4 Update HELP!!!!!!!!

    I just installed the newest software update to my iPod Touch. Before the update, I was able to play a specifc album by an artist. Now with the update, I can start at a specific album, but it keeps going through all the songs by that artist. I can't j