[ 
https://issues.apache.org/jira/browse/TUSCANY-1218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Simon Nash updated TUSCANY-1218:
--------------------------------

    Attachment: patch-1218

After extensive investigation including tracing all WinSock API calls, it 
appears that the problem is caused by client-side connections and sockets not 
being released when they are no longer in use.  By default, commons-httpclient 
uses SimpleHttpConnectionManager which creates a new connection for every 
request and does not track connections or release them later.  Setting the 
Axis2 REUSE_HTTP_CLIENT property causes commons-httpclient to use 
MultiThreadedHttpConnectionManager instead,  which tracks connections and has a 
shutdown() method that releases all connections. 

This patch modifies Axis2TargetInvoker to set REUSE_HTTP_CLIENT.  The other 
part of the fix is to ensure that MultiThreadedHttpConenctionManager.shutdown() 
gets called at the correct time.  For now I have modified Axis2ModuleActivator, 
Axis2BindingBuilder and Axis2ReferenceBinding to call this method when the 
Axis2 binding extension is unloaded.  This solves the problem for the tests 
used by the build, but it isn't a complete solution since shutdown() won't be 
called when an Axis2 reference binding is removed without the Axis2 extension 
being unloaded.  Further investigation is needed to determine the correct point 
to call  the MultiThreadedHttpConenctionManager.shutdown()  method in all 
scenarios.

I also updated Axis2ServiceBinding to remove the now obsolete @Destroy 
annotation on the stop() method, and I updated the pom.xml for binding-ws-axis2 
to change the dependency on commons-httpclient from runtime to compile (needed 
because of the change to Axis2ReferenceBinding). 

I have tested this change on my machine and it resolves the build problem with 
no apparent adverse side-effects.

> java.net.ConnectException: Connection refused: connect when building 
> binding-ws-axis2
> -------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1218
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1218
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Axis Binding
>    Affects Versions: Java-SCA-Next
>         Environment: Windows XP
>            Reporter: Simon Nash
>         Assigned To: Simon Nash
>             Fix For: Java-SCA-Next
>
>         Attachments: patch-1218
>
>
> When building java/sca from the trunk, the following error occurs:
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> Running org.apache.tuscany.binding.axis2.itests.HelloWorldTestCase
> log4j:WARN No appenders could be found for logger 
> (org.apache.axiom.om.util.StAXUtils).
> log4j:WARN Please initialize the log4j system properly.
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.52 sec
> Running org.apache.tuscany.binding.axis2.Axis2ServiceTestCase
> Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01 sec
> Running 
> org.apache.tuscany.binding.axis2.itests.endpoints.WSDLRelativeURITestCase
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.975 sec
> Running org.apache.tuscany.binding.axis2.itests.HelloWorldOMTestCase
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.307 sec <<< 
> FAILURE!
> testCalculator(org.apache.tuscany.binding.axis2.itests.HelloWorldOMTestCase)  
> Time elapsed: 4.247 sec  <<< ERROR!
> java.lang.reflect.UndeclaredThrowableException
>       at $Proxy8.getGreetings(Unknown Source)
>       at 
> org.apache.tuscany.binding.axis2.itests.HelloWorldOMComponent.getGreetings(HelloWorldOMComponent.java:31)
>       at 
> org.apache.tuscany.binding.axis2.itests.HelloWorldOMTestCase.testCalculator(HelloWorldOMTestCase.java:43)
> Caused by: org.apache.axis2.AxisFault: Connection refused: connect; nested 
> exception is: 
>       java.net.ConnectException: Connection refused: connect; nested 
> exception is: 
>       org.apache.axis2.AxisFault: Connection refused: connect; nested 
> exception is: 
>       java.net.ConnectException: Connection refused: connect
>       at 
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:227)
>       at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:674)
>       at 
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:237)
>       at 
> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202)
>       at 
> org.apache.tuscany.binding.axis2.Axis2TargetInvoker.invokeTarget(Axis2TargetInvoker.java:77)
>       at 
> org.apache.tuscany.spi.extension.TargetInvokerExtension.invoke(TargetInvokerExtension.java:52)
>       at 
> org.apache.tuscany.core.wire.InvokerInterceptor.invoke(InvokerInterceptor.java:45)
>       at 
> org.apache.tuscany.spi.wire.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:91)
>       at 
> org.apache.tuscany.implementation.java.proxy.JDKInvocationHandler.invoke(JDKInvocationHandler.java:150)
>       ... 29 more
> On my machine, this occurs every time when building from the root.  It does 
> not occur if I only build the binding-ws-axis2 module.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to