Hi Eoghan,

Finally got the sample code working on my pc.

I noticed that when I run the sample client code either in my Eclipse as a
Junit App or just from the ant file, the config file passed in by the jvm
arg -Dcxf.config.file=etc/spring/client.xml is definitely read:

This is the extra output that I can see from running the sample where it's
reading the client.xml config file:
INFO: Refreshing org.apache.cxf.bus.spring.busapplicationcont...@197d257:
display name [org.apache.cxf.bus.spring.busapplicationcont...@197d257];
startup date [Thu Feb 25 18:22:20 EST 2010]; root of context hierarchy
25/02/2010 6:22:21 PM org.apache.cxf.bus.spring.BusApplicationContext
getConfigResources
INFO: Loaded configuration file etc/spring/client.xml.
25/02/2010 6:22:21 PM
org.springframework.beans.factory.support.DefaultListableBeanFactory
registerBeanDefinition
INFO: Overriding bean definition for bean
'org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder': replacing
[Generic bean: class
[org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder];
scope=singleton; abstract=false; lazyInit=false; autowireMode=0;
dependencyCheck=0; autowireCandidate=true; primary=false;
factoryBeanName=null; factoryMethodName=null; initMethodName=null;
destroyMethodName=null; defined in URL
[jar:file:/C:/dev/libraries/cxf/2.2.6/lib/apache-cxf-2.2.6/apache-cxf-2.2.6/lib/cxf-2.2.6.jar!/META-INF/cxf/cxf-extension-http.fixml]]
with [Generic bean: class
[org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder];
scope=singleton; abstract=false; lazyInit=false; autowireMode=0;
dependencyCheck=0; autowireCandidate=true; primary=false;
factoryBeanName=null; factoryMethodName=null; initMethodName=null;
destroyMethodName=null; defined in URL
[jar:file:/C:/dev/libraries/cxf/2.2.6/lib/apache-cxf-2.2.6/apache-cxf-2.2.6/lib/cxf-2.2.6.jar!/META-INF/cxf/cxf-extension-http.fixml]]

........

25/02/2010 6:22:21 PM
org.springframework.beans.factory.support.DefaultListableBeanFactory
preInstantiateSingletons
INFO: Pre-instantiating singletons in
org.springframework.beans.factory.support.defaultlistablebeanfact...@104faf8:
defining beans
[cxf,org.apache.cxf.bus.spring.BusApplicationListener,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.binding.corba.CorbaBindingFactory,org.apache.cxf.binding.corba.wsdl.WSDLExtensionRegister#0,org.apache.cxf.jaxws.context.WebServiceContextResourceResolver,org.apache.cxf.jaxws.context.WebServiceContextImpl,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.binding.xml.XMLBindingFactory,org.apache.cxf.ws.addressing.policy.AddressingAssertionBuilder,org.apache.cxf.ws.addressing.policy.AddressingPolicyInterceptorProvider,org.apache.cxf.ws.addressing.policy.UsingAddressingAssertionBuilder,org.apache.cxf.javascript.JavascriptQueryHandlerRegistry,org.apache.cxf.transport.local.LocalTransportFactory,org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder,org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder,org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider,org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory,org.apache.cxf.management.InstrumentationManager,org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory,org.apache.cxf.transport.jms.JMSTransportFactory,org.apache.cxf.binding.object.ObjectBindingFactory,org.apache.cxf.binding.http.HttpBindingFactory,org.apache.cxf.jaxrs.JAXRSBindingFactory,org.apache.cxf.ws.security.policy.WSSecurityPolicyLoader,org.apache.cxf.ws.policy.AssertionBuilderRegistry,org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry,org.apache.cxf.ws.policy.attachment.external.DomainExpressionBuilderRegistry,org.apache.cxf.ws.policy.attachment.external.EndpointReferenceDomainExpressionBuilder,org.apache.cxf.ws.policy.PolicyBuilder,org.apache.cxf.ws.policy.PolicyEngine,org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider,org.apache.cxf.ws.policy.attachment.ServiceModelPolicyProvider,org.apache.cxf.ws.policy.mtom.MTOMAssertionBuilder,org.apache.cxf.ws.policy.mtom.MTOMPolicyInterceptorProvider,org.apache.cxf.ws.rm.RMManager,org.apache.cxf.ws.rm.policy.RMPolicyInterceptorProvider,org.apache.cxf.ws.rm.RMAssertionBuilder,Sequential,Random,{http://apache.org/hello_world_soap_http}Replica1.jaxws-client.proxyFactory,{http://apache.org/hello_world_soap_http}Replica1.jaxws-client,{http://apache.org/hello_world_soap_http}Replica2.jaxws-client.proxyFactory,{http://apache.org/hello_world_soap_http}Replica2.jaxws-client,{http://apache.org/hello_world_soap_http}Replica3.jaxws-client.proxyFactory,{http://apache.org/hello_world_soap_http}Replica3.jaxws-client];
root of factory hierarchy
25/02/2010 6:22:22 PM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromWSDL
INFO: Creating Service
{http://apache.org/hello_world_soap_http}ClusteredService from WSDL:
file:/C:/Temp/apache-cxf-2.1.3-src/distribution/src/main/release/samples/static_failover/wsdl/replicated_hello_world.wsdl
25/02/2010 6:22:22 PM org.apache.cxf.clustering.FailoverTargetSelector
setStrategy
INFO: Using failover strategy null

I added this assertion into the sample Client.java conduitSelector
instanceof FailoverTargetSelector to check the conduitSelector type and that
returns true. However when I remove the jvm arg, the above returns false.

So then I applied the same jvm arg to my own project's junit test case to
see if this would now work but
this is the only output that I get:

[INFO] 2010-02-25 18:21:57,866 Refreshing
org.apache.cxf.bus.spring.busapplicationcont...@10e18ba: display name
[org.apache.cxf.bus.spring.busapplicationcont...@10e18ba]; startup date [Thu
Feb 25 18:21:57 EST 2010]; root of context hierarchy
[INFO] 2010-02-25 18:21:57,976 Loading XML bean definitions from class path
resource [cxf.xml]
[INFO] 2010-02-25 18:21:58,226 Bean factory for application context
[org.apache.cxf.bus.spring.busapplicationcont...@10e18ba]:
org.springframework.beans.factory.support.defaultlistablebeanfact...@a34783

And the assertion to check conduitSelector instanceof FailoverTargetSelector
returns false.

If you notice it doesn't have a line similar to the demo code:
25/02/2010 6:22:21 PM org.apache.cxf.bus.spring.BusApplicationContext
getConfigResources
INFO: Loaded configuration file etc/spring/client.xml.

So now I'm trying to find out how/what prints that out.

Bit of progress but I'm hoping that once I figure this out, that will be the
end of it.



Eoghan Glynn-4 wrote:
> 
> Lesley,
> 
> Try it without the id attribute being set on your <jaxws:client> beans,
> i.e.
> 
>   <jaxws:client name="{
> http://www.test.com/Authentication}AuthenticationPrimaryPortType<http://www.test.com/Authentication%7DAuthenticationPrimaryPortType>
> "
> createdFromAPI="true">
>        <jaxws:features>
>            <clustering:failover>
>                <clustering:strategy>
>                    <ref bean="Random"/>
>                </clustering:strategy>
>            </clustering:failover>
>        </jaxws:features>
>    </jaxws:client>
> 
>    <jaxws:client name="{
> http://www.test.com/Authentication}AuthenticationSecondaryPortType<http://www.test.com/Authentication%7DAuthenticationSecondaryPortType>
> "
> createdFromAPI="true">
>        <jaxws:features>
>            <clustering:failover>
>                <clustering:strategy>
>                    <ref bean="Random"/>
>                </clustering:strategy>
>            </clustering:failover>
>        </jaxws:features>
>    </jaxws:client>
> 
>    <jaxws:client name="{
> http://www.test.com/Authentication}AuthenticationTertiaryPortType<http://www.test.com/Authentication%7DAuthenticationTertiaryPortType>
> "
> createdFromAPI="true">
>        <jaxws:features>
>            <clustering:failover>
>                <clustering:strategy>
>                    <ref bean="Random"/>
>                </clustering:strategy>
>            </clustering:failover>
>        </jaxws:features>
>    </jaxws:client>
> </beans>
> 
> 
> Cheers,
> Eoghan
> 
> 
> On 23 February 2010 13:46, LTay <[email protected]> wrote:
> 
>>
>> Hi there,
>>
>> Hoping someone can shed some light on this. I'm trying to use the
>> failover
>> feature on CXF but have not been able to get it working.
>>
>> I've set up a cxf-client.xml which contains the failover setup:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <beans xmlns="http://www.springframework.org/schema/beans";
>>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>       xmlns:cxf="http://cxf.apache.org/core";
>>       xmlns:jaxws="http://cxf.apache.org/jaxws";
>>       xmlns:clustering="http://cxf.apache.org/clustering";
>>       xsi:schemaLocation="http://cxf.apache.org/core
>>          http://cxf.apache.org/schemas/core.xsd
>>          http://cxf.apache.org/jaxws
>>          http://cxf.apache.org/schemas/jaxws.xsd
>>          http://www.springframework.org/schema/beans
>>          http://www.springframework.org/schema/beans/spring-beans.xsd";>
>>
>>        <import resource="classpath:META-INF/cxf/cxf.xml" />
>>        <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
>> />
>>        <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>>
>>    <bean id="Random" class="org.apache.cxf.clustering.RandomStrategy"/>
>>
>>    <jaxws:client id="AuthenticationPrimaryPortType"
>> name="{http://www.test.com/Authentication}AuthenticationPrimaryPortType<http://www.test.com/Authentication%7DAuthenticationPrimaryPortType>
>> "
>> createdFromAPI="true">
>>        <jaxws:features>
>>            <clustering:failover>
>>                <clustering:strategy>
>>                    <ref bean="Random"/>
>>                </clustering:strategy>
>>            </clustering:failover>
>>        </jaxws:features>
>>    </jaxws:client>
>>
>>    <jaxws:client id="AuthenticationSecondaryPortType"
>> name="{http://www.test.com/Authentication}AuthenticationSecondaryPortType<http://www.test.com/Authentication%7DAuthenticationSecondaryPortType>
>> "
>> createdFromAPI="true">
>>        <jaxws:features>
>>            <clustering:failover>
>>                <clustering:strategy>
>>                    <ref bean="Random"/>
>>                </clustering:strategy>
>>            </clustering:failover>
>>        </jaxws:features>
>>    </jaxws:client>
>>
>>    <jaxws:client id="AuthenticationTertiaryPortType"
>> name="{http://www.test.com/Authentication}AuthenticationTertiaryPortType<http://www.test.com/Authentication%7DAuthenticationTertiaryPortType>
>> "
>> createdFromAPI="true">
>>        <jaxws:features>
>>            <clustering:failover>
>>                <clustering:strategy>
>>                    <ref bean="Random"/>
>>                </clustering:strategy>
>>            </clustering:failover>
>>        </jaxws:features>
>>    </jaxws:client>
>> </beans>
>>
>>
>> I've got the clustered service set up in the wsdl as well:
>>
>> <service name="AuthenticationClusteredWebService">
>>        <port name="AuthenticationPrimaryPortType"
>> binding="AUTH-SCENARIO:AuthenticationWebService">
>>                <SOAP:address location="https://server1"/>
>>        </port>
>>        <port name="AuthenticationSecondaryPortType"
>> binding="AUTH-SCENARIO:AuthenticationWebService">
>>                <SOAP:address location="https://server2"/>
>>        </port>
>>        <port name="AuthenticationTertiaryPortType"
>> binding="AUTH-SCENARIO:AuthenticationWebService">
>>                <SOAP:address location="https://server3"/>
>>        </port>
>> </service>
>>
>> But when I test the failover by taking down the service at server1, I get
>> a
>> SocketConnectionException complaining of a connection timeout. It doesn't
>> try to use the other port types.
>>
>> I also noticed that by running this to assert that the failover feature
>> does
>> get set up, the assertion below returns false. Instead the
>> conduitSelector
>> is of type UpfrontConduitSelector:
>>
>> AuthenticationPortType proxy = new
>>
>> AuthenticationClusteredWebService(getWSDL()).getAuthenticationPrimaryPortType()
>>
>> ConduitSelector conduitSelector =
>> ClientProxy.getClient(proxy).getConduitSelector();
>> assertTrue(FailoverTargetSelector.class.isInstance(conduitSelector));
>>
>> So for some reason the failover feature in my cxf-client.xml gets
>> ignored.
>>
>>
>> If anyone's got any ideas that would be great. I've tried to follow the
>> system testing class I found at:
>>
>> http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/clustering/FailoverTest.java
>> and how the failover.xml is setup. Maybe I'm just missing something
>> else..
>>
>>
>> Thanks,
>> Lesley
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Failover-config-for-cxf-seems-to-get-ignored-tp27703526p27703526.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Failover-config-for-cxf-seems-to-get-ignored-tp27703526p27714371.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to