1 Reply Latest reply on Jun 3, 2014 9:47 AM by soulaway

    Needed a little bit help with fabric deployment understanding.

    soulaway

      Good day dear community.

      A little time ago we started to integrate osgi esb Fuse (fabric8, camel, blueprint) with our customers services.

      We spent three month to setup our environment: hardware, jenkins, stash, git, maven, eth. So now our stuff works fine and we become to Fabric8, Karaf deployment.

       

      So I've got a simple stuff:

      Fuse 6.1, fabric mode, blueprint contains cxf endpoint as produser and jpa component as consumer.

      Camel rote will be processing this things.

      There is two bundles

       

      sms-service-api (contains pojo's for javax (hbn), jaxb mapping)

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

      <project

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

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

       

        <modelVersion>4.0.0</modelVersion>

        <artifactId>sms-service-api</artifactId>

        <packaging>bundle</packaging>

       

        <parent>

        <groupId>ua.np.services</groupId>

        <artifactId>smsinfoesb</artifactId>

        <version>1.0.4-SNAPSHOT</version>

        </parent>

       

        <dependencies>

        <dependency>

        <groupId>org.hibernate.javax.persistence</groupId>

        <artifactId>hibernate-jpa-2.1-api</artifactId>

        <scope>provided</scope>

        </dependency>

        </dependencies>

       

        <!-- import/export/private resource internal management -->

        <properties>

           <osgi.export.pkg>ua.np.services.smsinfo.*</osgi.export.pkg>

        </properties>

       

        <build>

        <defaultGoal>install</defaultGoal>

        <plugins>

        <plugin>

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

         <executions>

           <execution>

             <id>copy-resources</id>

             <phase>validate</phase>

             <goals>

               <goal>copy-resources</goal>

             </goals>

             <configuration>

               <outputDirectory>${project.build.outputDirectory}</outputDirectory>

               <resources>

                 <resource>

                   <directory>src/main/resources</directory>

                   <filtering>true</filtering>

                 </resource>

               </resources>

             </configuration>

           </execution>

         </executions>

        </plugin>

        <plugin>

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

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

        </plugin>

          <plugin>

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

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

                      <extensions>true</extensions>

          </plugin>

        </plugins>

        </build>

      </project>

       

      And the implementation of service:

      sms-service-impl, contains WS interface, responce processor class, and osgi config things

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

      <project

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

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

       

        <modelVersion>4.0.0</modelVersion>

        <artifactId>sms-service-impl</artifactId>

        <packaging>bundle</packaging>

       

        <parent>

        <groupId>ua.np.services</groupId>

        <artifactId>smsinfoesb</artifactId>

        <version>1.0.4-SNAPSHOT</version>

        </parent>

       

        <dependencies>

       

        <dependency>

        <groupId>ua.np.services</groupId>

        <artifactId>sms-service-api</artifactId>

        <version>1.0.4-SNAPSHOT</version>

        <scope>provided</scope>

        </dependency>

       

        <dependency>

        <groupId>org.ow2.asm</groupId>

        <artifactId>asm-all</artifactId>

        <version>4.1</version>

        <scope>provided</scope>

        </dependency>

       

        <dependency>

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

        <artifactId>camel-cxf</artifactId>

        <scope>provided</scope>

        </dependency>

       

        <dependency>

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

        <artifactId>camel-jpa</artifactId>

        <scope>provided</scope>

        </dependency>

       

        <dependency>

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

        <artifactId>camel-core</artifactId>

        <scope>provided</scope>

        </dependency>

       

        <dependency>

        <groupId>org.hibernate.javax.persistence</groupId>

        <artifactId>hibernate-jpa-2.1-api</artifactId>

        <scope>provided</scope>

        </dependency>

       

        <dependency>

        <groupId>org.apache.cxf</groupId>

        <artifactId>cxf-rt-transports-http-jetty</artifactId>

        <scope>runtime</scope>

        </dependency>

       

      <dependency>

        <groupId>org.hibernate</groupId>

        <artifactId>hibernate-entitymanager</artifactId>

        <scope>provided</scope>

        </dependency>

       

        <!-- jdbc ds drivers -->

        <dependency>

               <groupId>com.microsoft.sqlserver</groupId>

               <artifactId>sqljdbc4</artifactId>

               <scope>provided</scope>

        </dependency>

       

        </dependencies>

       

        <!-- import/export/privare resource internal management -->

        <properties>

           <osgi.import.pkg>

            ua.np.services.smsinfo,

            org.apache.camel.component.jpa.*

         </osgi.import.pkg>

         <osgi.export.pkg>ua.np.services.smsinfo.impl.*</osgi.export.pkg>

        </properties>

       

       

        <build>

        <defaultGoal>install</defaultGoal>

        <plugins>

        <plugin>

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

         <executions>

           <execution>

             <id>copy-resources</id>

             <phase>validate</phase>

             <goals>

               <goal>copy-resources</goal>

             </goals>

             <configuration>

               <outputDirectory>${project.build.outputDirectory}</outputDirectory>

               <resources>

                 <resource>

                   <directory>src/main/resources</directory>

                   <filtering>true</filtering>

                 </resource>

               </resources>

             </configuration>

           </execution>

         </executions>

        </plugin>

        <plugin>

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

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

        </plugin>

        <plugin>

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

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

                      <extensions>true</extensions>

                  </plugin>

        </plugins>

        </build>

      </project>

       

      ** all versions are equal to the fuse on-box bundles versions and present in karaf

       

      Persistence.xml

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

      <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

        <persistence-unit name="camel" transaction-type="RESOURCE_LOCAL"> 

        <provider>org.hibernate.ejb.HibernatePersistence</provider> 

        <!-- <jta-data-source>java:/camelDs</jta-data-source>  --> 

        <class>ua.np.services.smsinfo.Sms</class>

        <exclude-unlisted-classes>true</exclude-unlisted-classes>

        <properties> 

        <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/> 

        <property name="hibernate.hbm2ddl.auto" value="validate"/> 

        <property name="hibernate.show_sql" value="true"/> 

        <property name="hibernate.format_sql" value="true"/> 

        <property name="jboss.entity.manager.factory.jndi.name" value="java:/camelDsEntityManagerFactory"/> 

        <property name="hibernate.connection.driver_class" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>

        <property name="hibernate.connection.url" value="jdbc:sqlserver://dev-db.np.ua:1433;databaseName=our_db"/> 

        <property name="hibernate.connection.username" value="our_usr"/>

        <property name="hibernate.connection.password" value="our_pass"/>

        </properties> 

        </persistence-unit>

      </persistence>


      cxf.xml

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

      <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xmlns:camel-cxf="http://camel.apache.org/schema/blueprint/cxf"

        xmlns:cxf="http://cxf.apache.org/blueprint/core"

        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/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd">

       

        <camel-cxf:cxfEndpoint id="smsCxfEndpoint"

        address="http://localhost:{{sms.endpoint.port}}/{{sms.endpoint.address}}"

        serviceClass="ua.np.services.smsinfo.impl.SmsService"/>

       

      </blueprint>

       

      persistRoute.xml

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

      <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xsi:schemaLocation="

        http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

        <!--  xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.1.0"  -->

       

        <camelContext  id="camel-persister" trace="true" xmlns="http://camel.apache.org/schema/blueprint">

        <route id="persistRoute">

        <from uri="cxf:bean:smsCxfEndpoint" />

        <setBody>

        <simple>

        ${body[0]}

        </simple>

        </setBody>

        <to uri="jpa://?persistenceUnit=camel"/>

        <bean ref="persistenceResponseProcessor"/>

        <log message="JPA body: ${body}" />

        </route>

        </camelContext>

       

         <bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent" activation="eager"/>

         <bean id="persistenceResponseProcessor" class="ua.np.services.smsinfo.impl.ResponceProcessorImpl"/>

      </blueprint>

       

       

      This all nice starts with local camel:run but via deploying to fabric some evil happens.

       

      Profile id: sms-impl

      Version   : 1.0

      Attributes:

              parents: jboss-fuse-medium

      Containers: smsimpl

      Container settings

      ----------------------------

      Features :

              camel-cxf

              camel-blueprint

              camel-jpa

      Bundles :

              wrap:http://nexus.np.ua/nexus/content/groups/public_snapshots/com/microsoft/sqlserver/sqljdbc4/4.0/sqljdbc4-4.0.jar

              mvn:org.hibernate.javax.persistence/hibernate-jpa-2.1-api/1.0.0.Final

              mvn:ua.np.services/sms-service-impl/1.0.4-SNAPSHOT

              mvn:ua.np.services/sms-service-api/1.0.4-SNAPSHOT

      Configuration details

      ---------------------------

      Other resources

      ----------------------------


      There are 3 errors in instance log:

      1:

       

      2:

      Failed to start Apache ActiveMQ ([smsimpl, ID:WSH03626-51206-1401790950662-0:1], java.io.IOException: Transport Connector could not be registered in JMX: Failed to bind to server socket: tcp://0.0.0.0:61616 due to: java.net.BindException: Address already in use: JVM_Bind)

       

      3:


      Please help me with understanding what is going wrong?
      Here is  the bundle manifest (from sms-service-imple.jar):

      Manifest-Version: 1.0

       

      Bnd-LastModified: 1401789051987

      Build-Jdk: 1.7.0_51

      Built-By: soloviov.d

      Bundle-Blueprint: OSGI-INF/blueprint/cxf.xml,OSGI-INF/blueprint/persistR

      oute.xml,OSGI-INF/blueprint/properties.xml

      Bundle-Description: This is Nova Poshta FuseESB component template.

      Bundle-DocURL: http://novaposhta.ua

      Bundle-ManifestVersion: 2

      Bundle-Name: sms-service-impl

      Bundle-SymbolicName: ua.np.services.sms-service-impl

      Bundle-Vendor: Nova Poshta

      Bundle-Version: 1.0.4.SNAPSHOT

      Created-By: Apache Maven Bundle Plugin

      Export-Package: ua.np.services.smsinfo.impl;uses:="ua.np.services.smsinf

      o";version="1.0.4.SNAPSHOT"

      Implementation-Version: 1.0.4-SNAPSHOT

      Import-Package: ua.np.services.smsinfo;version="[1.0,2)",org.apache.came

      l.component.jpa;version="[2.12,3)"

      Include-Resource: log4j.properties=src/main/resources/log4j.properties,M

      ETA-INF/persistence.xml=src/main/resources/META-INF/persistence.xml,OSG

      I-INF/blueprint/cxf.xml=src/main/resources/OSGI-INF/blueprint/cxf.xml,O

      SGI-INF/blueprint/persistRoute.xml=src/main/resources/OSGI-INF/blueprin

      t/persistRoute.xml,OSGI-INF/blueprint/properties.xml=src/main/resources

      /OSGI-INF/blueprint/properties.xml

      Private-Package: log4j.properties

      Tool: Bnd-2.1.0.20130426-122213

       

      And what should I read to understand how the profiles and feature inheritance relates to my container runtime state?


      Thanks in advance!

      Dmitry.