git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: How to add camel-bindy to osgi project - very urgent help required


Hi,

I think the problem is an invalid instruction within you Import-package of the your Felix-plugin.
<Import-Package>
  ...
  org.apache.camel.camel-bindy,
  ...
</Import-Package>

As far as I know now special import instruction is needed (please correct me if I'm wrong ;) ).

In our experience with using camel-bindy, it is sufficient to add the dependency into your project. 

To make sure, the camel-bindy component is installed, we have included it as a dependency to its feature description.

OSGI-pom example: 
<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";>
  ...
  <properties>
    <camel.osgi.symbolicName>MY OSGi NAME</camel.osgi.symbolicName>
    <camel.osgi.export />
    <camel.osgi.import>*</camel.osgi.import>
    <camel.osgi.private>our.private.project.package.*</camel.osgi.private>   
  </properties>
  <dependencies>
    ...
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-bindy</artifactId>
      <version>${camel.version}</version>
    </dependency>
  </dependencies>
  <build>
    <defaultGoal>install</defaultGoal>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>${org.apache.felix.version}</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Bundle-SymbolicName>${camel.osgi.symbolicName}</Bundle-SymbolicName>
            <Export-Package>${camel.osgi.export}</Export-Package>
            <Private-Package>${camel.osgi.private}</Private-Package>
            <Import-Package>${camel.osgi.import}</Import-Package>
          </instructions>
        </configuration>
      </plugin>
    </plugins>
  </build>
  ...
</project>


-----Original Message-----
From: kurrent93@xxxxxxxxx [mailto:kurrent93@xxxxxxxxx] On Behalf Of Anton Hughes
Sent: Samstag, 12. Mai 2018 00:58
To: users <users@xxxxxxxxxxxxxxxx>
Subject: How to add camel-bindy to osgi project - very urgent help required

Im trying to use camel-bindy in an OSGi project.

However I get the following error:

Failed to execute goal
org.apache.karaf.tooling:karaf-maven-plugin:4.0.8:assembly
(karaf-assembly) on project karaf2-cxf-rest: Unable to build assembly:
Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=io.fabric8.quickstarts.karaf2-cxf-rest;
type=osgi.bundle; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]";
resolution:=mandatory [caused by: Unable to resolve
io.fabric8.quickstarts.karaf2-cxf-rest/1.0.0.SNAPSHOT: missing requirement [io.fabric8.quickstarts.karaf2-cxf-rest/1.0.0.SNAPSHOT]
osgi.wiring.package;
filter:="(osgi.wiring.package=org.apache.camel.camel-bindy)"] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.0.8:assembly
(karaf-assembly) on project karaf2-cxf-rest: Unable to build assembly at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)Caused
by: org.apache.maven.plugin.MojoExecutionException: Unable to build assembly at org.apache.karaf.tooling.AssemblyMojo.execute(AssemblyMojo.java:243)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)...
20 moreCaused by: org.osgi.service.resolver.ResolutionException:
Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=io.fabric8.quickstarts.karaf2-cxf-rest;
type=osgi.bundle; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]";
resolution:=mandatory [caused by: Unable to resolve
io.fabric8.quickstarts.karaf2-cxf-rest/1.0.0.SNAPSHOT: missing requirement [io.fabric8.quickstarts.karaf2-cxf-rest/1.0.0.SNAPSHOT]
osgi.wiring.package;
filter:="(osgi.wiring.package=org.apache.camel.camel-bindy)"]
at org.apache.felix.resolver.ResolutionError.toException(ResolutionError.java:42)
at org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:389)
at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:375)
at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:347)
at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:216)
at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:263)
at org.apache.karaf.profile.assembly.Builder.resolve(Builder.java:1218)
at org.apache.karaf.profile.assembly.Builder.startupStage(Builder.java:1009)
at org.apache.karaf.profile.assembly.Builder.doGenerateAssembly(Builder.java:609)
at org.apache.karaf.profile.assembly.Builder.generateAssembly(Builder.java:392)
at org.apache.karaf.tooling.AssemblyMojo.doExecute(AssemblyMojo.java:401)
at org.apache.karaf.tooling.AssemblyMojo.execute(AssemblyMojo.java:237)...
22 more

Pom File

<?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>
  <groupId>io.fabric8.quickstarts</groupId>
  <artifactId>karaf2-cxf-rest</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>bundle</packaging>
  <name>Fabric8 :: Quickstarts :: Karaf 2 :: CXF REST</name>
  <description>Karaf 2 example running a REST sevice using CXF</description>
  <properties>
    <cxf.plugin.version>3.1.9</cxf.plugin.version>
    <version.maven-bundle-plugin>2.3.7</version.maven-bundle-plugin>
    <maven-compiler-plugin.version>3.6.0</maven-compiler-plugin.version>
    <fabric8.version>2.3.2</fabric8.version>
    <karaf.plugin.version>4.0.8</karaf.plugin.version>
    <maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
    <fabric8.maven.plugin.version>3.5.17</fabric8.maven.plugin.version>
    <exec-maven-plugin.version>1.5.0</exec-maven-plugin.version>
    <camel.version>2.17.0.redhat-630187</camel.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.fabric8</groupId>
        <artifactId>fabric8-project-bom-fuse-karaf</artifactId>
        <version>${fabric8.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-parent</artifactId>
        <version>${camel.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-transports-http</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-frontend-jaxrs</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-rs-service-description</artifactId>
    </dependency>
    <dependency>
      <groupId>io.swagger</groupId>
      <artifactId>swagger-jaxrs</artifactId>
      <version>1.5.4</version>
      <exclusions>
        <exclusion>
          <artifactId>jsr311-api</artifactId>
          <groupId>javax.ws.rs</groupId>
        </exclusion>
      </exclusions>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.jboss.fuse</groupId>
      <artifactId>fuse-karaf-framework</artifactId>
      <type>kar</type>
      <exclusions>
        <exclusion>
          <artifactId>*</artifactId>
          <groupId>*</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.camel.karaf</groupId>
      <artifactId>apache-camel</artifactId>
      <version>${camel.version}</version>
      <classifier>features</classifier>
      <type>xml</type>
    </dependency>
    <dependency>
      <groupId>io.fabric8</groupId>
      <artifactId>fabric8-karaf-features</artifactId>
      <version>${fabric8.version}</version>
      <type>xml</type>
      <classifier>features</classifier>
    </dependency>
    <dependency>
      <groupId>org.ops4j.pax.logging</groupId>
      <artifactId>pax-logging-api</artifactId>
      <version>1.8.3</version>
    </dependency>
    <dependency>
      <groupId>org.ops4j.pax.logging</groupId>
      <artifactId>pax-logging-service</artifactId>
      <version>1.8.3</version>
    </dependency>
    <dependency>
      <groupId>org.apache.felix</groupId>
      <artifactId>org.apache.felix.configadmin</artifactId>
      <version>1.8.8</version>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.junit</groupId>
      <artifactId>arquillian-junit-container</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.fabric8</groupId>
      <artifactId>fabric8-arquillian</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-all</artifactId>
      <version>1.3</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-bindy</artifactId>
      <scope>provided</scope>
     </dependency>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-csv</artifactId>
      <scope>provided</scope>
    </dependency>





  </dependencies>
  <repositories>
    <repository>
      <id>redhat-ga-repository</id>
      <url>https://maven.repository.redhat.com/ga</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>redhat-ga-repository</id>
      <url>https://maven.repository.redhat.com/ga</url>
    </pluginRepository>
  </pluginRepositories>
  <build>
    <defaultGoal>install</defaultGoal>
    <resources>
      <resource>
        <filtering>true</filtering>
        <directory>src/main/resources</directory>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.18.1</version>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>${version.maven-bundle-plugin}</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Import-Package>javax.ws.rs;version="[2,3)",
              javax.ws.rs.core;version="[2,3)",
              javax.ws.rs.ext;version="[2,3)",
              org.apache.camel.camel-bindy,
              javax.xml.bind.annotation,
              org.osgi.service.blueprint,
              io.swagger.jaxrs.config,
              io.swagger.jaxrs.listing,
              org.apache.camel.dataformat.bindy,
              org.apache.camel.dataformat.bindy.csv,
              io.swagger.annotations,
              org.apache.cxf.transport.http,
              com.fasterxml.jackson.annotation,
              com.fasterxml.jackson.core,
              com.fasterxml.jackson.databind,
              com.fasterxml.jackson.jaxrs.json,
              *</Import-Package>
            <Export-Package>io.fabric8.quickstarts.rest</Export-Package>
          </instructions>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-java2wadl-plugin</artifactId>
        <version>${cxf.plugin.version}</version>
        <executions>
          <execution>
            <id>parsejavadoc</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>parsejavadoc</goal>
            </goals>
          </execution>
          <execution>
            <id>process-classes</id>
            <phase>process-classes</phase>
            <goals>
              <goal>java2wadl</goal>
            </goals>
            <configuration>
              <classResourceNames>

<classResourceName>io.fabric8.quickstarts.rest.DeviceService</classResourceName>
              </classResourceNames>
              <docProvider>org.apache.cxf.maven_plugin.javatowadl.ResourceMapJavaDocProvider</docProvider>
              <attachWadl>false</attachWadl>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-surefire-plugin.version}</version>
        <inherited>true</inherited>
        <configuration>
          <excludes>
            <exclude>**/*KT.java</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-install-plugin</artifactId>
        <version>2.5.2</version>
        <executions>
          <execution>
            <id>default-install</id>
            <phase>install</phase>
            <goals>
              <goal>install</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.karaf.tooling</groupId>
        <artifactId>karaf-maven-plugin</artifactId>
        <version>${karaf.plugin.version}</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <id>karaf-assembly</id>
            <phase>install</phase>
            <goals>
              <goal>assembly</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <javase>1.8</javase>
          <karafVersion>v24</karafVersion>
          <useReferenceUrls>true</useReferenceUrls>
          <archiveTarGz>false</archiveTarGz>
          <includeBuildOutputDirectory>false</includeBuildOutputDirectory>
          <startupFeatures>
            <feature>karaf-framework</feature>
            <feature>jaas</feature>
            <feature>aries-blueprint</feature>
            <feature>cxf-jaxrs</feature>
            <feature>cxf-rs-description-swagger2</feature>
            <feature>fabric8-karaf-checks</feature>
            <feature>camel</feature>
            <feature>camel-bindy</feature>
          </startupFeatures>
          <startupBundles>
            <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
          </startupBundles>
        </configuration>
      </plugin>
      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>fabric8-maven-plugin</artifactId>
        <version>${fabric8.maven.plugin.version}</version>
        <executions>
          <execution>
            <id>generate-resource</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>resource</goal>
            </goals>
          </execution>
          <execution>
            <id>build-image</id>
            <phase>install</phase>
            <goals>
              <goal>build</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

I have tried:

   1. Adding org.apache.camel.camel-bindy, org.apache.camel.dataformat.bindy,
   and  org.apache.camel.dataformat.bindy.csv to Import-Package
   2. Adding <feature>camel</feature><feature>camel-bindy</feature> to
   startupFeatures.

None of these made any difference.

Any help is greatly appreciated


( ! ) Warning: include(msgfooter.php): failed to open stream: No such file or directory in /var/www/git/apache-camel-users/msg03304.html on line 525
Call Stack
#TimeMemoryFunctionLocation
10.0009385080{main}( ).../msg03304.html:0

( ! ) Warning: include(): Failed opening 'msgfooter.php' for inclusion (include_path='.:/var/www/git') in /var/www/git/apache-camel-users/msg03304.html on line 525
Call Stack
#TimeMemoryFunctionLocation
10.0009385080{main}( ).../msg03304.html:0