aspose file tools*
The moose likes I/O and Streams and the fly likes WRONG_DOCUMENT_ERR in load test Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "WRONG_DOCUMENT_ERR in load test" Watch "WRONG_DOCUMENT_ERR in load test" New topic
Author

WRONG_DOCUMENT_ERR in load test

Karthik Raja k
Greenhorn

Joined: Mar 09, 2011
Posts: 2
I'm facing an issue while executing the load test on a ESB service

While testing for single thread instance on JBOSS 5.0.2 & open JDK 1.6 everything works fine.

But while performing load test for 20 threads following errors appears in the logs for all the requests.

ERROR [SendSmsImpl] org.w3c.dom.DOMException: WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it.
org.w3c.dom.DOMException: WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it.
at org.apache.xerces.dom.ParentNode.internalInsertBefore(Unknown Source)
at org.apache.xerces.dom.ParentNode.insertBefore(Unknown Source)
at org.apache.xerces.dom.NodeImpl.appendChild(Unknown Source)
at org.jboss.ws.core.soap.NodeImpl.appendChild(NodeImpl.java:484)
at org.jboss.ws.core.soap.SOAPContentElement.appendChild(SOAPContentElement.java:440)
at org.jboss.ws.core.soap.SOAPElementImpl.addChildElement(SOAPElementImpl.java:273)
at org.jboss.ws.core.soap.SOAPContentElement.addChildElement(SOAPContentElement.java:188)
at org.jboss.ws.core.soap.XMLContent.expandContainerChildren(XMLContent.java:341)
at org.jboss.ws.core.soap.XMLContent.transitionTo(XMLContent.java:105)
at org.jboss.ws.core.soap.SOAPContentElement.transitionTo(SOAPContentElement.java:140)
at org.jboss.ws.core.soap.SOAPContentElement.expandToDOM(SOAPContentElement.java:502)
at org.jboss.ws.core.soap.SOAPContentElement.getChildNodes(SOAPContentElement.java:453)


the same ESB works fine in JBoss 4.3 environment.

To resolve above issue in JBOss 5.0.2 with open JDK 1.6 , as per suggestion mentioned in the below URL
https://issues.jboss.org/browse/JBWS-3095


We cloned the SOAP Message object in the listener.

private SOAPMessage convertSoapMessage(SOAPMessage soapMessage)
throws SOAPException
{
String tempSoapMessage = getSoapMessageAsString(soapMessage);
javax.xml.soap.MessageFactory msgFactory = javax.xml.soap.MessageFactory
.newInstance();
SOAPMessage soapmessage = msgFactory.createMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
logger.info("String constructed from SOAP Message " + tempSoapMessage);
if (tempSoapMessage != null)
{
byte[] buffer = tempSoapMessage.getBytes();
ByteArrayInputStream stream = new ByteArrayInputStream(buffer);
StreamSource source = new StreamSource(stream);
soapPart.setContent(source);
try
{
logger.info(" SOAP Message Constructed from String = > ");
soapmessage.writeTo(System.out);
}
catch (IOException e)
{
….
}
}
else
{

}
return soapmessage;
}


private String getSoapMessageAsString(SOAPMessage soapMessage)
{

ByteArrayOutputStream baos = new ByteArrayOutputStream();
String encoding = "utf-8";
String soapRequest = null;

try
{
if (soapMessage.getProperty(SOAPMessage.CHARACTER_SET_ENCODING) != null)
{
encoding = soapMessage.getProperty(
SOAPMessage.CHARACTER_SET_ENCODING).toString();
soapMessage.writeTo(baos);
}
}
catch (SOAPException e1)
{
e1.printStackTrace();
}
catch (IOException e1)
{
e1.printStackTrace();
}

try
{
soapRequest = baos.toString(encoding);
}
catch (Exception e)
{
e.printStackTrace();
}
return soapRequest;
}

Below is the error occurred, while permforming load test for 20 threads (error while writing into stream)


at org.jboss.ws.core.soap.SOAPElementImpl.writeElementContent(SOAPElementImpl.java:883)
at org.jboss.ws.core.soap.SOAPElementImpl.writeElement(SOAPElementImpl.java:868)
at org.jboss.ws.core.soap.SOAPElementImpl.writeElementContent(SOAPElementImpl.java:883)
at org.jboss.ws.core.soap.SOAPElementImpl.writeElement(SOAPElementImpl.java:868)
at org.jboss.ws.core.soap.SOAPElementWriter.writeElementInternal(SOAPElementWriter.java:147)
at org.jboss.ws.core.soap.SOAPElementWriter.writeElement(SOAPElementWriter.java:128)
at org.jboss.ws.core.soap.SOAPMessageImpl.writeTo(SOAPMessageImpl.java:353)
at com.test.util.getSoapMessageAsString(Unknown Source)
at com.test.util.convertSoapMessage(Unknown Source)
at com.test.util.getMessageHeader(Unknown Source)
at com.test.listeners.testImpl.getData(testListImpl.java:140)
at sun.reflect.GeneratedMethodAccessor507.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.wsf.container.jboss50.invocation.InvocationHandlerJSE.invoke(InvocationHandlerJSE.java:108)


Please help us to resolve the same

Regards

Karthik
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24168
    
  30

Why aren't you showing us the very top of that last stack trace? The exact wording of the error message might be important.


[Jess in Action][AskingGoodQuestions]
Karthik Raja k
Greenhorn

Joined: Mar 09, 2011
Posts: 2
java.lang.IllegalArgumentException: type: -1
at org.apache.xerces.dom.DeferredDocumentImpl.getNodeObject(Unknown Source)
at org.apache.xerces.dom.DeferredDocumentImpl.synchronizeChildren(Unknown Source)
at org.apache.xerces.dom.DeferredElementNSImpl.synchronizeChildren(Unknown Source)
at org.apache.xerces.dom.ParentNode.getChildNodes(Unknown Source)
at org.jboss.wsf.common.DOMWriter.printInternal(DOMWriter.java:261)
at org.jboss.wsf.common.DOMWriter.print(DOMWriter.java:233)
at org.jboss.ws.core.soap.XMLFragment.writeSourceInternal(XMLFragment.java:169)
at org.jboss.ws.core.soap.XMLFragment.writeTo(XMLFragment.java:146)
at org.jboss.ws.core.soap.SOAPContentElement.writeElement(SOAPContentElement.java:555)
at org.jboss.ws.core.soap.SOAPElementImpl.writeElementContent(SOAPElementImpl.java:883)
at org.jboss.ws.core.soap.SOAPElementImpl.writeElement(SOAPElementImpl.java:868)
at org.jboss.ws.core.soap.SOAPElementImpl.writeElementContent(SOAPElementImpl.java:883)
at org.jboss.ws.core.soap.SOAPElementImpl.writeElement(SOAPElementImpl.java:868)
at org.jboss.ws.core.soap.SOAPElementWriter.writeElementInternal(SOAPElementWriter.java:147)
at org.jboss.ws.core.soap.SOAPElementWriter.writeElement(SOAPElementWriter.java:128)
at org.jboss.ws.core.soap.SOAPMessageImpl.writeTo(SOAPMessageImpl.java:353)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WRONG_DOCUMENT_ERR in load test
 
Similar Threads
Soap response contains wsdl
SOAP message
SoapConnection timeout
Binding XML to Java from SOAP message
How to create a SOAP request Message from a sample XML