• Post Reply Bookmark Topic Watch Topic
  • New Topic

...TransformerException: java.net.SocketException: Broken pipe  RSS feed

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:
javax.xml.transform.TransformerException:java.net.SocketException: Broken pipe
at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:336)
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
Boost this thread!