You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Urciolo, Kevin" <Ke...@ngc.com> on 2008/07/08 20:45:42 UTC

Multiple Clients Of Same Type Created Using JaxWsProxyFactoryBean Causes Address Mixups

I create many clients using the code shown below and store them in a
pool.  The clients are identical except for different URLs (ports
specifically).  It seems the URLs are getting mixed up between clients.
For instance, I might have a group containing HostA:1 and HostA:2 and
another group containing HostA:3 and HostA:4.  When using a client from
the first group, I sometimes see it using HostA:3 or HostA:4 even though
that group of clients is in no way associated with the other group.  It
is almost like the jaxWsProxyFactoryBean or the objects it creates is
caching or sharing information.  I am using a new instance of
JaxWsProxyFactoryBean each time.  However, I am still getting the wrong
URLs associated with clients.

	    jaxWsProxyFactoryBean = new JaxWsProxyFactoryBean();
	
jaxWsProxyFactoryBean.setServiceClass(Class.forName(portClassName));
	    jaxWsProxyFactoryBean.setAddress(url);
	
jaxWsProxyFactoryBean.setBus(BusFactory.newInstance().createBus());
	    Object object = jaxWsProxyFactoryBean.create();
	    
	    // Give the conduit and new client policy
	    Client client = ClientProxy.getClient(object);
	    HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
	    httpConduit.setClient(httpClientPolicy);

Any ideas how I can fix this?

I am using CXF 2.1.1.

Thanks.