Issue Details (XML | Word | Printable)

Key: OSGI-579
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Costin Leau
Reporter: Félix Cuadrado
Votes: 1
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Spring OSGi

Spring 1.1.0 problem when parsing Require-Bundle Header

Created: 15/Jul/08 02:51 AM   Updated: 23/Jul/08 06:30 AM
Component/s: CORE
Affects Version/s: 1.1
Fix Version/s: 1.1.1

Time Tracking:
Not Specified

Environment:
Equinox 3.3
Run on Eclipse 3.3 with PDE


 Description  « Hide
We have been developing a system using Spring DM for both application logic componentization and wiring as well as spring mvc for the web interface. Everything was working OK with 1.1.0M2 but, when upgrading to final 1.1.0 the following exception appears:

[Start Level Event Dispatcher] WARN org.springframework.osgi.extender.internal.activator.ContextLoaderListener - Cannot start bundle es.itecban.deployment.repository.manager due to
java.lang.NullPointerException
    at org.springframework.osgi.io.internal.resolver.PackageAdminResolver.addExportedPackages(PackageAdminResolver.java:198)
    at org.springframework.osgi.io.internal.resolver.PackageAdminResolver.getImportedBundles(PackageAdminResolver.java:78)
    at org.springframework.osgi.extender.internal.activator.SpringTypeCompatibilityChecker.checkCompatibility(SpringTypeCompatibilityChecker.java:71)
    at org.springframework.osgi.extender.internal.activator.ContextLoaderListener.maybeCreateApplicationContextFor(ContextLoaderListener.java:721)
    at org.springframework.osgi.extender.internal.activator.ContextLoaderListener.start(ContextLoaderListener.java:416)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:999)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:993)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:974)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:350)
    at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1118)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:634)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:508)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:282)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:468)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:195)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:297)

I have skimmed through the Spring DM code and it looks the problem comes when processing Required Bundles, but the trace does not provide where exactly is the problem.

After setting up the Target Platform for debugging I found the problem appears when Spring DM processes my require bundle header, specifically the first entry:

Require-Bundle: org.eclipse.emf,
 org.eclipse.emf.ecore.xmi,
 org.eclipse.emf.teneo.hibernate;visibility:=reexport,
 org.eclipse.xsd

In execution, on line 79 of the PackageAdminResolver, the call to the OSGi service:

ExportedPackage[] exportedPackages = pa.getExportedPackages(requiredBundle);

returns null (which is correct with the specification, as the emf main bundle does not actually export any package.

After that, the exception is thrown when trying to read the length of the array (line 198).

packages = new ArrayList(pkgs.length);

I think checking the exported packages are not null should be enough to solve the problem.

Félix



 All   Comments   Work Log   Change History   FishEye   Builds      Sort Order: Ascending order - Click to sort in descending order
Damian Gołda added a comment - 17/Jul/08 06:01 AM
I've got the same issue.
We have a bundle which exports no package.

PackageAdmin.getExportedPackages(Bundle) may return null:

 @return An array of exported packages, or <code>null</code> if the specified bundle has no exported packages.