Hi all, I've got some more details: the error happens because the second message is sent with an empty body. The workaround is to make the thread sleep for (at least) 600 ms (unfortunately this is too much for my needs). Is there any reason or is it a bug? If it is not a bug, why it is not documented anywhere, since the tutorial for dual channel-non blocking clients [1] does not use any sleep call?
Thanks, Michele [1] http://ws.apache.org/axis2/1_0/userguide3.html#EchoNonBlockingDualClient Michele Mazzucco wrote: > Hi all, > > I get a very strange error (on the client side) when I try to send > multiple (equals, in my case: the submitted requests are the same of the > "echo" sample) requests to my service. The error happens *only* when > multiple requests are submitted, i.e., if the program sends only 1 > requests no errors happen. > > > > INFO StreamRequestMyServiceClient:main - Sending [2] requests > INFO StreamRequestMyServiceClient:send - Sent [2] requests > INFO StreamRequestMyServiceClient$QospCallback:onComplete - Received > respose [1/2] > INFO StreamRequestMyServiceClient$QospCallback:onComplete - > <soapenv:Body > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><client:echo > xmlns:client="http://org.ncl.ac.uk/qosp/clients/codestore" > xmlns:tns="http://ws.apache.org/axis2"><client:Text>QoSP Echo > String</client:Text></client:echo></soapenv:Body> > INFO StreamRequestMyServiceClient$QospCallback:onComplete - 1 are missing > ERROR StreamRequestMyServiceClient:logException - ERROR!: > ERROR StreamRequestMyServiceClient:logException - > org.apache.axis2.AxisFault: unknown > at > org.apache.axis2.util.CallbackReceiver.receive(CallbackReceiver.java:65) > at org.apache.axis2.engine.AxisEngine.receiveFault(AxisEngine.java:599) > at > org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:282) > at > org.apache.axis2.transport.http.HTTPWorker.service(HTTPWorker.java:238) > at > org.apache.axis2.transport.http.server.DefaultHttpServiceProcessor.doService(DefaultHttpServiceProcessor.java:177) > at > org.apache.http.protocol.HttpService.handleRequest(HttpService.java:123) > at > org.apache.axis2.transport.http.server.DefaultHttpServiceProcessor.run(DefaultHttpServiceProcessor.java:236) > at > edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) > at > edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) > at java.lang.Thread.run(Thread.java:595) > Caused by: java.lang.Exception: org.apache.axis2.AxisFault > at > org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver.invokeBusinessLogic(RawXMLINOnlyMessageReceiver.java:104) > at > org.apache.axis2.receivers.AbstractInMessageReceiver.receive(AbstractInMessageReceiver.java:34) > at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:503) > at > org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:284) > at > org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:144) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) > at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) > at > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) > at > org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667) > at > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) > at > org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) > at > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) > at java.lang.Thread.run(Thread.java:595) > > at org.apache.axis2.AxisFault.<init>(AxisFault.java:159) > ... 10 more > > > > > > > > > The following chunk of code submits the requests: > > /** > * Sends [EMAIL PROTECTED] #requests} requests to the cluster manager. > */ > private final void send() { > final OMElement payload = ClientUtils.getEchoOMElement(); > > // Creates and sets the options > Options options = new Options(); > > String routerEPR = System.getProperty("qosp.manager.epr"); > if (routerEPR == null) { > throw new RuntimeException("Unable to get the router EPR"); > } > routerEPR = routerEPR.concat("MyService"); > options.setTo(new EndpointReference(routerEPR)); > > > options.setAction("urn:echo"); > // The boolean flag informs the axis2 engine to use two separate > // transport connection to retrieve the response. > > options.setTransportInProtocol(Constants.TRANSPORT_HTTP); > options.setUseSeparateListener(true); > > options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); > > ServiceClient sender = null; > try { > sender = new ServiceClient(); > > sender.engageModule(RoutingConstants.MODULE_ADDRESSING); > sender.setOptions(options); > > QospCallback callback = new QospCallback(); > for (int i = 0; i < this.requests.get(); i++) { > sender.sendReceiveNonBlocking(payload, callback); > } > > if (log.isInfoEnabled()) { > log.info("Sent [" + this.requests.get() + "] requests"); > } > > // Wait till the callback receives the response. > while (!callback.isComplete()) { > try { > Thread.sleep(1000); > } catch (InterruptedException e) { > // > } > } > > } catch (AxisFault e) { > if (log.isEnabledFor(Level.ERROR)) { > logException(e); > } > } finally{ > try { > if (sender != null) > sender.finalizeInvoke(); > } catch (AxisFault axisFault) { > // > } > } > > } //-- send() > > while this is the callback object used to retrieve asynchronous responses: > > > > /** > * Sets the completion status. > * > * @param complete The completion status. > */ > @Override > public void setComplete(boolean complete) { > super.setComplete((requests.decrementAndGet() == 0)); > } //-- setComplete() > > > /** > * Gets the completion status. > * > * @return The completion status. > */ > @Override > public boolean isComplete() { > return (requests.get() == 0); > } //-- isComplete() > > /** > * Handles asynchronous results. > * > * @param result The asynchronous result. > */ > @Override > public void onComplete(AsyncResult result) { > this.setComplete(true); > if (log.isInfoEnabled()) { > log.info("Received respose [" + (++ this.success) > + "/" + this.toReceive + "]"); > > log.info(result.getResponseEnvelope().getBody().toString()); > } > if (this.isComplete()) { > log.info("All requests are complete"); > } else { > log.info(requests.get() + " are missing"); > } > } //-- onComplete() > > /** > * Handles asynchronous errors. > * > * @param e The exception. > */ > @Override > public void onError(Exception e) { > if (log.isEnabledFor(Level.ERROR)) { > logException(e); > } > } //-- onError() > > > > > Any idea? > > Thanks in advance, > Michele > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
