java.lang.NullPointerException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • If a bundle has an optional dependency (Require-Bundle with resolution:=optional) which cannot be resolved at runtime, you get: java.lang.NullPointerException at org.springframework.osgi.io.internal.resolver.PackageAdminResolver.getImportedBundles(PackageAdminResolver.java:70) at org.springframework.osgi.extender.internal.activator.SpringTypeCompatibilityChecker.checkCompatibility(SpringTypeCompatibilityChecker.java:71) at org.springframework.osgi.extender.internal.activator.ContextLoaderListener.maybeCreateApplicationContextFor(ContextLoaderListener.java:716) at org.springframework.osgi.extender.internal.activator.ContextLoaderListener.start(ContextLoaderListener.java:411) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:1009) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:1003) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:984) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:265) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:257) at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:257) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:150) at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:302) at org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(FrameworkConsole.java:287) at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:223) at java.lang.Thread.run(Thread.java:613)
    via by Ralf Ebert,
  • If a bundle has an optional dependency (Require-Bundle with resolution:=optional) which cannot be resolved at runtime, you get: java.lang.NullPointerException at org.springframework.osgi.io.internal.resolver.PackageAdminResolver.getImportedBundles(PackageAdminResolver.java:70) at org.springframework.osgi.extender.internal.activator.SpringTypeCompatibilityChecker.checkCompatibility(SpringTypeCompatibilityChecker.java:71) at org.springframework.osgi.extender.internal.activator.ContextLoaderListener.maybeCreateApplicationContextFor(ContextLoaderListener.java:716) at org.springframework.osgi.extender.internal.activator.ContextLoaderListener.start(ContextLoaderListener.java:411) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:1009) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:1003) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:984) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:265) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:257) at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:257) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:150) at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:302) at org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(FrameworkConsole.java:287) at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:223) at java.lang.Thread.run(Thread.java:613)
    via by Ralf Ebert,
  • Problem upgrading from 1.1.0M2 to 1.1.0
    via by Félix Cuadrado,
  • 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
    via by Félix Cuadrado,
  • 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
    via by Félix Cuadrado,
    • java.lang.NullPointerException at org.springframework.osgi.io.internal.resolver.PackageAdminResolver.getImportedBundles(PackageAdminResolver.java:70) at org.springframework.osgi.extender.internal.activator.SpringTypeCompatibilityChecker.checkCompatibility(SpringTypeCompatibilityChecker.java:71) at org.springframework.osgi.extender.internal.activator.ContextLoaderListener.maybeCreateApplicationContextFor(ContextLoaderListener.java:716) at org.springframework.osgi.extender.internal.activator.ContextLoaderListener.start(ContextLoaderListener.java:411) at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:1009) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:1003) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:984) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:265) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:257) at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:257) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:150) at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:302) at org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(FrameworkConsole.java:287) at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:223) at java.lang.Thread.run(Thread.java:613)
    No Bugmate found.