General things need to follow when creating orbit bundles.

1. Export packages with version.
2. Import packages with a version range. If you are not sure on some
packages will be available at run-time, then use resolution:=optional
directive for those.
3. For any dynamic classes (not known in advance) needs to be imported to
your bundle, only then use DynamicImport-Package header. Otherwise don't
use it.
4. Don't blindly export all the packages. Only export what is required to
OSGi environment.
5. There are some useful bnd instructions that comes handy when needed. For
example <Include-Resource> can be used to include resource files from
dependent jars to your target bundle.



On Mon, May 19, 2014 at 9:55 AM, Chamil Jeewantha <[email protected]> wrote:

> YEP. Import-Package was there :( Thanks for pointing it out.
>
> I just created an orbit bundle just to see whats wrong.
>
> BTW, Thanks again.
>
>
> On Sun, May 18, 2014 at 11:00 PM, Kasun Gajasinghe <[email protected]>wrote:
>
>> The bundle you just provided do have Import-Package defined. :) The
>> MANIFEST.MF is pretty long, so it's easy get lost the lengthy lines!
>>
>> The said java package is set in the Import-Package. Hence, OSGi
>> environment tries to resolve this constraint.
>>
>> When you copy a jar to repo/comp/lib, it generates a new MANIFEST.MF for
>> you. The manifest entries could very well be different from the original
>> MANIFEST including the exported/imported packages and its versions. Why are
>> you trying to generate a orbit bundle, when you already have one? :)
>>
>> Regards,
>> KasunG
>>
>>
>>
>>
>> On Sun, May 18, 2014 at 5:05 PM, Chamil Jeewantha <[email protected]>wrote:
>>
>>> Thanks Kasun,
>>>
>>> I have built it using a clean repo. The only change I've made is
>>> uncommenting <!--extensions>true</extensions--> Sorry that I cannot
>>> attach the jar because its almost 20MB. So I deleted all the .class files
>>> (keeping the directory structure) to attach.
>>>
>>> The generated MANFEST doesn't have any Import-Package s defined. So Why
>>> OSGI complaints missing import package?
>>>
>>> I have copied this jar file to repository/component/lib. then it created
>>> a new dropin and it worked.
>>>
>>>
>>> On Sun, May 18, 2014 at 2:33 PM, Kasun Gajasinghe <[email protected]>wrote:
>>>
>>>> Hi Chamil,
>>>>
>>>> I have built the bundle with your pom. (I had to remove the parent
>>>> reference though). But the built jar did not contain the classes from the
>>>> said java package. Can you attach your bundle if possible?
>>>>
>>>> I think it would be better if you explicitly specify the
>>>> Export-Packages of your bundle instead of exporting everything using '*'.
>>>> That would be easier to comprehend, and actually reduce some complexities.
>>>> As I see, most of the missing import packages of your bundle should be
>>>> optional imports. Some examples
>>>> are org.apache.catalina.tribes, org.apache.activemq.broker, org.postgresql
>>>> etc.
>>>>
>>>> You might also want to verify the Export-Package versions.
>>>>
>>>> Regards,
>>>> KasunG
>>>>
>>>>
>>>> On Sun, May 18, 2014 at 1:30 PM, Chamil Jeewantha <[email protected]>wrote:
>>>>
>>>>> I have created a single jar file using all the dependencies of openejb
>>>>> & tomee. Then I have copied it to dropins folder of AS and started AS.
>>>>>
>>>>> The new bundle is in the INSTALLED status and  the "diag 447" on OSGI
>>>>> console complaints about hundreds of "Missing imported package".
>>>>>
>>>>> Problem is. almost all the complaining packages are included in the
>>>>> bundle itself and they are in the Export-Packages of the same bundle.
>>>>>
>>>>> The pom.xml is attached.
>>>>>
>>>>> example:
>>>>>
>>>>> Missing imported package javax.annotation.processing_0.0.0.
>>>>>
>>>>> but the bundle has javax/annotation/processing/<all the classes>.class
>>>>>
>>>>> Please help.
>>>>>
>>>>> --
>>>>> K.D. Chamil Jeewantha
>>>>> Associate Technical Lead
>>>>> WSO2, Inc.;  http://wso2.com
>>>>> Mobile: +94716813892
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> *Kasun Gajasinghe*Senior Software Engineer, WSO2 Inc.
>>>> email: kasung AT spamfree wso2.com
>>>> linked-in: http://lk.linkedin.com/in/gajasinghe
>>>> blog: http://kasunbg.org
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> K.D. Chamil Jeewantha
>>> Associate Technical Lead
>>> WSO2, Inc.;  http://wso2.com
>>> Mobile: +94716813892
>>>
>>>
>>
>>
>> --
>>
>> *Kasun Gajasinghe*Senior Software Engineer, WSO2 Inc.
>> email: kasung AT spamfree wso2.com
>> linked-in: http://lk.linkedin.com/in/gajasinghe
>> blog: http://kasunbg.org
>>
>>
>>
>
>
>
> --
> K.D. Chamil Jeewantha
> Associate Technical Lead
> WSO2, Inc.;  http://wso2.com
> Mobile: +94716813892
>
>


-- 
*Kishanthan Thangarajah*
Senior Software Engineer,
Platform Technologies Team,
WSO2, Inc.
lean.enterprise.middleware

Mobile - +94773426635
Blog - *http://kishanthan.wordpress.com <http://kishanthan.wordpress.com>*
Twitter - *http://twitter.com/kishanthan <http://twitter.com/kishanthan>*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to