Thanks for your thorogh explanation.
I was playing around with the import / export configuration and now I get an error I cannot get rid of: Caused by: java.lang.ClassNotFoundException: org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor not found by my.class

This only happens in one karaf installation. So I guess there is something inconsistent there. The not found class (BusWiringBeanFactoryPostProcessor) is in org.apache.cxf/cxf-rt-core/2.7.7 which is deployed but my bundle can't find it. I have another bundle installed which CAN find it and the pom files are equivalent.

Are there any old leftovers in the cache? How can I clean up?

Thanks for any help.
Regards
Laci


On 19.06.2014 10:45, Achim Nierbeck wrote:
Hi,

usually the maven-bundle-plugin is pretty good in analyzing the byte code and therefore capable of finding all needed exports/imports. For exports you usually just do a <export-package>"!package.not.needed, *</export-package> where you want to make sure that you don't export one of the packages. Another way to mark those is to add those packages to the private-packages. For Imports you'd usually only append those packages that you know of because of reflection, inside some other file like xml. For example, you have a class that does load classes dynamically, those need to be added because the maven-bundle-plugin isn't capable of finding those. For this you'd usually just do a <import-package>*, package.needed.desperately</import-package>

regards, Achim


2014-06-19 8:40 GMT+02:00 Laci Gaspar <[email protected] <mailto:[email protected]>>:

    hmm... I followed your advice and deleted all the import and
    export configurations and now it works. Thanks.

    In what cases do I have to use the import / export configurations?

    regards,
    Laci


    On 18.06.2014 15:39, Kevin Carr wrote:

    In my experience, it is usually better to leave configuration
    empty, and let the bnd process figure things out for you.

    Occasionally you have to help it, but this sounds like it out
    pretty simple requirement.

    On Jun 18, 2014 8:36 AM, "Laci Gaspar" <[email protected]
    <mailto:[email protected]>> wrote:

        Hi
        There's something I haven't quite understood yet in OSGI, it
        seems.

        I have two bundles (A and B) and bundle A uses a class from
        bundle B.
        In my pom file of bundle A I specify in the maven-bundle-plugin
        ...
                                <import-Package>
                                    javax.xml.bind,
        javax.xml.bind.annotation,
        javax.xml.bind.annotation.adapters,
                                    com.my.package
        ...

        In the pom file of bundle b I say:
        ...
         <Export-Package>
                                    com.my.package,
        ...

        In karaf I can see with exports / imports that the
        configuration in the poms is there.

        But when I call my web service (in bundle A) I get:
        org.apache.cxf.interceptor.Fault:
        com/my/package/HospitalServiceType
        ...
        Caused by: java.lang.ClassNotFoundException:
        com.my.package.HospitalServiceType not found by <bundle B>

        Please enlighten me.
        Regards,
        Laci





--

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/>

Software Architect / Project Manager / Scrum Master


Reply via email to