6 Replies Latest reply on Dec 4, 2014 10:34 AM by abhishekkoneru6790

    Load Balancing for a CXF Service in fabric.

    abhishekkoneru6790

      Hello,

       

      I am trying to setup a service which has load balancing configures as per the red hat document

      https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Fuse/6.0/html/Configuring_Web_Service_Endpoints/files/FabricHA-LoadBal-Intro.html#FabricHA-LoadBal-Intro-Prereqs

       

      In the prerequisites, I am having a maven dependency issue. The

      <dependency>

        <groupId>org.fusesource.fabric</groupId>

        <artifactId>fabric-cxf</artifactId>

        <version>6.0.0.redhat-024</version>

      </dependency>

       

      is not available in the jboss repository or maven repo.

      When is use a different  version of this jar, i have an exception stating "missing requirement"

      The error is below.

       

       

      The same service with out the load balancing features works in fabric,

      It is failing only when we try to implement the load balancing features using fabric..

        • 1. Re: Load Balancing for a CXF Service in fabric.
          abhishekkoneru6790
          • 2. Re: Load Balancing for a CXF Service in fabric.
            vrlgohel

            From the stack trace, it seems that you are using JBoss Fuse 6.1.

            Starting Fuse 6.1, the package name for Fabric has been changed from org.fusesource.fabric to io.fabric8.

             

            Hence, you will need to use this dependency instead,

             

            <dependency>

              <groupId>io.fabric8</groupId>

              <artifactId>fabric-cxf</artifactId>

               <version>1.0.0.redhat-379</version>

              </dependency>

            1 of 1 people found this helpful
            • 3. Re: Load Balancing for a CXF Service in fabric.
              abhishekkoneru6790

              After I have changed this, I get the following error.

              Attached is my pom

              • org.osgi.service.resolver.ResolutionException: Unable to resolve dummy/0.0.0: missing requirement [dummy/0.0.0] osgi.identity; osgi.identity=cxfDemo; type=osgi.bundle; version="[1.0.0,1.0.0]" [caused by: Unable to resolve cxfDemo/1.0.0: missing requirement [cxfDemo/1.0.0] osgi.wiring.package; filter:="(osgi.wiring.package=com.cox.fusedemo.cxfDemo)"]
              •   at org.apache.felix.resolver.Candidates.populateResource(Candidates.java:285)
              •   at org.apache.felix.resolver.Candidates.populate(Candidates.java:153)
              •   at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:148)
              •   at io.fabric8.agent.DeploymentBuilder.resolve(DeploymentBuilder.java:226)
              •   at io.fabric8.agent.DeploymentAgent.doUpdate(DeploymentAgent.java:521)
              •   at io.fabric8.agent.DeploymentAgent$2.run(DeploymentAgent.java:252)
              •   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
              •   at java.util.concurrent.FutureTask.run(FutureTask.java:262)
              •   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
              •   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
              •   at java.lang.Thread.run(Thread.java:744)

               

              =====/////=============

               

              <?xml version="1.0" encoding="UTF-8"?>

              <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

               

               

                <modelVersion>4.0.0</modelVersion>

               

               

                <groupId>com.cox.fusedemo</groupId>

                <artifactId>cxfDemo</artifactId>

                <packaging>bundle</packaging>

                <version>1.0.0</version>

               

               

                <name>A Camel Blueprint Route</name>

                <url>http://www.myorganization.org</url>

               

               

                <properties>

               

                  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

                  <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

                  <fabric8.parentProfiles>feature-camel</fabric8.parentProfiles>

                  <fabric8.profile>gettingstarted</fabric8.profile>

                  <fabric8.bundles></fabric8.bundles>

                </properties>

                <distributionManagement> <repository>

                      <id>devscvtools01</id>

                      <name>devscvtools01-snapshots</name>

                      <url>http://devscvtools01.at.at.cox.net:8080/artifactory/cox_fuse_test_repo</url>

                 <snapshots>

                      <enabled>false</enabled>

                    </snapshots>

                  </repository></distributionManagement>

                <repositories>

                  <repository>

                    <id>release.fusesource.org</id>

                    <name>FuseSource Release Repository</name>

                    <url>http://repo.fusesource.com/nexus/content/repositories/releases</url>

                    <snapshots>

                      <enabled>false</enabled>

                    </snapshots>

                    <releases>

                      <enabled>true</enabled>

                    </releases>

                  </repository>

                  <repository>

                   <id>ea.fusesource.org</id>

                   <name>FuseSource Community Early Access Release Repository</name>

                   <url>http://repo.fusesource.com/nexus/content/groups/ea</url>

                   <snapshots>

                    <enabled>false</enabled>

                   </snapshots>

                   <releases>

                    <enabled>true</enabled>

                   </releases>

                  </repository>   

                  <repository>

                    <id>snapshot.fusesource.org</id>

                    <name>FuseSource Snapshot Repository</name>

                    <url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>

                    <snapshots>

                      <enabled>true</enabled>

                    </snapshots>

                    <releases>

                      <enabled>false</enabled>

                    </releases>

                  </repository>

                </repositories>

               

               

                <pluginRepositories>

                  <pluginRepository>

                    <id>release.fusesource.org</id>

                    <name>FuseSource Release Repository</name>

                    <url>http://repo.fusesource.com/nexus/content/repositories/releases</url>

                    <snapshots>

                      <enabled>false</enabled>

                    </snapshots>

                    <releases>

                      <enabled>true</enabled>

                    </releases>

                  </pluginRepository>

                  <pluginRepository>

                   <id>ea.fusesource.org</id>

                   <name>FuseSource Community Early Access Release Repository</name>

                   <url>http://repo.fusesource.com/nexus/content/groups/ea</url>

                   <snapshots>

                    <enabled>false</enabled>

                   </snapshots>

                   <releases>

                    <enabled>true</enabled>

                   </releases>

                  </pluginRepository>     

                  <pluginRepository>

                    <id>snapshot.fusesource.org</id>

                    <name>FuseSource Snapshot Repository</name>

                    <url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>

                    <snapshots>

                      <enabled>true</enabled>

                    </snapshots>

                    <releases>

                      <enabled>false</enabled>

                    </releases>

                  </pluginRepository>

                </pluginRepositories>

               

               

                <dependencies>

                <dependency>

                <groupId>io.fabric8</groupId>

                <artifactId>fabric-cxf</artifactId>

                <version>1.0.0.redhat-394</version>

              </dependency>

              <!--  

                <dependency>

                <groupId>org.fusesource.fabric</groupId>

                <artifactId>fabric-zookeeper</artifactId>

                <version>7.2.0.redhat-024</version>

              </dependency>

                <dependency>

                <groupId>org.fusesource.fabric</groupId>

                <artifactId>fabric-linkedin-zookeeper</artifactId>

                <version>7.2.0.redhat-024</version>

              </dependency>

                <dependency>

                <groupId>org.fusesource.fabric</groupId>

                <artifactId>fabric-core</artifactId>

                <version>7.2.0.redhat-024</version>

              </dependency>

               

              <dependency>

                  <groupId>org.fusesource.fabric</groupId>

                  <artifactId>fabric-cxf</artifactId>

                  <version>7.2.0.redhat-024</version>

              </dependency>

              <dependency>

                          <groupId>org.fusesource.examples</groupId>

                          <artifactId>fabric-cxf-demo-client</artifactId>

                          <version>7.2.0.redhat-024</version>

                      </dependency>

                      <dependency>

                <groupId>org.fusesource.examples</groupId>

                <artifactId>fabric-cxf-demo-server</artifactId>

                <version>7.2.0.redhat-024</version>

              </dependency> -->

                     <!--  <dependency>

                <groupId>org.fusesource.fabric</groupId>

                <artifactId>fabric-cxf</artifactId>

                <version>7.2.0.redhat-024</version>

              </dependency>

                      <dependency>

                <groupId>org.fusesource.fabric</groupId>

                <artifactId>fuse-fabric</artifactId>

                <version>7.2.0.redhat-024</version>

              </dependency>

                     -->

              <!-- <exclusions>

              <exclusion>

              <groupId>org.eclipse.equinox</groupId>

              <artifactId>app</artifactId>

              </exclusion>

              </exclusions> -->

               

               

               

               

                  <!-- logging -->

                  <dependency>

                    <groupId>org.slf4j</groupId>

                    <artifactId>slf4j-api</artifactId>

                    <version>1.7.5</version>

                  </dependency>

                  <dependency>

                    <groupId>org.slf4j</groupId>

                    <artifactId>slf4j-log4j12</artifactId>

                    <version>1.7.5</version>

                  </dependency>

                  <dependency>

                    <groupId>org.slf4j</groupId>

                    <artifactId>jcl-over-slf4j</artifactId>

                    <version>1.7.5</version>

                  </dependency>

                  <dependency>

                    <groupId>log4j</groupId>

                    <artifactId>log4j</artifactId>

                    <version>1.2.17</version>

                  </dependency>

               

               

                  <!-- testing -->

                  <dependency>

                    <groupId>org.apache.camel</groupId>

                    <artifactId>camel-test-blueprint</artifactId>

                    <version>2.12.0.redhat-610379</version>

                    <scope>test</scope>

                  </dependency>

                </dependencies>

               

               

                <build>

                  <defaultGoal>install</defaultGoal>

               

               

                  <plugins>

                    <plugin>

                      <groupId>org.apache.maven.plugins</groupId>

                      <artifactId>maven-compiler-plugin</artifactId>

                      <version>2.5.1</version>

                      <configuration>

                        <source>1.6</source>

                        <target>1.6</target>

                      </configuration>

                    </plugin>

                      <plugin>

                  <groupId>io.fabric8</groupId>

                  <artifactId>fabric8-maven-plugin</artifactId>

                </plugin>

                    <plugin>

                      <groupId>org.apache.maven.plugins</groupId>

                      <artifactId>maven-resources-plugin</artifactId>

                      <version>2.6</version>

                      <configuration>

                        <encoding>UTF-8</encoding>

                      </configuration>

                    </plugin>

               

               

                    <!-- to generate the MANIFEST-FILE of the bundle -->

                    <plugin>

                      <groupId>org.apache.felix</groupId>

                      <artifactId>maven-bundle-plugin</artifactId>

                      <version>2.3.7</version>

                      <extensions>true</extensions>

                      <configuration>

                        <instructions>

                          <Bundle-SymbolicName>cxfDemo</Bundle-SymbolicName>

                         

                          <Import-Package><!-- io.fabric8.cxf,org.fusesource.fabric.cxf, -->org.fusesource.fabric.cxf,*</Import-Package>

                          <DynamicImport-Package>*</DynamicImport-Package>

                        </instructions>

                      </configuration>

                    </plugin>

               

               

                    <!-- to run the example using mvn camel:run -->

                    <plugin>

                      <groupId>org.apache.camel</groupId>

                      <artifactId>camel-maven-plugin</artifactId>

                      <version>2.12.0.redhat-610379</version>

                      <configuration>

                        <useBlueprint>true</useBlueprint>

                      </configuration>

                    </plugin>

               

               

                  </plugins>

                </build>

               

               

              </project>

               

               

              ============/////////////====================

              • 4. Re: Load Balancing for a CXF Service in fabric.
                abhishekkoneru6790

                Hello,

                 

                Thank you for your response.

                It works after refer to the curator interface instead of IZKClient.

                 

                Everything seems ok, but how do we actually test the load balancing feature.

                we can see the below services referenced under demo/lb

                Capture2.JPG

                 

                 

                Capture3.JPG

                 

                 

                 

                How can we get to know the url to test the load balancing feature in fabric?

                Tried to implement it as per mentioned in the documents. but have the below exception.

                it would be really helpful is anyone could explain what a dummy address exactly means as per

                "https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Fuse/6.0/html/Configuring_Web_Service_Endpoints/files/Fabric…"

                 

                Also just want to make sure we are in the right direction. Below is the error

                 

                Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Response was of unexpected text/html ContentType.  Incoming portion of HTML stream: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><HTML><HEAD><LINK type="text/css" rel="stylesheet" href="/cxf/?stylesheet=1"><meta http-equiv=content-type content="text/html; charset=UTF-8"><title>CXF - Service list</title></head><body><span class="heading">Available SOAP services:</span><br/><table cellpadding="1" cellspacing="1" border="1" width="100%"></table><br/><br/><span class="heading">Available RESTful services:</span><br/><table cellpadding="1" cellspacing="1" border="1" width="100%"><tr><td><span class="field">Endpoint address:</span> <span class="value">http://10.8.172.152:8187/cxf/emp</span><br/><span class="field">WADL :</span> <a href="http://10.8.172.152:8187/cxf/emp?_wadl">http://10.8.172.152:8187/cxf/emp?_wadl</a></td></tr><tr><td><span class="field">Endpoint address:</span> <span class="value">http://10.8.172.152:8187/cxf/hello</span><br/><span class="field">WADL :</span> <a href="http://10.8.172.152:8187/cxf/hello?_wadl">http://10.8.172.152:8187/cxf/hello?_wadl</a></td></tr></table></body></html>

                  at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:156)

                  at com.sun.proxy.$Proxy37.helloResource(Unknown Source)

                  at org.fusesource.fabric.demo.cxf.client.Client.<init>(Client.java:57)

                  at org.fusesource.fabric.demo.cxf.client.Client.main(Client.java:66)

                Caused by: org.apache.cxf.interceptor.Fault: Response was of unexpected text/html ContentType.  Incoming portion of HTML stream: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><HTML><HEAD><LINK type="text/css" rel="stylesheet" href="/cxf/?stylesheet=1"><meta http-equiv=content-type content="text/html; charset=UTF-8"><title>CXF - Service list</title></head><body><span class="heading">Available SOAP services:</span><br/><table cellpadding="1" cellspacing="1" border="1" width="100%"></table><br/><br/><span class="heading">Available RESTful services:</span><br/><table cellpadding="1" cellspacing="1" border="1" width="100%"><tr><td><span class="field">Endpoint address:</span> <span class="value">http://10.8.172.152:8187/cxf/emp</span><br/><span class="field">WADL :</span> <a href="http://10.8.172.152:8187/cxf/emp?_wadl">http://10.8.172.152:8187/cxf/emp?_wadl</a></td></tr><tr><td><span class="field">Endpoint address:</span> <span class="value">http://10.8.172.152:8187/cxf/hello</span><br/><span class="field">WADL :</span> <a href="http://10.8.172.152:8187/cxf/hello?_wadl">http://10.8.172.152:8187/cxf/hello?_wadl</a></td></tr></table></body></html>

                  at org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:84)

                  at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)

                  at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:800)

                  at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1694)

                  at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1530)

                  at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1438)

                  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)

                  ... 3 more

                • 5. Re: Load Balancing for a CXF Service in fabric.
                  vrlgohel

                  Hi,

                   

                  Its good to know that you are now able to deploy the application just fine. However, the correct link to refer for the testing should be, https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Fuse/6.1/html/Apache_CXF_Development_Guide/FabricHA.html#FabricHA-LoadBal-Intro.

                   

                  Can you refer to it and check the load balancing feature ?

                   

                  Best Regards,

                  Viral

                  • 6. Re: Load Balancing for a CXF Service in fabric.
                    abhishekkoneru6790

                    Sure.

                    Thanks for your prompt response