Hi, I am having some threadsafety issues with testng tests run in parallel mode. The tests involve connecting to a webservice using spring-ws configured with xmlbeans marshalling. After reading [1], i was wondering if the thread safety issue could apply to my case. I will try to explain with a small block of code that does the webservice call
Object o1 = null; GetPaymentDocumentDocument1 requestDocument = null; try { requestDocument = GetPaymentDocumentDocument1.Factory.newInstance(); requestDocument.addNewGetPaymentDocument(); GetPaymentDocumentRequest request = GetPaymentDocumentRequest.Factory.newInstance(); requestDocument.getGetPaymentDocument().setRequest(request); o1 = PaymentWebService.marshalSendAndReceive(requestDocument); // POTENTIAL CCE BELOW GetPaymentDocumentResponseDocument responseDocument = (GetPaymentDocumentResponseDocument) o1; return responseDocument.getGetPaymentDocumentResponse().getDocument(); } catch (ClassCastException cce) { throw new RuntimeException( (o == null ? "NULL" : o.getClass() + "___" + o.getClass().getClassLoader()) + ">>>>" + GetPaymentDocumentResponseDocument.class.getClassLoader() + ">>>>>>\n" + o, cce); } In normal non-parallel testing, this code never fails. Recently however i switched the tests to be run in parallel through TestNG's parallel=methods feature, meaning that a thread pool is assigned to execute methods from the test class concurrently. Since then, the above block of code randomly throws CCE's when i try to cast the object returned from the webservice to the "GetPaymentDocumentResponseDocument". After doing some research i found that o1 as returned from the webservice in these cases is actually an instance of GetPaymentDocumentDocument1 (ie the request document) ! Could this problem be related to XmlBeans ? Following [1] I built xmlbeans myself from source a few weeks ago but that didn't change anything. Any thoughts would be greatly appreciated. I tried to narrow things down to a small testcase but i could never consistently reproduce it. Thanks ! Jorg [1] http://www.mail-archive.com/user@xmlbeans.apache.org/msg03818.html --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org For additional commands, e-mail: user-h...@xmlbeans.apache.org