Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-44422

Scheduler Administration JiraPluginScheduler shows a java.lang.NullPointerException exception

    XMLWordPrintable

Details

    Description

      Summary

      The JIRA Scheduler Administration shows the com.atlassian.sal.jira.scheduling.JiraPluginScheduler > JiraPluginScheduler:Service Provider Session Remover is failing with a java.lang.NullPointerException when there are expired tokens for an old Application link.

      JIRA is reports the error: "'JiraPluginScheduler:Service Provider Session Remover' failed java.lang.NullPointerException: consumer a NullPointerException" when the scheduler fired.

      2015-05-18 13:39:13,569 atlassian-scheduler-quartz1.local_Worker-4 ERROR ServiceRunner [atlassian.scheduler.core.JobLauncher] Scheduled job with ID 'JiraPluginScheduler:Service Provider Session Remover' failed
      java.lang.NullPointerException: consumer
      	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:204)
      	at com.atlassian.oauth.Token$TokenBuilder.consumer(Token.java:179)
      	at com.atlassian.jira.oauth.serviceprovider.OfBizServiceProviderTokenStore.createTokenFromGV(OfBizServiceProviderTokenStore.java:392)
      	at com.atlassian.jira.oauth.serviceprovider.OfBizServiceProviderTokenStore.removeExpiredTokens(OfBizServiceProviderTokenStore.java:292)
      	at com.atlassian.jira.oauth.serviceprovider.OfBizServiceProviderTokenStore.removeExpiredTokensAndNotify(OfBizServiceProviderTokenStore.java:276)
      	at com.atlassian.jira.oauth.serviceprovider.CachingServiceProviderTokenStore.removeExpiredTokensAndNotify(CachingServiceProviderTokenStore.java:126)  <+2> (DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
      	at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58)
      	at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
      	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56)
      	at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:39)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
      	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      	at com.sun.proxy.$Proxy1412.removeExpiredTokensAndNotify(Unknown Source)
      	at com.atlassian.oauth.serviceprovider.internal.DelegatingTokenStoreImpl.removeExpiredTokensAndNotify(DelegatingTokenStoreImpl.java:48)
      	at com.atlassian.oauth.serviceprovider.internal.ExpiredSessionRemover.execute(ExpiredSessionRemover.java:20)
      	at com.atlassian.sal.jira.scheduling.JiraPluginScheduler$JobDescriptor.runJob(JiraPluginScheduler.java:130)
      	at com.atlassian.sal.jira.scheduling.JiraPluginScheduler.runJob(JiraPluginScheduler.java:91)
      	at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:136)
      	at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:101)
      	at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:80)
      	at com.atlassian.scheduler.quartz1.Quartz1Job.execute(Quartz1Job.java:32)
      	at org.quartz.core.JobRunShell.run(JobRunShell.java:223)
      	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
      

      Environment

      This appears when application links have existed with other Atlassian Applications, but have since been removed.

      Steps to Reproduce

      It is not clear how the instance originally managed to get into a state where the invalid application link tokens existed.

      Expected Results

      If a token for a application (that doesn't exist) has expired, it should be removed without error.

      Actual Results

      The Scheduled Service fails to remove the invalid token.

      Notes

      There is a possible workaround, however we recommend that you contact JIRA Support before making any changes so that we can verify this issue. We recommend making an Offline backup of JIRA before completing the steps below:

      1. Shutdown JIRA
      2. Take a backup of your Database.
      3. Locate the list of application links in the JIRA database:
        select distinct consumer_key from oauthspconsumer;
        
      4. Locate the list of tokens in the JIRA database:
        select distinct consumer_key from oauthsptoken;
        
      5. If you are seeing the "NullPointerException as pasted above and the results of the SQL queries above DO NOT match run the following:
        DELETE FROM oauthsptoken WHERE consumer_key not in
        	(SELECT distinct consumer_key from oauthspconsumer);
        
      6. Restart JIRA.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              majones Matt Jones (Inactive)
              Votes:
              12 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated: