You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Joe <jo...@cmegroup.com> on 2015/06/24 23:47:07 UTC

Complicated wrapping

Hi,

I'm trying to wrap a couple of jars as a bundle.  The main bundle I want is
called logging, but it has dependencies on another bundle called
logging-common.  I am getting them both from maven.  However, Karaf is mad
at me because they both contain some of the same packages.  They both have
packages called com.blah.logging and com.blah.logging.support.

Would it be possible to wrap them both in a bundle using the wrap command in
bundle, in a feature.xml file?  

Do I need a more complex scheme?  Would I need to make a bundle that imports
the dependences through maven and then exposes the logging package?

Thanks!



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Complicated-wrapping-tp5013411.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Complicated wrapping

Posted by Christian Schneider <ch...@die-schneider.net>.
Before we go too deep with this wrapping.
If you just want to use one of the popular logging frameworks then 
pax-logging may be a solution.
It handles log4j, slf4j, commons logging and jdk logging.

You just use the logging api of your choice and install pax-logging 
which takes care of providing you an implemention for your api.

Christian


On 24.06.2015 23:47, Joe wrote:
> Hi,
>
> I'm trying to wrap a couple of jars as a bundle.  The main bundle I want is
> called logging, but it has dependencies on another bundle called
> logging-common.  I am getting them both from maven.  However, Karaf is mad
> at me because they both contain some of the same packages.  They both have
> packages called com.blah.logging and com.blah.logging.support.
>
> Would it be possible to wrap them both in a bundle using the wrap command in
> bundle, in a feature.xml file?
>
> Do I need a more complex scheme?  Would I need to make a bundle that imports
> the dependences through maven and then exposes the logging package?
>
> Thanks!
>
>
>
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/Complicated-wrapping-tp5013411.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Complicated wrapping

Posted by Christian Schneider <ch...@die-schneider.net>.
Hi Pedro,

why do you embed the postgres driver?
Like you write it already is a nice bundle.

You can just install it in karaf using:
install -s mvn:org.ops4j.pax.jdbc/pax-jdbc-spec/0.6.0
install -s mvn:org.postgresql/postgresql/9.4-1200-jdbc41

There is even a pax-jdbc feature for it.

feature:repo-add pax-jdbc 0.6.0
feature:install pax-jdbc-postgresql

For plain felix you will have to download the bundles from maven central 
and start them.

I also provide complete tutorials for using jdbc and jpa in karaf.

http://liquid-reality.de/display/liquid/2012/01/13/Apache+Karaf+Tutorial+Part+6+-+Database+Access
http://liquid-reality.de/display/liquid/2015/03/05/Apache+Karaf+Tutorial+Part+9+-+Annotation+based+blueprint+and+JPA

The approach described there also applies to plain felix. It is just a 
little more work to find all the needed bundles.

Christian


On 25.06.2015 10:49, Pedro Domingues wrote:
> I have never used karaf, but it seems disappointing.
>
> I am currently fixing my blog, hence some content like pictures can be missing. However take a look at the ways I use to embed dependencies and see if any helps. I use maven: http://web.ist.utl.pt/ist162500/?cat=2
>
> On June 24, 2015 10:47:07 PM WEST, Joe <jo...@cmegroup.com> wrote:
>> Hi,
>>
>> I'm trying to wrap a couple of jars as a bundle.  The main bundle I
>> want is
>> called logging, but it has dependencies on another bundle called
>> logging-common.  I am getting them both from maven.  However, Karaf is
>> mad
>> at me because they both contain some of the same packages.  They both
>> have
>> packages called com.blah.logging and com.blah.logging.support.
>>
>> Would it be possible to wrap them both in a bundle using the wrap
>> command in
>> bundle, in a feature.xml file?
>>
>> Do I need a more complex scheme?  Would I need to make a bundle that
>> imports
>> the dependences through maven and then exposes the logging package?
>>
>> Thanks!
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-felix.18485.x6.nabble.com/Complicated-wrapping-tp5013411.html
>> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Complicated wrapping

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi Adam,

it's as I said create a proper OSGi bundle, best case embed both of your
bundles into one.
And while at it, the blog has some flaws especially about the "bug" it's an
expected behavior as the maven-bundle-plugin
backed by bnd (the same by the way that pax-url-wrap is using) doesn't know
of the "optional" declaration of the original manifest as it doesn't parse
that one.
But besides that you can stick to that sample as blueprint to get your own
bundles "wraped" :-)

regards, Achim


2015-06-25 18:29 GMT+02:00 Adams, Joe <Jo...@cmegroup.com>:

> Thanks everyone.  I believe Pedro's blog shows how to correctly do this.
> It looks like using BND simply is not an option.
>
> From: Achim Nierbeck <bcanhome@googlemail.com<mailto:
> bcanhome@googlemail.com>>
> Date: Thursday, June 25, 2015 at 3:57 AM
> To: "users@felix.apache.org<ma...@felix.apache.org>" <
> users@felix.apache.org<ma...@felix.apache.org>>
> Cc: Joe Adams <jo...@cmegroup.com>>
> Subject: Re: Complicated wrapping
>
> doh' this isn't Karafs fault ...
>
> if you want to install two bundles that are no osgi bundles you have the
> convenience of installing those non-osgi bundles with the wrap url handler.
> So what does the wrap-URL-Handler mean, it'll grab the maven artifact and
> do an automatic osgi bundling to it. How does it do it?
> It uses bnd for creating a OSGi-Manifest and places it back into the used
> artifact stored in the osgi-cache.
>
> So at this point it's the fault of the two jars, cause both now export the
> same packages  com.blah.logging which result in a split-package situation.
> And at this point it's not Karaf that is mad at you it's the OSGi
> Framework. Since you are posting this to the felix mailinglist (not the
> karaf one)
> I guess you are using the default OSGi Framework in Karaf which is Felix.
>
> In the end Felix is mad at you because you deployed two bundles exporting
> the same packages and didn't tell the framework how to handle this
> split-package situation.
>
> How to solve this mess?
> Try to bundle those non-osgi artifacts into either one big uber-bundle or
> create two seperate ones with a clear export-package strategy and maybe a
> declaration for the resolver on how to handle this split-package situation.
>
>
> regards, Achim
>
>
> 2015-06-25 10:49 GMT+02:00 Pedro Domingues <pedro.domingues@ist.utl.pt
> <ma...@ist.utl.pt>>:
> I have never used karaf, but it seems disappointing.
>
> I am currently fixing my blog, hence some content like pictures can be
> missing. However take a look at the ways I use to embed dependencies and
> see if any helps. I use maven: http://web.ist.utl.pt/ist162500/?cat=2
>
> On June 24, 2015 10:47:07 PM WEST, Joe <joe.adams@cmegroup.com<mailto:
> joe.adams@cmegroup.com>> wrote:
> >Hi,
> >
> >I'm trying to wrap a couple of jars as a bundle.  The main bundle I
> >want is
> >called logging, but it has dependencies on another bundle called
> >logging-common.  I am getting them both from maven.  However, Karaf is
> >mad
> >at me because they both contain some of the same packages.  They both
> >have
> >packages called com.blah.logging and com.blah.logging.support.
> >
> >Would it be possible to wrap them both in a bundle using the wrap
> >command in
> >bundle, in a feature.xml file?
> >
> >Do I need a more complex scheme?  Would I need to make a bundle that
> >imports
> >the dependences through maven and then exposes the logging package?
> >
> >Thanks!
> >
> >
> >
> >--
> >View this message in context:
> >
> http://apache-felix.18485.x6.nabble.com/Complicated-wrapping-tp5013411.html
> >Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@felix.apache.org<mailto:
> users-unsubscribe@felix.apache.org>
> >For additional commands, e-mail: users-help@felix.apache.org<mailto:
> users-help@felix.apache.org>
>
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>
>
>
> --
>
> Apache Member
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
> Project Lead
> blog <http://notizblog.nierbeck.de/>
> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
>
> Software Architect / Project Manager / Scrum Master
>
>


-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

Re: Complicated wrapping

Posted by "Adams, Joe" <Jo...@cmegroup.com>.
Thanks everyone.  I believe Pedro's blog shows how to correctly do this.  It looks like using BND simply is not an option.

From: Achim Nierbeck <bc...@googlemail.com>>
Date: Thursday, June 25, 2015 at 3:57 AM
To: "users@felix.apache.org<ma...@felix.apache.org>" <us...@felix.apache.org>>
Cc: Joe Adams <jo...@cmegroup.com>>
Subject: Re: Complicated wrapping

doh' this isn't Karafs fault ...

if you want to install two bundles that are no osgi bundles you have the convenience of installing those non-osgi bundles with the wrap url handler.
So what does the wrap-URL-Handler mean, it'll grab the maven artifact and do an automatic osgi bundling to it. How does it do it?
It uses bnd for creating a OSGi-Manifest and places it back into the used artifact stored in the osgi-cache.

So at this point it's the fault of the two jars, cause both now export the same packages  com.blah.logging which result in a split-package situation.
And at this point it's not Karaf that is mad at you it's the OSGi Framework. Since you are posting this to the felix mailinglist (not the karaf one)
I guess you are using the default OSGi Framework in Karaf which is Felix.

In the end Felix is mad at you because you deployed two bundles exporting the same packages and didn't tell the framework how to handle this split-package situation.

How to solve this mess?
Try to bundle those non-osgi artifacts into either one big uber-bundle or create two seperate ones with a clear export-package strategy and maybe a declaration for the resolver on how to handle this split-package situation.


regards, Achim


2015-06-25 10:49 GMT+02:00 Pedro Domingues <pe...@ist.utl.pt>>:
I have never used karaf, but it seems disappointing.

I am currently fixing my blog, hence some content like pictures can be missing. However take a look at the ways I use to embed dependencies and see if any helps. I use maven: http://web.ist.utl.pt/ist162500/?cat=2

On June 24, 2015 10:47:07 PM WEST, Joe <jo...@cmegroup.com>> wrote:
>Hi,
>
>I'm trying to wrap a couple of jars as a bundle.  The main bundle I
>want is
>called logging, but it has dependencies on another bundle called
>logging-common.  I am getting them both from maven.  However, Karaf is
>mad
>at me because they both contain some of the same packages.  They both
>have
>packages called com.blah.logging and com.blah.logging.support.
>
>Would it be possible to wrap them both in a bundle using the wrap
>command in
>bundle, in a feature.xml file?
>
>Do I need a more complex scheme?  Would I need to make a bundle that
>imports
>the dependences through maven and then exposes the logging package?
>
>Thanks!
>
>
>
>--
>View this message in context:
>http://apache-felix.18485.x6.nabble.com/Complicated-wrapping-tp5013411.html
>Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org<ma...@felix.apache.org>
>For additional commands, e-mail: users-help@felix.apache.org<ma...@felix.apache.org>

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.



--

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Complicated wrapping

Posted by Achim Nierbeck <bc...@googlemail.com>.
doh' this isn't Karafs fault ...

if you want to install two bundles that are no osgi bundles you have the
convenience of installing those non-osgi bundles with the wrap url handler.
So what does the wrap-URL-Handler mean, it'll grab the maven artifact and
do an automatic osgi bundling to it. How does it do it?
It uses bnd for creating a OSGi-Manifest and places it back into the used
artifact stored in the osgi-cache.

So at this point it's the fault of the two jars, cause both now export the
same packages  com.blah.logging which result in a split-package situation.
And at this point it's not Karaf that is mad at you it's the OSGi
Framework. Since you are posting this to the felix mailinglist (not the
karaf one)
I guess you are using the default OSGi Framework in Karaf which is Felix.

In the end Felix is mad at you because you deployed two bundles exporting
the same packages and didn't tell the framework how to handle this
split-package situation.

How to solve this mess?
Try to bundle those non-osgi artifacts into either one big uber-bundle or
create two seperate ones with a clear export-package strategy and maybe a
declaration for the resolver on how to handle this split-package situation.


regards, Achim


2015-06-25 10:49 GMT+02:00 Pedro Domingues <pe...@ist.utl.pt>:

> I have never used karaf, but it seems disappointing.
>
> I am currently fixing my blog, hence some content like pictures can be
> missing. However take a look at the ways I use to embed dependencies and
> see if any helps. I use maven: http://web.ist.utl.pt/ist162500/?cat=2
>
> On June 24, 2015 10:47:07 PM WEST, Joe <jo...@cmegroup.com> wrote:
> >Hi,
> >
> >I'm trying to wrap a couple of jars as a bundle.  The main bundle I
> >want is
> >called logging, but it has dependencies on another bundle called
> >logging-common.  I am getting them both from maven.  However, Karaf is
> >mad
> >at me because they both contain some of the same packages.  They both
> >have
> >packages called com.blah.logging and com.blah.logging.support.
> >
> >Would it be possible to wrap them both in a bundle using the wrap
> >command in
> >bundle, in a feature.xml file?
> >
> >Do I need a more complex scheme?  Would I need to make a bundle that
> >imports
> >the dependences through maven and then exposes the logging package?
> >
> >Thanks!
> >
> >
> >
> >--
> >View this message in context:
> >
> http://apache-felix.18485.x6.nabble.com/Complicated-wrapping-tp5013411.html
> >Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >For additional commands, e-mail: users-help@felix.apache.org
>
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.




-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

Re: Complicated wrapping

Posted by Pedro Domingues <pe...@ist.utl.pt>.
I have never used karaf, but it seems disappointing. 

I am currently fixing my blog, hence some content like pictures can be missing. However take a look at the ways I use to embed dependencies and see if any helps. I use maven: http://web.ist.utl.pt/ist162500/?cat=2

On June 24, 2015 10:47:07 PM WEST, Joe <jo...@cmegroup.com> wrote:
>Hi,
>
>I'm trying to wrap a couple of jars as a bundle.  The main bundle I
>want is
>called logging, but it has dependencies on another bundle called
>logging-common.  I am getting them both from maven.  However, Karaf is
>mad
>at me because they both contain some of the same packages.  They both
>have
>packages called com.blah.logging and com.blah.logging.support.
>
>Would it be possible to wrap them both in a bundle using the wrap
>command in
>bundle, in a feature.xml file?  
>
>Do I need a more complex scheme?  Would I need to make a bundle that
>imports
>the dependences through maven and then exposes the logging package?
>
>Thanks!
>
>
>
>--
>View this message in context:
>http://apache-felix.18485.x6.nabble.com/Complicated-wrapping-tp5013411.html
>Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>For additional commands, e-mail: users-help@felix.apache.org

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.