Bug 379253

Summary: Problem updating a bundle
Product: [Eclipse Project] Equinox Reporter: Templier Thierry <templth>
Component: FrameworkAssignee: equinox.framework-inbox <equinox.framework-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: tjwatson
Version: unspecifiedKeywords: needinfo
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Templier Thierry CLA 2012-05-11 09:52:25 EDT
Build Identifier: 20110218-0911

I installed a bundle programmatically using BundleContext.installBundle method. I put something like that for the bundle name (second parameter):

file://[...]/[bundleName]-[bundleVersion].jar

When I try then to update this bundle, it seems not to be correctly updated and I have then a NoClassDefFoundError exception when trying to use an OSGi service provided by the bundle:

java.lang.NoClassDefFoundError: org/test/app/model/Test
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2444)
at java.lang.Class.getDeclaredMethods(Class.java:1808)
[...]
Caused by: java.lang.ClassNotFoundException: org.test.app.model.Test
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
... 51 more

I put a trace in the getZipFile method of the SecureAction and Equinox tries to load the following file. It correspond to the updated bundle.

[...]/workspaces/.metadata/.plugins/org.eclipse.pde.core/New_configuration/org.eclipse.osgi/bundles/155/13/bundlefile

Reproducible: Sometimes

Steps to Reproduce:
1. Install a bundle with BundleContext.installBundle method
2. Update the bundle with Bundle.update(InputStream) method
3. Call an OSGi service provided by the bundle
Comment 1 Thomas Watson CLA 2012-05-14 09:29:12 EDT
It would help if you could attach some test bundles that exhibit the behavior and help us to reproduce.
Comment 2 Thomas Watson CLA 2014-02-21 17:10:57 EST
We need a testcase to reproduce.