You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by homeration <ch...@orange.fr> on 2013/10/18 10:35:18 UTC

Dynamic-import into non user library

Hi all,

I expose my problem:
I use a JMS client in my application running Karaf. JMS libraries are
deployed in Karaf as OSGI modules. I use the Spring framework to facilitate
the integration.

Upon receipt of a JMS message, external JMS library tries to deserialize the
wrapped java object (the JMS message wrap a java object - ObjectMessage -).
But as it did not import the class, it generates a ClassNotFoundException.

I've had the same problem when I used other libraries like Hector (for
Apache Cassandra).

What do you recommend to do in this use case? Edit the module to add the
"Dynamic-Import" tag?

Regards, Christophe.



--
View this message in context: http://karaf.922171.n3.nabble.com/Dynamic-import-into-non-user-library-tp4029990.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Dynamic-import into non user library

Posted by homeration <ch...@orange.fr>.
Thank you, I will use this solution.



--
View this message in context: http://karaf.922171.n3.nabble.com/Dynamic-import-into-non-user-library-tp4029990p4029994.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Dynamic-import into non user library

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

well it should have had a dynamic-import in the first place (if it's
already a OSGi bundle)
But you might find it easier to create a Fragment bundle that only contains
a new Manifest containing only this Dynamic-Import part and attach it to
the third-party bundle in question.
I got an example of how this is done at [1], it's basically just a module
containing only a manifest.

Regards, Achim

[1] -
https://github.com/ops4j/org.ops4j.pax.web/tree/master/pax-web-features/xbean-fragment



2013/10/18 homeration <ch...@orange.fr>

> Hi Achim,
>
> In my case, I can add the specific packages to import (which are of course
> exported). I find it unfortunate that we should edit third-party modules.
> Are there no other ways in Karaf to add imported packages for a particular
> module (without touching the JAR file) ?
>
> regards, Christophe.
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Dynamic-import-into-non-user-library-tp4029990p4029992.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
Commiter & Project Lead
blog <http://notizblog.nierbeck.de/>

Re: Dynamic-import into non user library

Posted by homeration <ch...@orange.fr>.
Hi Achim,

In my case, I can add the specific packages to import (which are of course
exported). I find it unfortunate that we should edit third-party modules.
Are there no other ways in Karaf to add imported packages for a particular
module (without touching the JAR file) ?

regards, Christophe.



--
View this message in context: http://karaf.922171.n3.nabble.com/Dynamic-import-into-non-user-library-tp4029990p4029992.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Dynamic-import into non user library

Posted by Achim Nierbeck <bc...@googlemail.com>.
In that case it's probably best to use the dynamic-import for the jms
librarie as it can't know of your own classes.
Make sure are actually exporting it also :)

Otherwise it's usually better to have a strict Import-Package but in this
case as it's a infrastructural component it's OK.

regards, Achim


2013/10/18 homeration <ch...@orange.fr>

> Hi all,
>
> I expose my problem:
> I use a JMS client in my application running Karaf. JMS libraries are
> deployed in Karaf as OSGI modules. I use the Spring framework to facilitate
> the integration.
>
> Upon receipt of a JMS message, external JMS library tries to deserialize
> the
> wrapped java object (the JMS message wrap a java object - ObjectMessage -).
> But as it did not import the class, it generates a ClassNotFoundException.
>
> I've had the same problem when I used other libraries like Hector (for
> Apache Cassandra).
>
> What do you recommend to do in this use case? Edit the module to add the
> "Dynamic-Import" tag?
>
> Regards, Christophe.
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Dynamic-import-into-non-user-library-tp4029990.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
Commiter & Project Lead
blog <http://notizblog.nierbeck.de/>