java.lang.NullPointerException

Spring JIRA | Félix Cuadrado | 8 years ago
  1. 0

    Problem upgrading from 1.1.0M2 to 1.1.0

    Google Groups | 8 years ago | Félix Cuadrado
    java.lang.NullPointerException
  2. 0

    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

    Spring JIRA | 8 years ago | Félix Cuadrado
    java.lang.NullPointerException
  3. 0

    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

    Spring JIRA | 8 years ago | Félix Cuadrado
    java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    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)

    Spring JIRA | 8 years ago | Ralf Ebert
    java.lang.NullPointerException
  6. 0

    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)

    Spring JIRA | 8 years ago | Ralf Ebert
    java.lang.NullPointerException

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.springframework.osgi.io.internal.resolver.PackageAdminResolver.addExportedPackages()
    2. Spring OSGi IO
      PackageAdminResolver.getImportedBundles
      1. org.springframework.osgi.io.internal.resolver.PackageAdminResolver.addExportedPackages(PackageAdminResolver.java:198)
      2. org.springframework.osgi.io.internal.resolver.PackageAdminResolver.getImportedBundles(PackageAdminResolver.java:78)
      2 frames
    3. org.springframework.osgi
      ContextLoaderListener.start
      1. org.springframework.osgi.extender.internal.activator.SpringTypeCompatibilityChecker.checkCompatibility(SpringTypeCompatibilityChecker.java:71)
      2. org.springframework.osgi.extender.internal.activator.ContextLoaderListener.maybeCreateApplicationContextFor(ContextLoaderListener.java:721)
      3. org.springframework.osgi.extender.internal.activator.ContextLoaderListener.start(ContextLoaderListener.java:416)
      3 frames
    4. Eclipse OSGi
      BundleContextImpl$2.run
      1. org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:999)
      1 frame
    5. Java RT
      AccessController.doPrivileged
      1. java.security.AccessController.doPrivileged(Native Method)
      1 frame
    6. Eclipse OSGi
      StartLevelManager.dispatchEvent
      1. org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:993)
      2. org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:974)
      3. org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)
      4. org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:350)
      5. org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1118)
      6. org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:634)
      7. org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:508)
      8. org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:282)
      9. org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:468)
      9 frames
    7. Eclipse OSGi
      EventManager$EventThread.run
      1. org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:195)
      2. org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:297)
      2 frames