1

I'm trying to OSGify my projects.

I'm using Fuse jboss-fuse-6.2.1.redhat-084, and if I look at osgi:headers for the package, I get the red error org.beanio.

Import-Package =
    com.thoughtworks.xstream;version="[1.4,2)",
    javax.activation,
    javax.mail;version="[1.4,2)",
    javax.mail.internet;version="[1.4,2)",
    javax.xml.bind,
    org.apache.activemq.camel.component,
    org.apache.camel;version="[2.15,3)",
    org.apache.camel.builder;version="[2.15,3)",
    org.apache.camel.dataformat.bindy.fixed,
    org.apache.camel.spring.spi;version="[2.15,3)",
    org.apache.cxf.interceptor;version="[3.0,4)",
    org.apache.log4j;version="[1.2,2)",
    org.beanio;version="[2.1,3)",
    (others)

Error:

missing requirement osgi.wiring.package; (&(osgi.wiring.package=org.beanio)(version>=2.1.0)(!(version>=3.0.0))))

I'm not explicitly importing beanio myself: it gets it from the org.jboss.fuse.bom for this Fuse. The camel-beanio version is 2.15.1.redhat-621084 and that uses org.beanio v2.1.0.

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-beanio</artifactId>
    </dependency>

I've grep searched the osgi:classes and nothing is using v3.0. Also, v3.0 doesn't even exist. So, I don't know where it's getting that "[2.1,3)" from.

I worked out how to specify 2.1.0, but it then just complains that it can't find 2.1.0.

So what do I do? Nothing is exporting 2.1.0. But I can't get rid of it from Import-Package because * includes it after searching the code.

djb
  • 1,635
  • 3
  • 26
  • 49
  • you seem to be misunderstanding the error message. It says it requires `org.beanio` version >= 2.1.0 and NOT >= 3.0.0... the syntax `[2.1,3)` means 2.1 inclusive, up to 3 exclusive. – Renato Sep 05 '16 at 20:05
  • You can install camel-beanio first by running `install:feature camel-beanio` in the fuse shell. And you should always use the same version in your project as Fuse uses. – Claus Ibsen Sep 06 '16 at 07:38

2 Answers2

1

As you said yourself: "The camel-beanio version is 2.15.1.redhat-621084 and that uses org.beanio v2.1.0".

You just need this in your pom:

<dependency>
    <groupId>org.beanio</groupId>
    <artifactId>beanio</artifactId>
    <version>2.1.0</version>
</dependency>

This is in Maven Central so it should work.

As I mentioned in a comment, the error message you got tells you you need the package org.beanio with version >= 2.1.0 and NOT >= 3.0.

The above dependency provides this package, as you can see here.

However, this does not seem to be a OSGi bundle... so you'll have to wrap it.

Community
  • 1
  • 1
Renato
  • 12,940
  • 3
  • 54
  • 85
  • I added that exact dependency. Doesn't fix it. I understand that it's looking for >v2.1.0... as I said, 3.0 doesn't even exist. I have to wrap it? Ah I see Claus's comment... will give that a go. – djb Sep 07 '16 at 07:57
  • So, the features:install worked. Adding the dependency did not work though. – djb Sep 07 '16 at 10:40
  • So your framework is wrapping the jar for you... If you wrapped it yourself using Bnd, Pax::wrap or the osgi-run gradle plugin, it would work as well. – Renato Sep 07 '16 at 12:03
  • I added a link to a SO question on how to wrap jars into OSGi bundles. For anyone using Gradle, just use [osgi-run](https://github.com/renatoathaydes/osgi-run#wrapping-non-bundles-flat-jars) and it will wrap the jar automatically for you. – Renato Sep 07 '16 at 12:07
1

Include the dependency in features.xml as below:

<bundle>mvn:org.beanio/beanio/${version}</bundle>

Then, type features:refreshurl command and install the bundle

Alexandre Cartapanis
  • 1,513
  • 3
  • 15
  • 19
Prateek Mehta
  • 488
  • 1
  • 8
  • 15