java.lang.NullPointerException

Atlassian JIRA | Brad Baker [Atlassian] | 2 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    The JEPP code base can throw NPEs during JIRA Service Desk startup, but only some times. The exception looks like this {quote} Failure simplicity.atlassian.net: JIRA is 503 Server Error: Service Unavailable com.atlassian.servicedesk:sd-general-health-check: The internal modules have failed to start : NullPointerException: java.lang.NullPointerException at com.atlassian.jira.internal.mail.processor.feature.channel.MailChannelStore.getMailChannelByKey(MailChannelStore.java:63) at com.atlassian.jira.internal.mail.processor.feature.channel.MailChannelManager.getMailChannelDefinitionByKey(MailChannelManager.java:270) at com.atlassian.jira.internal.mail.processor.feature.channel.DefaultChannelManager.getMailChannelByKey(DefaultChannelManager.java:46) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) at com.sun.proxy.$Proxy2999.getMailChannelByKey(Unknown Source) at com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.JEPP.JEPPServiceImpl.getMailChannelByKey(JEPPServiceImpl.scala:26) at com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailChannelSettingTestValidator.validMailChannel(EmailChannelSettingTestValidator.scala:66) at com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailPlatformChannelManagerImpl.com$atlassian$servicedesk$internal$feature$emailchannel$emailplatform$EmailPlatformChannelManagerImpl$$isBrokenEmailChannelSetting(EmailPlatformChannelManagerImpl.scala:329) at com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailPlatformChannelManagerImpl$$anonfun$getValidOnDemandEmailChannels$1.apply(EmailPlatformChannelManagerImpl.scala:309) at com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailPlatformChannelManagerImpl$$anonfun$getValidOnDemandEmailChannels$1.apply(EmailPlatformChannelManagerImpl.scala:309) at scala.collection.TraversableLike$$anonfun$filter$1.apply(TraversableLike.scala:264) at scala.collection.immutable.List.foreach(List.scala:318) at scala.collection.TraversableLike$class.filter(TraversableLike.scala:263) at scala.collection.AbstractTraversable.filter(Traversable.scala:105) at com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailPlatformChannelManagerImpl.getValidOnDemandEmailChannels(EmailPlatformChannelManagerImpl.scala:309) at com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailPlatformChannelManagerImpl.checkODEmailChannelConnectivityAndUpdateExpiredPasswords(EmailPlatformChannelManagerImpl.scala:113) at com.atlassian.servicedesk.internal.feature.emailchannel.EmailChannelManagerDelegator.checkODEmailChannelConnectivityAndUpdateExpiredPasswords(EmailChannelManagerDelegator.scala:44) at com.atlassian.servicedesk.internal.email.mailstore.ODMailStoreChecker.verifyAndUpdateODMailSettingsPassword(ODMailStoreChecker.java:20) at com.atlassian.servicedesk.bootstrap.lifecycle.TenantAwareneODMailInitialiser.initialize(TenantAwareneODMailInitialiser.java:59) at com.atlassian.servicedesk.bootstrap.lifecycle.PluginLifeCycle.loadSuccessModules(PluginLifeCycle.java:424) at com.atlassian.servicedesk.bootstrap.lifecycle.PluginLifeCycle.loadDynamicModules(PluginLifeCycle.java:378) at com.atlassian.servicedesk.bootstrap.lifecycle.PluginLifeCycle.runPluginStartupSideEffectsImpl(PluginLifeCycle.java:341) at com.atlassian.servicedesk.bootstrap.lifecycle.PluginLifeCycle.access$000(PluginLifeCycle.java:38) at com.atlassian.servicedesk.bootstrap.lifecycle.PluginLifeCycle$1.run(PluginLifeCycle.java:272) at com.atlassian.servicedesk.bootstrap.lifecycle.LifecycleLock.writeImpl(LifecycleLock.java:115) at com.atlassian.servicedesk.bootstrap.lifecycle.LifecycleLock.runOnStartup(LifecycleLock.java:87) at com.atlassian.servicedesk.bootstrap.lifecycle.PluginLifeCycle.runPluginStartupSideEffects(PluginLifeCycle.java:267) {quote} The code is blowing up here {code} Option<MailChannelDTO> getMailChannelByKey(final Option<TransactionContext> txnContext, ChannelKey key) { final SelectClauseProvider clauseProvider = SelectClauseProvider.builder() .where(table.MAIL_CHANNEL_KEY.eq(key.getKey())) .build(); {code} Its either the key variable is null or the table variable. I suspect its the table variable. Here is what I think is happening * the JEPP API is made available via OSGi and JSD starts calling on it * however the JEPP plugin has not started yet and has not run its init code * that init code makes sure the AO is present and then calls queryDslHelper.init(); * this then inits the "table" variable above Normally this works because JEPP starts before JSD say and this is all done before the caller can invoke API services. The recent JIRA 7.x lifecycle changes have made this problem more likely but its always been present. We have a number of internal tickets reporting this problem.

    Atlassian JIRA | 2 years ago | Brad Baker [Atlassian]
    java.lang.NullPointerException
  2. 0

    The JEPP code base can throw NPEs during JIRA Service Desk startup, but only some times. The exception looks like this {quote} Failure simplicity.atlassian.net: JIRA is 503 Server Error: Service Unavailable com.atlassian.servicedesk:sd-general-health-check: The internal modules have failed to start : NullPointerException: java.lang.NullPointerException at com.atlassian.jira.internal.mail.processor.feature.channel.MailChannelStore.getMailChannelByKey(MailChannelStore.java:63) at com.atlassian.jira.internal.mail.processor.feature.channel.MailChannelManager.getMailChannelDefinitionByKey(MailChannelManager.java:270) at com.atlassian.jira.internal.mail.processor.feature.channel.DefaultChannelManager.getMailChannelByKey(DefaultChannelManager.java:46) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) at com.sun.proxy.$Proxy2999.getMailChannelByKey(Unknown Source) at com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.JEPP.JEPPServiceImpl.getMailChannelByKey(JEPPServiceImpl.scala:26) at com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailChannelSettingTestValidator.validMailChannel(EmailChannelSettingTestValidator.scala:66) at com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailPlatformChannelManagerImpl.com$atlassian$servicedesk$internal$feature$emailchannel$emailplatform$EmailPlatformChannelManagerImpl$$isBrokenEmailChannelSetting(EmailPlatformChannelManagerImpl.scala:329) at com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailPlatformChannelManagerImpl$$anonfun$getValidOnDemandEmailChannels$1.apply(EmailPlatformChannelManagerImpl.scala:309) at com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailPlatformChannelManagerImpl$$anonfun$getValidOnDemandEmailChannels$1.apply(EmailPlatformChannelManagerImpl.scala:309) at scala.collection.TraversableLike$$anonfun$filter$1.apply(TraversableLike.scala:264) at scala.collection.immutable.List.foreach(List.scala:318) at scala.collection.TraversableLike$class.filter(TraversableLike.scala:263) at scala.collection.AbstractTraversable.filter(Traversable.scala:105) at com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailPlatformChannelManagerImpl.getValidOnDemandEmailChannels(EmailPlatformChannelManagerImpl.scala:309) at com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailPlatformChannelManagerImpl.checkODEmailChannelConnectivityAndUpdateExpiredPasswords(EmailPlatformChannelManagerImpl.scala:113) at com.atlassian.servicedesk.internal.feature.emailchannel.EmailChannelManagerDelegator.checkODEmailChannelConnectivityAndUpdateExpiredPasswords(EmailChannelManagerDelegator.scala:44) at com.atlassian.servicedesk.internal.email.mailstore.ODMailStoreChecker.verifyAndUpdateODMailSettingsPassword(ODMailStoreChecker.java:20) at com.atlassian.servicedesk.bootstrap.lifecycle.TenantAwareneODMailInitialiser.initialize(TenantAwareneODMailInitialiser.java:59) at com.atlassian.servicedesk.bootstrap.lifecycle.PluginLifeCycle.loadSuccessModules(PluginLifeCycle.java:424) at com.atlassian.servicedesk.bootstrap.lifecycle.PluginLifeCycle.loadDynamicModules(PluginLifeCycle.java:378) at com.atlassian.servicedesk.bootstrap.lifecycle.PluginLifeCycle.runPluginStartupSideEffectsImpl(PluginLifeCycle.java:341) at com.atlassian.servicedesk.bootstrap.lifecycle.PluginLifeCycle.access$000(PluginLifeCycle.java:38) at com.atlassian.servicedesk.bootstrap.lifecycle.PluginLifeCycle$1.run(PluginLifeCycle.java:272) at com.atlassian.servicedesk.bootstrap.lifecycle.LifecycleLock.writeImpl(LifecycleLock.java:115) at com.atlassian.servicedesk.bootstrap.lifecycle.LifecycleLock.runOnStartup(LifecycleLock.java:87) at com.atlassian.servicedesk.bootstrap.lifecycle.PluginLifeCycle.runPluginStartupSideEffects(PluginLifeCycle.java:267) {quote} The code is blowing up here {code} Option<MailChannelDTO> getMailChannelByKey(final Option<TransactionContext> txnContext, ChannelKey key) { final SelectClauseProvider clauseProvider = SelectClauseProvider.builder() .where(table.MAIL_CHANNEL_KEY.eq(key.getKey())) .build(); {code} Its either the key variable is null or the table variable. I suspect its the table variable. Here is what I think is happening * the JEPP API is made available via OSGi and JSD starts calling on it * however the JEPP plugin has not started yet and has not run its init code * that init code makes sure the AO is present and then calls queryDslHelper.init(); * this then inits the "table" variable above Normally this works because JEPP starts before JSD say and this is all done before the caller can invoke API services. The recent JIRA 7.x lifecycle changes have made this problem more likely but its always been present. We have a number of internal tickets reporting this problem.

    Atlassian JIRA | 2 years ago | Brad Baker [Atlassian]
    java.lang.NullPointerException

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at com.atlassian.jira.internal.mail.processor.feature.channel.MailChannelStore.getMailChannelByKey()
    2. com.atlassian.jira
      DefaultChannelManager.getMailChannelByKey
      1. com.atlassian.jira.internal.mail.processor.feature.channel.MailChannelStore.getMailChannelByKey(MailChannelStore.java:63)
      2. com.atlassian.jira.internal.mail.processor.feature.channel.MailChannelManager.getMailChannelDefinitionByKey(MailChannelManager.java:270)
      3. com.atlassian.jira.internal.mail.processor.feature.channel.DefaultChannelManager.getMailChannelByKey(DefaultChannelManager.java:46)
      3 frames
    3. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:497)
      4 frames
    4. Spring AOP
      AopUtils.invokeJoinpointUsingReflection
      1. org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      1 frame
    5. org.eclipse.gemini
      ServiceInvoker.invoke
      1. org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56)
      2. org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60)
      2 frames
    6. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      2. org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
      3. org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
      4. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      4 frames
    7. org.eclipse.gemini
      ServiceTCCLInterceptor.invoke
      1. org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70)
      2. org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53)
      2 frames
    8. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      1 frame
    9. org.eclipse.gemini
      LocalBundleContextAdvice.invoke
      1. org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
      1 frame
    10. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      2. org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
      3. org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
      4. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      5. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
      5 frames
    11. com.sun.proxy
      $Proxy2999.getMailChannelByKey
      1. com.sun.proxy.$Proxy2999.getMailChannelByKey(Unknown Source)
      1 frame
    12. com.atlassian.servicedesk
      EmailPlatformChannelManagerImpl$$anonfun$getValidOnDemandEmailChannels$1.apply
      1. com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.JEPP.JEPPServiceImpl.getMailChannelByKey(JEPPServiceImpl.scala:26)
      2. com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailChannelSettingTestValidator.validMailChannel(EmailChannelSettingTestValidator.scala:66)
      3. com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailPlatformChannelManagerImpl.com$atlassian$servicedesk$internal$feature$emailchannel$emailplatform$EmailPlatformChannelManagerImpl$$isBrokenEmailChannelSetting(EmailPlatformChannelManagerImpl.scala:329)
      4. com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailPlatformChannelManagerImpl$$anonfun$getValidOnDemandEmailChannels$1.apply(EmailPlatformChannelManagerImpl.scala:309)
      5. com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailPlatformChannelManagerImpl$$anonfun$getValidOnDemandEmailChannels$1.apply(EmailPlatformChannelManagerImpl.scala:309)
      5 frames
    13. Scala
      AbstractTraversable.filter
      1. scala.collection.TraversableLike$$anonfun$filter$1.apply(TraversableLike.scala:264)
      2. scala.collection.immutable.List.foreach(List.scala:318)
      3. scala.collection.TraversableLike$class.filter(TraversableLike.scala:263)
      4. scala.collection.AbstractTraversable.filter(Traversable.scala:105)
      4 frames
    14. com.atlassian.servicedesk
      PluginLifeCycle.runPluginStartupSideEffects
      1. com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailPlatformChannelManagerImpl.getValidOnDemandEmailChannels(EmailPlatformChannelManagerImpl.scala:309)
      2. com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailPlatformChannelManagerImpl.checkODEmailChannelConnectivityAndUpdateExpiredPasswords(EmailPlatformChannelManagerImpl.scala:113)
      3. com.atlassian.servicedesk.internal.feature.emailchannel.EmailChannelManagerDelegator.checkODEmailChannelConnectivityAndUpdateExpiredPasswords(EmailChannelManagerDelegator.scala:44)
      4. com.atlassian.servicedesk.internal.email.mailstore.ODMailStoreChecker.verifyAndUpdateODMailSettingsPassword(ODMailStoreChecker.java:20)
      5. com.atlassian.servicedesk.bootstrap.lifecycle.TenantAwareneODMailInitialiser.initialize(TenantAwareneODMailInitialiser.java:59)
      6. com.atlassian.servicedesk.bootstrap.lifecycle.PluginLifeCycle.loadSuccessModules(PluginLifeCycle.java:424)
      7. com.atlassian.servicedesk.bootstrap.lifecycle.PluginLifeCycle.loadDynamicModules(PluginLifeCycle.java:378)
      8. com.atlassian.servicedesk.bootstrap.lifecycle.PluginLifeCycle.runPluginStartupSideEffectsImpl(PluginLifeCycle.java:341)
      9. com.atlassian.servicedesk.bootstrap.lifecycle.PluginLifeCycle.access$000(PluginLifeCycle.java:38)
      10. com.atlassian.servicedesk.bootstrap.lifecycle.PluginLifeCycle$1.run(PluginLifeCycle.java:272)
      11. com.atlassian.servicedesk.bootstrap.lifecycle.LifecycleLock.writeImpl(LifecycleLock.java:115)
      12. com.atlassian.servicedesk.bootstrap.lifecycle.LifecycleLock.runOnStartup(LifecycleLock.java:87)
      13. com.atlassian.servicedesk.bootstrap.lifecycle.PluginLifeCycle.runPluginStartupSideEffects(PluginLifeCycle.java:267)
      13 frames