On Mon, 2007-04-23 at 13:19 -0400, Jake Goulding wrote:
> Apologies for the second reply, but this may be a bit more of a 
> important question surrounding this issue. I have a multi-threaded 
> application, with each thread creating and using various Stubs 
> (sometimes multiple stubs to access various parts of the webservice). If 
> each Stub is creating its own HTTP server, how have I never run into an 
> issue like this before? It seems that each thread and each stub in that 
> thread would be trying to start a server on the same port.
> 
Are you using 2 channels (i.e. options.setUseSeparateListener(true))?,
the http server is started *only* if you use a separate listener to
receive the response.

> I can set the HTTPConstants.REUSE_HTTP_CLIENT option to true, but it 
> still seems like I may have some issues.

Which kind of problems are you getting?
I use something like this:

configurationContext = ConfigurationContextFactory
         .createConfigurationContextFromFileSystem(null, null);

MultiThreadedHttpConnectionManager connectionManager = new
MultiThreadedHttpConnectionManager();

HttpConnectionManagerParams connectionManagerParams = new
HttpConnectionManagerParams();

connectionManagerParams.setTcpNoDelay(true);
connectionManagerParams.setStaleCheckingEnabled(true);
connectionManager.setParams(connectionManagerParams);

HttpClient httpClient = new HttpClient(connectionManager);


configurationContext.setProperty(HTTPConstants.REUSE_HTTP_CLIENT,
                Boolean.TRUE);

configurationContext.setProperty(HTTPConstants.CACHED_HTTP_CLIENT,
                httpClient);

However remember that it's up to you to clean the resources if you use a
custom ConfigurationContext. See
http://www.nabble.com/-Axis2--ServiceClient-question-tf2496516.html#a6959251

> 
> Is creating a global HttpClient and setting it in each thread (with 
> HTTPConstants.CACHED_HTTP_CLIENT) the "proper" thing to do?
> 
http://jakarta.apache.org/commons/httpclient/performance.html#Reuse_of_HttpClient_instance


Michele

> Thanks again for the good advice!
> 
> -Jake
> 
> 
> Michele Mazzucco wrote:
> > On Mon, 2007-04-23 at 11:29 -0400, Jake Goulding wrote:
> >   
> >> Thanks Michele!
> >>
> >> That did help, but left me with 2.5 questions:
> >>
> >> 1/ Why does the client need to spawn a web server at all?
> >>     
> >
> > Because it uses two separate channels.
> >
> >   
> >> 1b/ Is it possible to disable this server completely?
> >>     
> >
> > Yes, disable the addressing module and use a single channel (i.e.
> > synchronous communication).
> >
> >   
> >> 2/ If I create a ConfigurationContext, how do I set what I need to set, 
> >> and then how do I use it?
> >>     
> >
> > See here (for example)
> > http://wso2.org/library/87
> > http://wso2.org/library/585
> > http://wso2.org/library/290
> > http://wso2.org/library/209
> >
> > Michele
> >
> >   
> >> Thanks!
> >>
> >> Michele Mazzucco wrote:
> >>     
> >>> http://wso2.org/library/165
> >>>
> >>> HTH,
> >>> Michele
> >>>
> >>> On Mon, 2007-04-23 at 10:28 -0400, Jake Goulding wrote:
> >>>   
> >>>       
> >>>> Hey all:
> >>>>
> >>>> I use axis to connect to a Windows Sharepoint server. Recently, an 
> >>>> installation of our code started returning these errors:
> >>>>
> >>>> java.net.BindException: Address already in use: connect; nested 
> >>>> exception is:
> >>>> org.apache.axis2.AxisFault: Address already in use: connect; nested 
> >>>> exception is:
> >>>> java.net.BindException: Address already in use: connect
> >>>>
> >>>> What I don't get is how this is possible. Pure client code should not 
> >>>> need to bind to any particular address/port at all. The code generated 
> >>>> from the WSDL shouldn't even have the server-side code generated. Thanks 
> >>>> in advance for any hints / fixes!
> >>>>
> >>>> -Jake
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> 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]
> >>>
> >>>
> >>>   
> >>>       
> >
> >
> > ---------------------------------------------------------------------
> > 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]

Reply via email to