Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

...TransformerException: Broken pipe

Stanley George
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am getting this exception while sending and XML document from a client to a server. It works the first time, but not after that.
I have a server which is listening for client connections. When a client connects, it spawns a new thread (ClientHandler) to handle this client. The client sends and XML document to the server. The server prints this out.
The code works fine for the first client. For the next client it gives me the following exception: Broken pipe
at org.apache.xalan.transformer.TransformerIdentityImpl.transform(
The same code works for multiple clients if I am not sending the XML Document.
This is where the error occurs:
public void tcpSendXMLDoc(Document doc, Socket socket) {
throws IOException, TransformerException,TransformerConfigurationException {
// Use a Transformer for output
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();

ObjectOutputStream oos =
new ObjectOutputStream(socket.getOutputStream());
ObjectInputStream ois =
new ObjectInputStream(socket.getInputStream());

DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(oos);
transformer.transform(source, result);
The Error is show at the last line:
transformer.transform(source, result);
What could be wrong?
Stanley George
[ April 09, 2004: Message edited by: Stanley George ]
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic