Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331767 - PAR fails to deploy when internal bundle uses DynamicImport-Package to import dependencies
Summary: PAR fails to deploy when internal bundle uses DynamicImport-Package to import...
Status: CLOSED FIXED
Alias: None
Product: Virgo
Classification: RT
Component: unknown (show other bugs)
Version: 2.1.0.RELEASE   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.0.0.M01   Edit
Assignee: Borislav Kapukaranov CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-03 09:13 EST by Tara Simpson CLA
Modified: 2011-02-28 10:08 EST (History)
3 users (show)

See Also:


Attachments
Bundle with Dynamic Import and Activator (Works) (2.46 KB, application/java-archive)
2010-12-07 04:40 EST, Tara Simpson CLA
no flags Details
PAR containing Bundle with Dynamic Import and Activator (Broken) (1.95 KB, application/octet-stream)
2010-12-07 04:43 EST, Tara Simpson CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tara Simpson CLA 2010-12-03 09:13:30 EST
Build Identifier: 2.1.0.RELEASE

Apache Derby imports its dependencies using DynamicImport-Package - it has no explicit Import-Packages but it does have an activator.  The Derby bundle can be deployed standalone, however, when contained within a PAR file, Virgo complains that it cannot find the BundleActivator class:

Caused by: org.osgi.framework.BundleException: The activator org.apache.derby.osgi.EmbeddedActivator for bundle org.unwiredplanet.ease-1.0.0.SNAPSHOT-derby is invalid
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:156)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:751)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:284)
	at org.eclipse.virgo.kernel.core.internal.StandardBundleStarter.start(StandardBundleStarter.java:57)

etc

Caused by: java.lang.ClassNotFoundException: org.osgi.framework.BundleActivator
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:135)

I have reproduced this with my own homespun bundle, and it appears on the surface to specifically related to the use of DynamicImport-Package.  

Let me know if you would like me to email you an example par.

Reproducible: Always

Steps to Reproduce:
1.Create PAR with V10.6 of Apache Derby (no need for any other bundles)
2.Deploy PAR
3.Et Viola
Comment 1 Glyn Normington CLA 2010-12-06 05:00:05 EST
Thanks for reporting this. Dynamic imports have several downsides, but I haven't seen this one before! Would it be possible to attach the homespun example PAR to this bug?
Comment 2 Tara Simpson CLA 2010-12-07 04:40:42 EST
Created attachment 184695 [details]
Bundle with Dynamic Import and Activator (Works)

Working bundle with simple Activator and imports resolved using DynamicImport-Package.  (For some reason this is how Apache Derby does it.)
Comment 3 Tara Simpson CLA 2010-12-07 04:43:09 EST
Created attachment 184698 [details]
PAR containing Bundle with Dynamic Import and Activator (Broken)

PAR containing bundle (see attachment 184695 [details]) that fails to deploy.
Comment 4 Glyn Normington CLA 2010-12-07 04:51:54 EST
Thanks Tara. That's so helpful. :-)
Comment 5 Borislav Kapukaranov CLA 2010-12-27 10:22:10 EST
Hi Tara,

This bug is fixed and will be available in the next milestone.
Thanks for the detailed bug report :)
Comment 6 Borislav Kapukaranov CLA 2010-12-27 10:22:45 EST
i'll resolve the bug now
Comment 7 Glyn Normington CLA 2010-12-28 04:21:04 EST
Tagging for milestone 2.2.0.M02 although this may turn into 3.0.0.M01.
Comment 8 Borislav Kapukaranov CLA 2011-02-28 10:08:37 EST
closing...