glassfish
  1. glassfish
  2. GLASSFISH-19261

[osgi/javaee-base] NPE(Specified service reference cannot be null) during server shutdown is preventing cleanup to complete

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.0_b82_EE7MS7
    • Component/s: OSGi-JavaEE
    • Labels:
      None
    • Environment:

      1 Windows XP
      2 Glassfish Trunk Building SnapShot

      Description

      After deploying a ejb bundle successfully, if stopping domain, the following exception happened on server.log,

      [#|2012-10-30T19:50:20.890+0900|WARNING|44.0|org.glassfish.osgijavaeebase|_ThreadID=19;_ThreadName=Thread-25;_TimeMillis=1351594220890;_LevelValue=900;|Failed to undeploy bundle org.glassfish.fighterfish.sample.uas.ejbservice [285]
      java.lang.NullPointerException: Specified service reference cannot be null.
      at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:458)
      at org.glassfish.osgijavaeebase.AbstractOSGiDeployer.getGlassFish(AbstractOSGiDeployer.java:197)
      at org.glassfish.osgijavaeebase.AbstractOSGiDeployer.getReport(AbstractOSGiDeployer.java:149)
      at org.glassfish.osgijavaeebase.AbstractOSGiDeployer.undeploy(AbstractOSGiDeployer.java:137)
      at org.glassfish.osgijavaeebase.OSGiContainer.undeploy(OSGiContainer.java:193)
      at org.glassfish.osgijavaeebase.AbstractOSGiDeployer.undeployAll(AbstractOSGiDeployer.java:168)
      at org.glassfish.osgijavaeebase.AbstractOSGiDeployer.unregister(AbstractOSGiDeployer.java:115)
      at org.glassfish.osgiejb.EJBExtender.stop(EJBExtender.java:71)
      at org.glassfish.osgijavaeebase.ExtenderManager$ExtenderTracker.removedService(ExtenderManager.java:153)
      at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:1006)
      at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:906)
      at org.osgi.util.tracker.AbstractTracked.untrack(AbstractTracked.java:352)
      at org.osgi.util.tracker.ServiceTracker.close(ServiceTracker.java:412)
      at org.glassfish.osgijavaeebase.ExtenderManager.stopExtenders(ExtenderManager.java:122)
      at org.glassfish.osgijavaeebase.ExtenderManager.access$400(ExtenderManager.java:67)
      at org.glassfish.osgijavaeebase.ExtenderManager$GlassFishServerTracker$1$1.event(ExtenderManager.java:197)
      at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128)
      at com.sun.enterprise.v3.server.AppServerStartup.stop(AppServerStartup.java:324)
      at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.stop(GlassFishImpl.java:88)
      at com.sun.enterprise.glassfish.bootstrap.GlassFishDecorator.stop(GlassFishDecorator.java:68)
      at com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishImpl.stop(EmbeddedOSGiGlassFishImpl.java:80)
      at com.sun.enterprise.v3.admin.StopServer.doExecute(StopServer.java:78)
      at com.sun.enterprise.v3.admin.StopDomainCommand.execute(StopDomainCommand.java:95)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:549)
      at org.glassfish.api.AsyncImpl$1$1.run(AsyncImpl.java:79)

      #]

      The attachments is my test samples which are built from fighterfish\sample\uas. In order to reproduce the exception, please do the following:

      1 edit osgi.properties and make org.glassfish.osgjpa.extension.useHybridPersistenceProviderResolver=true
      2 asadmin start-domain
      3 asadmin start-database
      4 asadmin deploy --type=osgi sample.uas.api.jar
      5 asadmin deploy --type=osgi sample.uas.entities.jar
      6 asadmin deploy --type=osgi sample.uas.ejbservice.jar
      7 asadmin stop-domain ------★★ NPE happened!

        Issue Links

          Activity

          Hide
          TangYong added a comment -

          Sahoo Said:

          Since GlassFish service is getting removed, it is likely that getBundleContext().getServiceReference(GlassFish.class.getName()) is returning null.

          Show
          TangYong added a comment - Sahoo Said: Since GlassFish service is getting removed, it is likely that getBundleContext().getServiceReference(GlassFish.class.getName()) is returning null.
          Hide
          TangYong added a comment -

          Sahoo,

          Please closed the issue as duplicated issue with GLASSFISH-19697. And I wish fixing is put into GLASSFISH-19697.

          Thanks
          --Tang

          Show
          TangYong added a comment - Sahoo, Please closed the issue as duplicated issue with GLASSFISH-19697 . And I wish fixing is put into GLASSFISH-19697 . Thanks --Tang
          Hide
          Sanjeeb Sahoo added a comment - - edited

          This issue does not occur in 3.1.2. This is a regression caused by GLASSFISH-18188 which is fixed in GlassFish 4.0 only. As part of that bug fix, we unregister GlassFish from service registry as the first step in shutdown path. We are doing so, because GlassFish's state becomes Stopping and as such it is useless as one can't call methods like getService(). So, I think unregistering early makes sense.

          As Tang commented in GLASSFISH-19697, AbstractOSGiDeployer's undeploy method is getting called during shutdown and there it is trying to get a reference to GlassFish service, so it is getting null. I have now switched to using Globals API and tested against both GF 3.1.2.2 and GF 4.0.

          Sending osgi-javaee-base/RELEASENOTE.txt
          Sending osgi-javaee-base/src/main/java/org/glassfish/osgijavaeebase/AbstractOSGiDeployer.java
          Transmitting file data ..
          Committed revision 60807.

          Will mark it fixed once we integrate new version of osgi-javaee-base.

          Show
          Sanjeeb Sahoo added a comment - - edited This issue does not occur in 3.1.2. This is a regression caused by GLASSFISH-18188 which is fixed in GlassFish 4.0 only. As part of that bug fix, we unregister GlassFish from service registry as the first step in shutdown path. We are doing so, because GlassFish's state becomes Stopping and as such it is useless as one can't call methods like getService(). So, I think unregistering early makes sense. As Tang commented in GLASSFISH-19697 , AbstractOSGiDeployer's undeploy method is getting called during shutdown and there it is trying to get a reference to GlassFish service, so it is getting null. I have now switched to using Globals API and tested against both GF 3.1.2.2 and GF 4.0. Sending osgi-javaee-base/RELEASENOTE.txt Sending osgi-javaee-base/src/main/java/org/glassfish/osgijavaeebase/AbstractOSGiDeployer.java Transmitting file data .. Committed revision 60807. Will mark it fixed once we integrate new version of osgi-javaee-base.
          Hide
          Sanjeeb Sahoo added a comment -

          Integrated osgi-javaee-base:1.0.6 with glassfish trunk in svn #60905, so marking the bug as resolved.

          Show
          Sanjeeb Sahoo added a comment - Integrated osgi-javaee-base:1.0.6 with glassfish trunk in svn #60905, so marking the bug as resolved.

            People

            • Assignee:
              Sanjeeb Sahoo
              Reporter:
              TangYong
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: