[jdom-interest] Problem using Tip: Using JDOM and XSLT by Bre tt McLaughlin

Gordon, Simon Simon.Gordon at Galileo.com
Fri Oct 12 12:00:05 PDT 2001


I had the same problem and had to go back to using File I/O (which was the
whole point of the tip). I assumed that my 500kB document was just too much
for piped I/O to handle so I was glad when I saw your post just now.

On doing some further investigation into Piped I/O, I found this comment in
the Java v1.3 docs:-
QUOTE
A piped output stream can be connected to a piped input stream to create a
communications pipe. The piped output stream is the sending end of the pipe.
Typically, data is written to a PipedOutputStream object by one thread and
data is read from the connected PipedInputStream by some other thread.
Attempting to use both objects from a single thread is not recommended as it
may deadlock the thread. 
UNQUOTE

The last sentence is the killer. It seems that there must be some blocking
pipe-full condition that prevents the writer from completing the write and
allowing the reader to empty the pipe. Hence the need for 2 execution
threads.



-----Original Message-----
From: Jason Long [mailto:jason at jmlie.com]
Sent: Thursday, October 11, 2001 10:33 PM
To: jdom-interest at jdom.org
Subject: [jdom-interest] Problem using Tip: Using JDOM and XSLT by Brett
McLaughlin


I am attempting to make use of "Listing 1. Using JDOM with Xalan-J 2" which
can be found at the following url:
http://www-106.ibm.com/developerworks/java/library/x-tipjdom.html

Here is my system configuration:
W2K Advanced Server
JDK 1.4 beta 2
Tomcat 4.0 Final
JDOM beta 7

I have been working on a servlet that compiles a list of some files on my
server, parses their names, and generates an xml file.  For this JDOM worked
beautifully.  I had used SAX and DOM before and had many headaches.  Due to
JDOM's ease of use I had my application building the XML file in no time.
Now it was time to transform the XML using XSL so that it could be displayed
to match the rest of my site.  I simply pasted the transform method from
"Listing 1. Using JDOM with Xalan-J 2" in the previously mentioned tip and
added the appropriate jar files for Tomcat.  Everything compiled properly,
but my browser just hangs and never gets a reply.  I began by commenting out
all of the code and adding one line at a time until it began to fail.  Here
is where my code hangs:

// Output to the I/O stream
  xmlOutputter.output(sourceDoc, sourceOut);

Unless I comment out this line and the rest of the code that follows which
depends on this line the servlet never responds back.  It seems that I have
Xalan installed properly because the code previous to this point depends on
it and the point where the servlet freezes has nothing to do with it.  I
have yet to resolve this problem, but am very excited about JDOM.  I would
appreciate and assistance with this matter.

Best Regards,

Jason Long
JML Internet Enterprise - www.jmlie.com
BS Physics, MS Chemical Engineering

_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com



More information about the jdom-interest mailing list