Uploaded image for project: 'Jira Service Management Data Center'
  1. Jira Service Management Data Center
  2. JSDSERVER-4227

NullPointerException causes partial functionality including errors and pages not loading

XMLWordPrintable

      Description of problem:

      A NullPointerException is thrown due to a missing ICON_ID in "AO_54307E_VIEWPORTFORM".

      • JIRA Service Desk will not fully start if one of the affected request types is configured to receive email. This results in partial functionality working.
      • When JIRA Service Desk does start, users are unable to access some request types or service desk projects. In some cases the entire customer portal may not load.

      Request types that are missing the ICON_ID are affected and portals containing those request types may experience problems. In addition, when configuring request types the "Edit Fields" link on affected request types no longer works.

      • The "Edit Fields" link does work for unaffected request types in the same service desk project.
      • The service desk project containing affected request type(s) will not load in customer portal. Users may see an error, a spinning icon, or a blank page.

      Steps to reproduce:

      It is unknown how this the data got into this state, the problem occurred on a customer's instance after starting JIRA Service Desk.

      • It is possible to trigger this problem and see the symptoms by setting the ICON_ID of a request type to be NULL.
      • In one case Service Desk logs of upgrade from version 2.5.9 > 3.1.9 > 3.2.1 do not show where "SyncUpgradeTaskMigrateRequestTypeIconIDs" ever ran.
        NB: This task may have run previously in 3.1.x as AsyncUpgradeTaskMigrateRequestTypeIconIDs

      Expected Results

      JSD starts without any problems and after startup there are no issues accessing request types or portal.

      Actual Results

      Startup Problem

      The below exception is thrown during startup when an affected request type is configured for email:

      2016-08-30 03:43:19,490 JIRA-Bootstrap ERROR      [c.a.servicedesk.bootstrap.lifecycle] 
      java.lang.NullPointerException
      	at scala.Predef$.Long2long(Predef.scala:358)
      	at com.atlassian.servicedesk.internal.feature.customer.request.requesttype.RequestType$.apply(RequestType.scala:73)
      	at com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailChannelSetting$.toModel(EmailChannelSetting.scala:28)
      	at com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailChannelSettingManager.com$atlassian$servicedesk$internal$feature$emailchannel$emailplatform$EmailChannelSettingManager$$toSettingModel(EmailChannelSettingManager.scala:124)
      	at com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailChannelSettingManager$$anonfun$getEmailChannelSettings$1.apply(EmailChannelSettingManager.scala:105)
      	at com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailChannelSettingManager$$anonfun$getEmailChannelSettings$1.apply(EmailChannelSettingManager.scala:105)
      	at scala.collection.immutable.List.map(List.scala:273)
      	at com.atlassian.servicedesk.internal.feature.emailchannel.emailplatform.EmailChannelSettingManager.getEmailChannelSettings(EmailChannelSettingManager.scala:105)
      	at com.atlassian.servicedesk.bootstrap.lifecycle.SDMailChannelInitializer.updateSDMailChannels(SDMailChannelInitializer.java:48)
      	at com.atlassian.servicedesk.bootstrap.lifecycle.SDMailChannelInitializer.enableSDMailChannels(SDMailChannelInitializer.java:41)
      	at com.atlassian.servicedesk.bootstrap.lifecycle.PluginLifeCycle.runPluginStartupSideEffectsImpl(PluginLifeCycle.java:201)
      	at com.atlassian.servicedesk.bootstrap.lifecycle.LifecycleLock.writeImpl(LifecycleLock.java:97)
      	at com.atlassian.servicedesk.bootstrap.lifecycle.LifecycleLock.runOnStartup(LifecycleLock.java:75)
      	at com.atlassian.servicedesk.bootstrap.lifecycle.PluginLifeCycle.onPluginStarted(PluginLifeCycle.java:126)
      	at com.atlassian.servicedesk.bootstrap.lifecycle.Launcher.onStartCompleted(Launcher.java:75)
      	at com.atlassian.servicedesk.bootstrap.lifecycle.Launcher.access$000(Launcher.java:23)
      	at com.atlassian.servicedesk.bootstrap.lifecycle.Launcher$1$1.run(Launcher.java:42)
      	at com.atlassian.pocketknife.api.util.runners.SealedRunner.checkSeals(SealedRunner.java:111)
      	at com.atlassian.pocketknife.api.util.runners.SealedRunner.breakSeal(SealedRunner.java:68)
      	at com.atlassian.servicedesk.bootstrap.lifecycle.Launcher.onStart(Launcher.java:68)
      	at com.atlassian.sal.core.lifecycle.DefaultLifecycleManager$4.consume(DefaultLifecycleManager.java:310)
      	at com.atlassian.sal.core.lifecycle.DefaultLifecycleManager$4.consume(DefaultLifecycleManager.java:306)
      	at com.atlassian.sal.core.lifecycle.DefaultLifecycleManager.notifyLifecyleAware(DefaultLifecycleManager.java:344)
      	at com.atlassian.sal.core.lifecycle.DefaultLifecycleManager.notifyOnStartIfStartedAndEnabled(DefaultLifecycleManager.java:304)
      	at com.atlassian.sal.core.lifecycle.DefaultLifecycleManager.access$300(DefaultLifecycleManager.java:50)
      	at com.atlassian.sal.core.lifecycle.DefaultLifecycleManager$3.evaluate(DefaultLifecycleManager.java:261)
      	at com.atlassian.sal.core.lifecycle.DefaultLifecycleManager$3.evaluate(DefaultLifecycleManager.java:257)
      	at com.atlassian.sal.core.lifecycle.DefaultLifecycleManager.notifyLifecycleAwares(DefaultLifecycleManager.java:286)
      	at com.atlassian.sal.core.lifecycle.DefaultLifecycleManager.notifyStartableLifecycleAwares(DefaultLifecycleManager.java:255)
      	at com.atlassian.sal.core.lifecycle.DefaultLifecycleManager.startIfApplicationSetup(DefaultLifecycleManager.java:241)
      	at com.atlassian.sal.core.lifecycle.DefaultLifecycleManager.start(DefaultLifecycleManager.java:230)
      	at com.atlassian.sal.jira.lifecycle.JiraLifecycleManager.onJiraStart(JiraLifecycleManager.java:64)
      	... 3 filtered
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:36)
      	at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:48)
      	at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:299)
      	at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:107)
      	at com.atlassian.event.internal.EventPublisherImpl.invokeListeners(EventPublisherImpl.java:160)
      	at com.atlassian.event.internal.EventPublisherImpl.publish(EventPublisherImpl.java:79)
      	at com.atlassian.plugin.event.impl.DefaultPluginEventManager.broadcast(DefaultPluginEventManager.java:73)
      	at com.atlassian.jira.upgrade.PluginUpgradeLauncher.start(PluginUpgradeLauncher.java:30)
      	at com.atlassian.jira.startup.ActiveServicesLauncher.start(ActiveServicesLauncher.java:51)
      	at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postTenantArrived$4(DefaultJiraLauncher.java:178)
      	at com.atlassian.jira.startup.DefaultInstantUpgradeManager$StartupTask.run(DefaultInstantUpgradeManager.java:139)
      	at com.atlassian.jira.startup.DefaultInstantUpgradeManager.runTask(DefaultInstantUpgradeManager.java:55)
      	at com.atlassian.jira.startup.DefaultInstantUpgradeManager.doNowOrWhenInstanceBecomesActive(DefaultInstantUpgradeManager.java:42)
      	at com.atlassian.jira.startup.DefaultJiraLauncher.postTenantArrived(DefaultJiraLauncher.java:171)
      	at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDBActivated$3(DefaultJiraLauncher.java:159)
      	at com.atlassian.jira.tenancy.DefaultTenantManager.doNowOrWhenTenantArrives(DefaultTenantManager.java:55)
      	at com.atlassian.jira.startup.DefaultJiraLauncher.postDBActivated(DefaultJiraLauncher.java:156)
      	at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDbLaunch$2(DefaultJiraLauncher.java:145)
      	at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:298)
      	at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:194)
      	at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:135)
      	at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$start$0(DefaultJiraLauncher.java:101)
      	at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:31)
      	at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:99)
      	at com.atlassian.jira.startup.LauncherContextListener.initSlowStuff(LauncherContextListener.java:149)
      	at java.lang.Thread.run(Thread.java:745)
      
      
      Portal / Request Type Problems

      Example of stacktrace thrown when trying to access affected project through customer portal:

      2016-09-26 15:36:09,392 http-nio-8080-exec-1 ERROR USERNAME 936x696x1 unw300 000.000.000.000,0:0:0:0:0:0:0:1 /servicedesk/customer/portal/56 [c.a.p.r.c.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: null
      java.lang.NullPointerException
      	at com.atlassian.servicedesk.internal.feature.customer.request.requesttype.RequestTypeQStoreImpl$RequestTypeMapper.apply(RequestTypeQStoreImpl.java:439)
      	at com.atlassian.servicedesk.internal.feature.customer.request.requesttype.RequestTypeQStoreImpl$RequestTypeMapper.apply(RequestTypeQStoreImpl.java:409)
      	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
      	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
      	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
      	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
      	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
      	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
      	at com.atlassian.servicedesk.internal.feature.customer.request.requesttype.RequestTypeQStoreImpl.getRequestTypesWithGroups(RequestTypeQStoreImpl.java:91)
      	at com.atlassian.servicedesk.internal.feature.customer.request.requesttype.RequestTypeInternalManagerScala.getAllRequestTypes(RequestTypeInternalManagerScala.scala:128)
      	at com.atlassian.servicedesk.internal.feature.customer.request.requesttype.RequestTypeInternalManagerScala.getAllValidRequestTypes(RequestTypeInternalManagerScala.scala:120)
      	at com.atlassian.servicedesk.internal.feature.customer.request.requesttype.RequestTypeInternalServiceScala.getAllValidRequestTypes(RequestTypeInternalServiceScala.scala:74)
      	at com.atlassian.servicedesk.internal.feature.customer.request.requesttype.RequestTypeInternalServiceImpl.getAllValidRequestTypes(RequestTypeInternalServiceImpl.java:115)
      	at com.atlassian.servicedesk.internal.feature.customer.request.requesttype.RequestTypeInternalServiceImpl.getAllValidNonHiddenRequestTypes(RequestTypeInternalServiceImpl.java:120)
      	at com.atlassian.servicedesk.internal.feature.customer.portal.providers.PortalResponseProvider.lambda$getResponse$0(PortalResponseProvider.java:64)
      	at com.atlassian.fugue.Either$RightProjection.flatMap(Either.java:839)
      	at com.atlassian.fugue.Either.flatMap(Either.java:294)
      	at com.atlassian.pocketknife.EitherStep1.then(EitherStep1.java:21)
      	at com.atlassian.servicedesk.internal.feature.customer.portal.providers.PortalResponseProvider.getResponse(PortalResponseProvider.java:64)
      	at com.atlassian.servicedesk.internal.feature.customer.portal.providers.CustomerResponseProviderDelegatorImpl.getResponse(CustomerResponseProviderDelegatorImpl.java:142)
      	at com.atlassian.servicedesk.internal.rest.CustomerResponseFactory.com$atlassian$servicedesk$internal$rest$CustomerResponseFactory$$getResponse(CustomerResponseFactory.scala:133)
      	at com.atlassian.servicedesk.internal.rest.CustomerResponseFactory$$anonfun$2.apply(CustomerResponseFactory.scala:63)
      	at com.atlassian.servicedesk.internal.rest.CustomerResponseFactory$$anonfun$2.apply(CustomerResponseFactory.scala:63)
      	at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
      	at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
      	at scala.collection.Iterator$class.foreach(Iterator.scala:750)
      	at scala.collection.AbstractIterator.foreach(Iterator.scala:1202)
      	at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
      	at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
      	at scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
      	at scala.collection.AbstractTraversable.map(Traversable.scala:104)
      	at com.atlassian.servicedesk.internal.rest.CustomerResponseFactory.createResponse(CustomerResponseFactory.scala:63)
      	at com.atlassian.servicedesk.internal.web.CustomerPageRenderer.createPageParams(CustomerPageRenderer.scala:97)
      	at com.atlassian.servicedesk.internal.web.CustomerPageRenderer.createPage(CustomerPageRenderer.scala:66)
      	at com.atlassian.servicedesk.internal.web.CustomerPageRenderer.createPage(CustomerPageRenderer.scala:71)
      	at com.atlassian.servicedesk.internal.rest.CustomerWeb.landingPage(CustomerWeb.scala:228)
      	... 3 filtered
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	... 19 filtered
      	at com.atlassian.plugins.rest.module.RestDelegatingServletFilter$JerseyOsgiServletContainer.doFilter(RestDelegatingServletFilter.java:154)
      	... 1 filtered
      	at com.atlassian.plugins.rest.module.RestDelegatingServletFilter.doFilter(RestDelegatingServletFilter.java:68)
      	... 33 filtered
      	at com.atlassian.servicedesk.internal.web.OperationalStatusAwareHttpFilter.doFilter(OperationalStatusAwareHttpFilter.java:31)
      	... 4 filtered
      	at com.atlassian.servicedesk.internal.web.UrlOperationalStatusCheckFilter.doFilterWhenLicensed(UrlOperationalStatusCheckFilter.java:38)
      	at com.atlassian.servicedesk.internal.web.OperationalStatusAwareHttpFilter.doFilter(OperationalStatusAwareHttpFilter.java:31)
      	... 4 filtered
      	at com.atlassian.servicedesk.internal.web.PopulateEyeballForRestFilter.doFilterWhenLicensed(PopulateEyeballForRestFilter.java:33)
      	at com.atlassian.servicedesk.internal.web.OperationalStatusAwareHttpFilter.doFilter(OperationalStatusAwareHttpFilter.java:31)
      	... 4 filtered
      	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
      	... 40 filtered
      	at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:76)
      	... 1 filtered
      	at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:74)
      	... 24 filtered
      	at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)
      	... 5 filtered
      	at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.doFilter(CustomerContextSettingFilter.java:116)
      	... 11 filtered
      	at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
      	... 41 filtered
      	at com.atlassian.servicedesk.project.internal.web.filters.NormaliseUrlFilter.doFilter(NormaliseUrlFilter.java:25)
      	... 15 filtered
      	at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:76)
      	... 1 filtered
      	at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:74)
      	... 33 filtered
      	at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)
      	... 5 filtered
      	at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.lambda$invokeFilterChain$0(CustomerContextSettingFilter.java:181)
      	at com.atlassian.servicedesk.internal.utils.context.ReentrantThreadLocalBasedCodeContext.rteInvoke(ReentrantThreadLocalBasedCodeContext.java:142)
      	at com.atlassian.servicedesk.internal.utils.context.ReentrantThreadLocalBasedCodeContext.runInContext(ReentrantThreadLocalBasedCodeContext.java:57)
      	at com.atlassian.servicedesk.internal.utils.context.CustomerContextServiceImpl.runInCustomerContext(CustomerContextServiceImpl.java:38)
      	at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.inCustomerContext(CustomerContextSettingFilter.java:169)
      	at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.doFilterImpl(CustomerContextSettingFilter.java:128)
      	at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.doFilter(CustomerContextSettingFilter.java:121)
      	... 9 filtered
      	at com.atlassian.jwt.internal.servlet.JwtAuthFilter.doFilter(JwtAuthFilter.java:32)
      	... 3 filtered
      	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
      	... 4 filtered
      	at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36)
      	... 29 filtered
      	at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
      	... 27 filtered
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      	at java.lang.Thread.run(Thread.java:745)
      
      
      Another example from after JIRA starts:
      2016-09-26 04:56:59,542 http-nio-8080-exec-12 uri:/secure/AjaxIssueAction!default.jspa username:USERNAME ERROR USERNAME 296x46828x1 43zmt9 000.000.000.000,0:0:0:0:0:0:0:1 /secure/AjaxIssueAction!default.jspa [c.a.j.web.component.ModuleWebComponentImpl] An exception occured while rendering the web panel: com.atlassian.servicedesk:customer-portal-web-panel (null)
      java.lang.NullPointerException
      	at scala.Predef$.Long2long(Predef.scala:358)
      	at com.atlassian.servicedesk.internal.feature.customer.request.requesttype.RequestType$.apply(RequestType.scala:73)
      	at com.atlassian.servicedesk.internal.feature.customer.request.requesttype.RequestTypeStore$$anonfun$getRequestTypeByKey$2.apply(RequestTypeStore.scala:49)
      	at com.atlassian.servicedesk.internal.feature.customer.request.requesttype.RequestTypeStore$$anonfun$getRequestTypeByKey$2.apply(RequestTypeStore.scala:47)
      	at scala.Option.map(Option.scala:146)
      	at com.atlassian.servicedesk.internal.feature.customer.request.requesttype.RequestTypeStore.getRequestTypeByKey(RequestTypeStore.scala:47)
      	at com.atlassian.servicedesk.internal.feature.customer.request.requesttype.RequestTypeInternalManagerScala.getRequestTypeByKey(RequestTypeInternalManagerScala.scala:115)
      ...
      
      

      Diagnosis:

      A list of affected portals can be obtained by running:

      SELECT v."NAME", f."VIEWPORT_ID" FROM "AO_54307E_VIEWPORT" AS v 
      	JOIN "AO_54307E_VIEWPORTFORM" AS f 
      	ON v."ID"=f."VIEWPORT_ID" 
      	WHERE f."ICON_ID" IS NULL 
      	GROUP BY f."VIEWPORT_ID", v."NAME"
      	ORDER BY v."NAME";
      
      

      A list of affected request types can be obtained by running:

      SELECT v."NAME", f."NAME", f."VIEWPORT_ID", f."ICON", f."ICON_ID" FROM "AO_54307E_VIEWPORT" AS v 
      	INNER JOIN "AO_54307E_VIEWPORTFORM" AS f 
      	ON v."ID"=f."VIEWPORT_ID" 
      	WHERE f."ICON_ID" IS NULL 
      	GROUP BY f."VIEWPORT_ID", f."NAME", v."NAME",f."ICON",f."ICON_ID"
      	ORDER BY v."NAME";
      
      

      Workaround:

      If JIRA Service Desk is accessible

      Use the SQL query to retrieve a list of affected request types. Manually change the icon for each of these request types in the Service Desk user interface.

      If JIRA Service Desk failed to load

      This was fixed by identifying there was a missing icon for the JIRA Service Desk customer portal. the broken icon was identified with the below SQL:

      select "ICON_ID", a.* from "AO_54307E_VIEWPORTFORM" vpf left outer join avatar a on a.id = vpf."ICON_ID" where a.id is null;
      
      

      And then fixed by updating the database to point the icon to an existing icon (ie a record in the avatar table that exists), and then JSD was restarted and the Customer Portal updated.

      Background:

      In Service Desk Server version 3.1.9, icons attached to request types are recorded in the ICON column in "AO_54307E_VIEWPORTFORM".

      As of 3.2.1 the icons are stored in the ICON_ID column, also in the "AO_54307E_VIEWPORTFORM" table.

      An upgrade task performs this change

          *********************************************************************************
          JIRA ServiceDesk v3.2.0-051 #DevVersion built 2016-08-26T20:02:10.216-05:00 - Starting sync upgrade task: SyncUpgradeTaskMigrateRequestTypeIconIDs
          *********************************************************************************
      
      

              mmcmahon Matthew McMahon (Inactive)
              dcurrie@atlassian.com Dave C
              Votes:
              3 Vote for this issue
              Watchers:
              11 Start watching this issue

                Created:
                Updated:
                Resolved: