[ 
https://issues.apache.org/jira/browse/AXIS2-5062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13084857#comment-13084857
 ] 

Andreas Veithen commented on AXIS2-5062:
----------------------------------------

I think that the problem is solved. Can you check, so that we can then merge 
the changes to the 1.6 branch?

> Connection is not released while using JAXWS client API
> -------------------------------------------------------
>
>                 Key: AXIS2-5062
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5062
>             Project: Axis2
>          Issue Type: Bug
>          Components: jaxws, transports
>    Affects Versions: 1.6.0
>            Reporter: Ivan
>              Labels: Geronimo
>         Attachments: AXIS2-5062-Dispatch.patch, AXIS2-5062-Port.patch
>
>
> 1. Using Dispatch API
> A bit more description for my case, the server side is a simple web service, 
> for the client side, the codes are something like :
> --->
> Service service = new HelloService();
> Dispatch dispatchJaxb = service.createDispatch(PORT_QNAME, 
> JAXBContext.newInstance(org.test.ObjectFactory.class),
> javax.xml.ws.Service.Mode.PAYLOAD);
> dispatchJaxb.invokeOneWay(new HelloRequest());
> <---
> After adding some code fragments in the finally block of 
> BaseDispatch.invokeOneWay method, it looks to me work fine.
> --->
> try {
>                 if (requestMsgCtx != null && 
> requestMsgCtx.getAxisMessageContext() != null) {
>                     org.apache.axis2.context.MessageContext axisMsgCtx = 
> requestMsgCtx.getAxisMessageContext();
>                     if (axisMsgCtx.getTransportOut() != null && 
> axisMsgCtx.getTransportOut().getSender() != null) {
>                         
> axisMsgCtx.getTransportOut().getSender().cleanup(axisMsgCtx);
>                     }
>                 }
>             } catch (Exception ignore) {
>             }
> <---
> I also googled this issue, and do found a lot of information for the same 
> timeout exception, also read some related codes
> a. In the HttpSender, there is a method named cleanup, which is used to 
> release the connection, but it has the precondition to configure the 
> AUTO_RELEASE_CONNECTION. And actually I did not see other setting 
> configurations in the Axis2 codes, and think that it should be configured by 
> the users in the Options ? 
> b. Some posts in the mail list recommended to call the 
> getTransport().cleanup() in the Axis2 specific client codes. And in the 
> testing scenario above, since the standard JAX-WS API is used, suppose that 
> Axis2 should do this ?
> And very appreciated with any comment ? Thanks.
> 2. I might find another connection leak while using JAXWS API on client side. 
> In the scenario below :
> For the server side, it requires basic authentication.
> The client codes are something like :
> HelloPort helloPort = (HelloPort)service.getPort(HelloPort.class);
> helloPort.echo("hello");
> The client codes did not set the user name and password by the 
> BindingProvider interface, so the server return a 404 to the client side, 
> then the method HttpSender.handleResponse will enter the fourth block :
> private void handleResponse(MessageContext msgContext,
>                                 HttpMethodBase method) throws IOException {
>         int statusCode = method.getStatusCode();
>         log.trace("Handling response - " + statusCode);
>         if (statusCode == HttpStatus.SC_OK) {
>             // Save the HttpMethod so that we can release the connection when 
> cleaning up
>             msgContext.setProperty(HTTPConstants.HTTP_METHOD, method);
>             processResponse(method, msgContext);
>         } else if (statusCode == HttpStatus.SC_ACCEPTED) {
>               /* When an HTTP 202 Accepted code has been received, this will 
> be the case of an execution
>                * of an in-only operation. In such a scenario, the HTTP 
> response headers should be returned,
>                * i.e. session cookies. */
>               obtainHTTPHeaderInformation(method, msgContext);
>               // Since we don't expect any content with a 202 response, we 
> must release the connection
>               method.releaseConnection();
>         } else if (statusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR ||
>                 statusCode == HttpStatus.SC_BAD_REQUEST) {
>             // Save the HttpMethod so that we can release the connection when 
> cleaning up
>             msgContext.setProperty(HTTPConstants.HTTP_METHOD, method);
>             Header contenttypeHeader =
>                     
> method.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
>             String value = null;
>             if (contenttypeHeader != null) {
>                 value = contenttypeHeader.getValue();
>             }
>              OperationContext opContext = msgContext.getOperationContext();
>             if(opContext!=null){
>                 MessageContext inMessageContext =
>                         
> opContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
>                 if(inMessageContext!=null){
>                     inMessageContext.setProcessingFault(true);
>                 }
>             }
>             if (value != null) {
>                 processResponse(method, msgContext);
>             }
>             if 
> (org.apache.axis2.util.Utils.isClientThreadNonBlockingPropertySet(msgContext))
>  {
>                throw new AxisFault(Messages.getMessage("transportError",
>                          String.valueOf(statusCode),
>                          method.getStatusText()));
>             }
>         } else {
>             throw new AxisFault(Messages.getMessage("transportError",   <--- 
> Running here
>                                                     
> String.valueOf(statusCode),
>                                                     method.getStatusText()));
>         }
>     }
> The stack trace is :
> org.apache.axis2.AxisFault: Transport error: 403 Error: Forbidden
>       at 
> org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:309)
>       at 
> org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:194)
>       at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
>       at 
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:404)
>       at 
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231)
>       at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
>       at 
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
>       at 
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
>       at 
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
>       at 
> org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.execute(AxisInvocationController.java:578)
>       at 
> org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.doInvoke(AxisInvocationController.java:127)
>       at 
> org.apache.axis2.jaxws.core.controller.impl.InvocationControllerImpl.invoke(InvocationControllerImpl.java:93)
>       at 
> org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invokeSEIMethod(JAXWSProxyHandler.java:377)
>       at 
> org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invoke(JAXWSProxyHandler.java:174)
>       at $Proxy89.helloPort(Unknown Source)
>       at org.test.HelloServlet.doPost(HelloServlet.java:113)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>       at 
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
>       at 
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
>       at 
> org.apache.geronimo.tomcat.security.SecurityValve.invoke(SecurityValve.java:87)
>       at 
> org.apache.geronimo.tomcat.security.jacc.JACCSecurityValve.invoke(JACCSecurityValve.java:54)
>       at 
> org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:700)
>       at 
> org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:48)
>       at 
> org.apache.geronimo.tomcat.valve.ProtectedTargetValve.invoke(ProtectedTargetValve.java:53)
>       at 
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
>       at 
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
>       at 
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:550)
>       at 
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>       at 
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:380)
>       at 
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
>       at 
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
>       at 
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
>       at 
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
>       at org.apache.geronimo.pool.ThreadPool$1.run(ThreadPool.java:243)
>       at 
> org.apache.geronimo.pool.ThreadPool$ContextClassLoaderRunnable.run(ThreadPool.java:373)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>       at java.lang.Thread.run(Thread.java:662)
> Thanks.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@axis.apache.org
For additional commands, e-mail: java-dev-h...@axis.apache.org

Reply via email to