hk2
  1. hk2
  2. HK2-110

Globals.get() throws java.lang.IllegalStateException

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.2.0
    • Component/s: None
    • Labels:
      None

      Description

      Revision 61428 for GLASSFISH-20206 causes WARNING when jmsra is shut down. The reason might be catching MultiException instead of RunLevelException.

      Index: D:/work_dir/glassfish/trunk/all/main/appserver/jms/jms-core/src/main/java/com/sun/enterprise/connectors/jms/system/ActiveJmsResourceAdapter.java
      ===================================================================
      — D:/work_dir/glassfish/trunk/all/main/appserver/jms/jms-core/src/main/java/com/sun/enterprise/connectors/jms/system/ActiveJmsResourceAdapter.java (revision 61427)
      +++ D:/work_dir/glassfish/trunk/all/main/appserver/jms/jms-core/src/main/java/com/sun/enterprise/connectors/jms/system/ActiveJmsResourceAdapter.java (revision 61428)
      @@ -126,9 +126,9 @@
      import org.glassfish.server.ServerEnvironmentImpl;

      import org.jvnet.hk2.annotations.Service;
      +import org.glassfish.hk2.api.MultiException;
      import org.glassfish.hk2.api.PostConstruct;
      import org.glassfish.hk2.api.ServiceLocator;
      -import org.glassfish.hk2.runlevel.RunLevelException;

      import javax.inject.Singleton;
      import org.jvnet.hk2.config.types.Property;
      @@ -402,7 +402,7 @@
      GrizzlyService grizzlyService = null;
      try

      { grizzlyService = Globals.get(GrizzlyService.class); - }

      catch (RunLevelException rle)

      { + }

      catch (MultiException rle)

      { // if GrizzlyService was shut down already, skip removing the proxy. }

      if (grizzlyService != null)

      To reproduce it:

      1. start glassfish
      2. asadmin jms-ping --target server
      3. shut down glassfish

      Then WARNING appears in server.log,

      [2013-04-22T11:13:48.973+0800] [glassfish 4.0] [WARNING] [] [javax.enterprise.resource.jms.com.sun.enterprise.connectors.jms.system] [tid: _ThreadID=133 _ThreadName=Thread-29] [timeMillis: 1366600428973] [levelValue: 900] [[
      Error occurs when shutting down JMSRA: Service com.sun.enterprise.v3.services.impl.GrizzlyService was started at level 0 but it has a run level of 10. The full descriptor is SystemDescriptor(
      implementation=com.sun.enterprise.v3.services.impl.GrizzlyService
      contracts=

      {com.sun.enterprise.v3.services.impl.GrizzlyService,org.glassfish.api.container.RequestDispatcher}
      scope=org.glassfish.hk2.runlevel.RunLevel
      qualifiers={}
      descriptorType=CLASS
      descriptorVisibility=NORMAL
      metadata=runLevelValue={10},Bundle-SymbolicName={org.glassfish.main.core.kernel},Bundle-Version={4.0.0.SNAPSHOT}
      rank=50
      loader=OsgiPopulatorPostProcessor.HK2Loader(OSGiModuleImpl:: Bundle = [org.glassfish.main.core.kernel [192]], State = [READY],9394331)
      proxiable=null
      analysisName=null
      id=690
      locatorId=0
      identityHashCode=16925195
      reified=true)]]

      [2013-04-22T11:13:48.973+0800] [glassfish 4.0] [WARNING] [ra.stop.failed] [javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service] [tid: _ThreadID=132 _ThreadName=Thread-28] [timeMillis: 1366600428973] [levelValue: 900] [[
      RAR8053: RA [ jmsra ] stop failed, java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.IllegalStateException: Service com.sun.enterprise.v3.services.impl.GrizzlyService was started at level 0 but it has a run level of 10. The full descriptor is SystemDescriptor(
      implementation=com.sun.enterprise.v3.services.impl.GrizzlyService
      contracts={com.sun.enterprise.v3.services.impl.GrizzlyService,org.glassfish.api.container.RequestDispatcher}

      scope=org.glassfish.hk2.runlevel.RunLevel
      qualifiers={}
      descriptorType=CLASS
      descriptorVisibility=NORMAL
      metadata=runLevelValue=

      {10},Bundle-SymbolicName={org.glassfish.main.core.kernel},Bundle-Version={4.0.0.SNAPSHOT}
      rank=50
      loader=OsgiPopulatorPostProcessor.HK2Loader(OSGiModuleImpl:: Bundle = [org.glassfish.main.core.kernel [192]], State = [READY],9394331)
      proxiable=null
      analysisName=null
      id=690
      locatorId=0
      identityHashCode=16925195
      reified=true)]]

      [2013-04-22T11:13:48.974+0800] [glassfish 4.0] [INFO] [] [javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service] [tid: _ThreadID=132 _ThreadName=Thread-28] [timeMillis: 1366600428974] [levelValue: 800] [[
      shutdown of RA [ jmsra ] is either already complete or already cancelled]]

      [2013-04-22T11:13:48.974+0800] [glassfish 4.0] [WARNING] [ra.stop-unsuccessful] [javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service] [tid: _ThreadID=132 _ThreadName=Thread-28] [timeMillis: 1366600428974] [levelValue: 900] [[
      RAR7095: jmsra shutdown unsuccessful. Please refer the server and/or resource adapter logs for more information.]]

      *****************************
      StackTrace
      *****************************

      [2013-04-22T20:44:40.836+0800] [glassfish 4.0] [SEVERE] [] [] [tid: _ThreadID=133 _ThreadName=Thread-8] [timeMillis: 1366634680836] [levelValue: 1000] [[
      java.lang.IllegalStateException: Service com.sun.enterprise.v3.services.impl.GrizzlyService was started at level 0 but it has a run level of 10. The full descriptor is SystemDescriptor(
      implementation=com.sun.enterprise.v3.services.impl.GrizzlyService
      contracts={com.sun.enterprise.v3.services.impl.GrizzlyService,org.glassfish.api.container.RequestDispatcher}
      scope=org.glassfish.hk2.runlevel.RunLevel
      qualifiers={}
      descriptorType=CLASS
      descriptorVisibility=NORMAL
      metadata=runLevelValue={10}

      ,Bundle-SymbolicName=

      {org.glassfish.main.core.kernel}

      ,Bundle-Version=

      {4.0.0.SNAPSHOT}

      rank=50
      loader=OsgiPopulatorPostProcessor.HK2Loader(OSGiModuleImpl:: Bundle = [org.glassfish.main.core.kernel [192]], State = [READY],2947307)
      proxiable=null
      analysisName=null
      id=690
      locatorId=0
      identityHashCode=9063159
      reified=true)
      at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.validate(AsyncRunLevelContext.java:228)
      at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:155)
      at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2203)
      at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:579)
      at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:566)
      at org.glassfish.internal.api.Globals.get(Globals.java:86)
      at com.sun.enterprise.connectors.jms.system.ActiveJmsResourceAdapter.destroy(ActiveJmsResourceAdapter.java:404)
      at com.sun.enterprise.connectors.service.ResourceAdapterAdminServiceImpl$RAShutdownTask.run(ResourceAdapterAdminServiceImpl.java:624)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:722)]]

        Issue Links

          Activity

          Hide
          jwells added a comment -

          This has been fixed on the hk2 side. It needs to be uptaken by GlassFish.

          Show
          jwells added a comment - This has been fixed on the hk2 side. It needs to be uptaken by GlassFish.
          Hide
          jwells added a comment -

          This has been fixed in hk2.

          Show
          jwells added a comment - This has been fixed in hk2.

            People

            • Assignee:
              jwells
              Reporter:
              David Zhao
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: