fuse fabric-cxf demo issue
Issue
Currently, we are using jboss-fuse-6.0.0.redhat-024. We are trying to execute “fabric-cxf-demo” download from git hib with version fuse-7.2.x.fuse-patch.
Steps to simulate the error scenario:
- The following samples from fuse-7.2.x.fuse-patch has been installed in the maven repository.
a. fabric-cxf
b. fabric-groups
c. fabric-cxf-demo-client
d. fabric-cxf-demo-server
farbic-cxf-server.xml available at /fuse-7.2.x.fuse-patch/fabric/fabric-examples/fabric-cxf-demo/cxf-server/src/main/resources/OSGI-INF/blueprint
---------------------
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://cxf.apache.org/blueprint/core"
xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://cxf.apache.org/schemas/blueprint/core
http://cxf.apache.org/schemas/blueprint/core.xsd
http://cxf.apache.org/blueprint/jaxws
http://cxf.apache.org/blueprint/jaxws.xsd
">
<reference id="org.fusesource.fabric.zookeeper.IZKClient" interface="org.fusesource.fabric.zookeeper.IZKClient" />
<!-- The FabricFailOverFeature will try to access other service endpoint with round rad -->
<bean id="fabicLoadBalancerFeature" class="org.fusesource.fabric.cxf.FabricLoadBalancerFeature">
<property name="zkClient" ref="org.fusesource.fabric.zookeeper.IZKClient" />
<property name="fabricPath" value="cxf/demo" />
</bean>
<cm:property-placeholder id="placeholder"
persistent-id="org.fusesource.example.get.started">
<cm:default-properties>
<cm:property name="portNumber" value="8181"/>
</cm:default-properties>
</cm:property-placeholder>
<!-- setup the feature on the bus to help publish the services to the fabric-->
<cxf:bus bus="cxf">
<cxf:features>
<ref component-id="fabicLoadBalancerFeature"/>
</cxf:features>
</cxf:bus>
<bean id="hello1" class="org.fusesource.fabric.demo.cxf.server.HelloImpl">
<property name="hello" value="Hi"/>
</bean>
<bean id="hello2" class="org.fusesource.fabric.demo.cxf.server.HelloImpl">
<property name="hello" value="Hello"/>
</bean>
<!-- publish the service with the address of fail, cxf client will get the simulated IOException -->
<jaxws:server id="service1" serviceClass="org.fusesource.fabric.demo.cxf.Hello" address="/HelloCXF2">
<jaxws:serviceBean>
<ref component-id="hello1" />
</jaxws:serviceBean>
</jaxws:server>
<jaxws:server id="service2" serviceClass="org.fusesource.fabric.demo.cxf.Hello" address="/HelloCXF1">
<jaxws:serviceBean>
<ref component-id="hello2" />
</jaxws:serviceBean>
</jaxws:server>
<jaxws:server id="service4" serviceClass="org.fusesource.fabric.demo.cxf.server.HelloImpl" address="/HelloCXF3">
</jaxws:server>
<jaxws:endpoint id="HTTPEndpoint"
implementor="org.fusesource.fabric.demo.cxf.server.HelloImpl"
address="/HelloCXF"/>
<jaxws:client id="helloProxy" address="http://someotherplace"
serviceClass="org.fusesource.fabric.demo.cxf.Hello">
<jaxws:features>
<ref component-id="fabicLoadBalancerFeature" />
</jaxws:features>
</jaxws:client>
</blueprint>
fabric-cxf-client.xml available at fuse-7.2.x.fuse-patch/fabric/fabric-examples/fabric-cxf-demo/cxf-client/src/main/resources/OSGI-INF/blueprint
-------------------
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://cxf.apache.org/blueprint/core"
xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://cxf.apache.org/schemas/blueprint/core
http://cxf.apache.org/schemas/blueprint/core.xsd
http://cxf.apache.org/blueprint/jaxws
http://cxf.apache.org/blueprint/jaxws.xsd
">
<reference id="org.linkedin.zookeeper.client.IZKClient"
interface="org.fusesource.fabric.zookeeper.IZKClient" />
<bean id="fabicLoadBalancerFeature"
class="org.fusesource.fabric.cxf.FabricLoadBalancerFeature">
<property name="zkClient" ref="org.linkedin.zookeeper.client.IZKClient" />
<property name="fabricPath" value="cxf/demo" />
</bean>
<!-- setup the feature on the bus to help publish the services to the fabric-->
<cxf:bus bus="cxf">
<cxf:features>
<ref component-id="fabicLoadBalancerFeature"/>
</cxf:features>
</cxf:bus>
<jaxws:endpoint id="HTTPEndpoint"
implementor="org.fusesource.fabric.demo.cxf.HelloImpl"
address="/CXFHello8"/>
<jaxws:client id="helloProxy"
address="http://0.0.0.0:9000/initialAddress"
serviceClass="org.fusesource.fabric.demo.cxf.Hello">
<jaxws:features>
<ref component-id="fabicLoadBalancerFeature" />
</jaxws:features>
</jaxws:client>
<!--bean id="hello1" class="org.fusesource.fabric.demo.cxf.client.Client">
<property name="proxy">
<ref ="helloProxy"/>
</property>
</bean-->
<jaxws:endpoint id="helloProxy1"
address="/someotherplace"
implementor="org.fusesource.fabric.demo.cxf.HelloImpl">
<jaxws:features>
<ref component-id="fabicLoadBalancerFeature" />
</jaxws:features>
</jaxws:endpoint>
</blueprint>
Once we start the corresponding bundles we are able to find the services below in http://acme:8181/cxf
Available SOAP services:
Hello
sayHello
ping
Endpoint address: http://acme:8181/cxf/HelloCXF2
WSDL : {http://cxf.demo.fabric.fusesource.org/}HelloService
Target namespace: http://cxf.demo.fabric.fusesource.org/
Hello
sayHello
ping
Endpoint address: http://acme:8181/cxf/HelloCXF1
WSDL : {http://cxf.demo.fabric.fusesource.org/}HelloService
Target namespace: http://cxf.demo.fabric.fusesource.org/
Hello
sayHello
ping
Endpoint address: http://acme:8181/cxf/CXFHello8
WSDL : {http://cxf.demo.fabric.fusesource.org/}HelloService
Target namespace: http://cxf.demo.fabric.fusesource.org/
Hello
sayHello
ping
Endpoint address: http://acme:8181/cxf/HelloCXF
WSDL : {http://server.cxf.demo.fabric.fusesource.org/}HelloService
Target namespace: http://server.cxf.demo.fabric.fusesource.org/
Hello
sayHello
ping
Endpoint address: http://acme:8181/cxf/HelloCXF3
WSDL : {http://server.cxf.demo.fabric.fusesource.org/}HelloService
Target namespace: http://server.cxf.demo.fabric.fusesource.org/
Then I created a fabric using management console with the following properties
User name:mouttou
Password:vadivel
Zookeeper password:admin
Others fields are set with default values
Once I logged in fabric console:
A profile is created with the name cxf-demo with parent profile as cxf and fabric.
Then I added the following bundles by using the following statements
mvn:org.fusesource.fabric/fabric-cxf/7.2.0.redhat-024
mvn:org.fusesource.fabric/fabric-groups/7.2.0.redhat-024
mvn:org.fusesource.examples/fabric-cxf-demo-client/7.2.0.redhat-024
mvn:org.fusesource.examples/fabric-cxf-demo-server/7.2.0.redhat-024
The above profile is added into a container called child2 which is added as a child container of root container.
After profile gets added, it is provisioned successfully with green light with the status as success
Client.java
package org.fusesource.fabric.demo.cxf.client;
import org.apache.cxf.feature.AbstractFeature;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
//import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
import org.fusesource.fabric.cxf.*;
import org.fusesource.fabric.demo.cxf.Hello;
import org.apache.cxf.Bus;
//import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.List;
public class Client {
private Hello hello;
public Client() {
// The feature will try to create a zookeeper client itself by checking the system property of
// zookeeper.url and zookeeper.password
//System.getProperty("zookeeper.password", "admin");
// or we can set these option directly on the FabricLoadBalancerFeature
/*JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
factory.setServiceBean(new HelloImpl());
factory.setAddress("http://localhost:9000/simple/server");
factory.setBus(bus);
factory.create();
*/
FabricLoadBalancerFeature feature = new FabricLoadBalancerFeature();
feature.setZooKeeperPassword("vadivel");
feature.setZooKeeperUrl("acme:2181");
// Feature will use this path to locate the service
feature.setFabricPath("cxf/demo");
System.out.println("hello1");
ClientProxyFactoryBean clientFactory = new JaxWsProxyFactoryBean();
clientFactory.setServiceClass(ClientProxyFactoryBean.class);
// The address is not the actual address that the client will access
clientFactory.setAddress("http://0.0.0.0:9000/initialAddress");
System.out.println("hello5");
List<AbstractFeature> features = new ArrayList<AbstractFeature>();
features.add(feature);
// we need to setup the feature on the client factory
clientFactory.setFeatures(features);
System.out.println("hello4");
PrefixAddressResolver resolver = new PrefixAddressResolver();
resolver.setPrefixAddress("http://localhost:8181/cxf");
FabricServerListener listener = new FabricServerListener(null, resolver);
String address = listener.getFullAddress("/cxf/demo");
System.out.println("address"+address);
// create the proxy of the hello
hello = clientFactory.create(Hello.class);
System.out.println("hello6"+hello);
hello.ping();
}
public Hello getProxy() {
return hello;
}
public static void main(String args[]) {
Client client = new Client();
/*System.out.println("Calling the sayHello first time with the result " + client.getProxy().sayHello());
System.out.println("Calling the sayHello second time with the result " + client.getProxy().sayHello());
System.out.println("Calling the sayHello third time with the result " + client.getProxy().sayHello());
*/
}
}
After running the above file, we are getting the below error.
Fuse.log
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building fabric-cxf-demo-client 7.2.0.redhat-024
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) @ fabric-cxf-demo-client >>>
[INFO]
[INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) @ fabric-cxf-demo-client <<<
[INFO]
[INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ fabric-cxf-demo-client ---
hello1
hello5
hello4
addresshttp://localhost:8181/cxf/cxf/demo
[.demo.cxf.client.Client.main()] ReflectionServiceFactoryBean INFO Creating Service {http://cxf.demo.fabric.fusesource.org/}HelloService from class org.fusesource.fabric.demo.cxf.Hello
[state change dispatcher thread] AbstractZKClient INFO Starting StateChangeDispatcher
[.demo.cxf.client.Client.main()] ZooKeeper INFO Client environment:zookeeper.version=3.4.3-1240972, built on 02/06/2012 10:48 GMT
[.demo.cxf.client.Client.main()] ZooKeeper INFO Client environment:host.name=acme.company.net
[.demo.cxf.client.Client.main()] ZooKeeper INFO Client environment:java.version=1.6.0_33
[.demo.cxf.client.Client.main()] ZooKeeper INFO Client environment:java.vendor=Sun Microsystems Inc.
[.demo.cxf.client.Client.main()] ZooKeeper INFO Client environment:java.home=/xjp/java6/jdk1.6.0_33/jre
[.demo.cxf.client.Client.main()] ZooKeeper INFO Client environment:java.class.path=/xjp/maven/apache-maven-3.0.3/boot/plexus-classworlds-2.4.jar
[.demo.cxf.client.Client.main()] ZooKeeper INFO Client environment:java.library.path=/xjp/java6/jdk1.6.0_33/jre/lib/amd64/server:/xjp/java6/jdk1.6.0_33/jre/lib/amd64:/xjp/java6/jdk1.6.0_33/jre/../lib/amd64:/xjp/imagemagick/ImageMagick6.8.9/lib:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
[.demo.cxf.client.Client.main()] ZooKeeper INFO Client environment:java.io.tmpdir=/tmp
[.demo.cxf.client.Client.main()] ZooKeeper INFO Client environment:java.compiler=<NA>
[.demo.cxf.client.Client.main()] ZooKeeper INFO Client environment:os.name=Linux
[.demo.cxf.client.Client.main()] ZooKeeper INFO Client environment:os.arch=amd64
[.demo.cxf.client.Client.main()] ZooKeeper INFO Client environment:os.version=2.6.18-238.el5
[.demo.cxf.client.Client.main()] ZooKeeper INFO Client environment:user.name=inautilus
[.demo.cxf.client.Client.main()] ZooKeeper INFO Client environment:user.home=/u/inautilus
[.demo.cxf.client.Client.main()] ZooKeeper INFO Client environment:user.dir=/xjp/fuse-7.2.x.fuse-patch/fabric/fabric-examples/fabric-cxf-demo/cxf-client
[.demo.cxf.client.Client.main()] ZooKeeper INFO Initiating client connection, connectString=acme:2181 sessionTimeout=10000 watcher=org.fusesource.fabric.zookeeper.internal.ZKClient@57cee0c8
[ent.Client.main()-SendThread()] ClientCnxn INFO Opening socket connection to server /10.78.236.222:2181
[in(acme.company.net:2181)] ZooKeeperSaslClient WARN SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
[in(acme.company.net:2181)] ZooKeeperSaslClient INFO Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
[in(acme.company.net:2181)] ClientCnxn INFO Socket connection established to acme.company.net/10.78.236.222:2181, initiating session
[in(acme.company.net:2181)] ClientCnxn INFO Session establishment complete on server acme.company.net/10.78.236.222:2181, sessionid = 0x141bafa30d3002d, negotiated timeout = 10000
[.demo.cxf.client.Client.main()] FabricLoadBalancerFeature ERROR Cannot setup the LoadBalanceStrategy due to org.apache.zookeeper.KeeperException$NoAuthException: KeeperErrorCode = NoAuth for /fabric/cxf/endpoints/cxf/demo
hello6org.apache.cxf.jaxws.JaxWsClientProxy@dad4feb
[.demo.cxf.client.Client.main()] PhaseInterceptorChain WARN Interceptor for {http://cxf.demo.fabric.fusesource.org/}HelloService#{http://cxf.demo.fabric.fusesource.org/}ping has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)[cxf-bundle-2.6.0.redhat-60024.jar:2.6.0.redhat-60024]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)[cxf-bundle-2.6.0.redhat-60024.jar:2.6.0.redhat-60024]
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530)[cxf-bundle-2.6.0.redhat-60024.jar:2.6.0.redhat-60024]
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)[cxf-bundle-2.6.0.redhat-60024.jar:2.6.0.redhat-60024]
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366)[cxf-bundle-2.6.0.redhat-60024.jar:2.6.0.redhat-60024]
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319)[cxf-bundle-2.6.0.redhat-60024.jar:2.6.0.redhat-60024]
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)[cxf-bundle-2.6.0.redhat-60024.jar:2.6.0.redhat-60024]
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)[cxf-bundle-2.6.0.redhat-60024.jar:2.6.0.redhat-60024]
at $Proxy47.ping(Unknown Source)[:]
at org.fusesource.fabric.demo.cxf.client.Client.<init>(Client.java:68)[file:/xjp/fuse-7.2.x.fuse-patch/fabric/fabric-examples/fabric-cxf-demo/cxf-client/target/classes/:]
at org.fusesource.fabric.demo.cxf.client.Client.main(Client.java:76)[file:/xjp/fuse-7.2.x.fuse-patch/fabric/fabric-examples/fabric-cxf-demo/cxf-client/target/classes/:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_33]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_33]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_33]
at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_33]
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
at java.lang.Thread.run(Thread.java:662)[:1.6.0_33]
[WARNING]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
at java.lang.Thread.run(Thread.java:662)
Caused by: javax.xml.ws.WebServiceException: Could not send Message.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145)
at $Proxy47.ping(Unknown Source)
at org.fusesource.fabric.demo.cxf.client.Client.<init>(Client.java:68)
at org.fusesource.fabric.demo.cxf.client.Client.main(Client.java:76)
... 6 more
Caused by: java.net.ConnectException: ConnectException invoking http://0.0.0.0:9000/initialAddress: Connection refused
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1467)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1452)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:660)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
... 9 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:211)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at sun.net.NetworkClient.doConnect(NetworkClient.java:158)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:388)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:523)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:227)
at sun.net.www.http.HttpClient.New(HttpClient.java:300)
at sun.net.www.http.HttpClient.New(HttpClient.java:317)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:970)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:911)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:836)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1014)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1410)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1351)
at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:47)
at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1424)
... 19 more
[INFO] ------------------------------------------------------------------------
Please let us know where is the problem.
Environment
- Fuse ESB
- 7.0
- Jboss Fuse
- 6.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
