java.lang.NullPointerException

Atlassian JIRA | Stanislav Dvorscak [Atlassian] | 2 years ago
  1. 0

    Next code will throw NPE: {code} if (!watchesByIssueId.get(issueId).equals(correctWatches)) { result.add(new BrokenIssue(issueId, correctWatches)); } {code} in case, that there is a watcher linked to an issue, which was already deleted. Because it will be not able to get necessary information from this issue. h3.Diagnosis The following NullPointerException appears in {{[$JIRA_HOME|https://confluence.atlassian.com/display/JIRA/JIRA+Home+Directory]/log/atlassian-jira.log}} file: {code} 2014-08-18 02:08:42,924 localhost-startStop-1 INFO [atlassian.jira.upgrade.UpgradeManagerImpl] ___ Performing Upgrade ____________________ 2014-08-18 02:08:43,251 localhost-startStop-1 INFO [atlassian.jira.upgrade.UpgradeManagerImpl] Performing Upgrade Task: JRA-34394: Fixing incorrect watch count for cloned issues 2014-08-18 02:08:43,610 localhost-startStop-1 ERROR [atlassian.jira.upgrade.UpgradeManagerImpl] Exception thrown during upgrade: null java.lang.NullPointerException at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6331$2.consume(UpgradeTask_Build6331.java:105) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6331$2.consume(UpgradeTask_Build6331.java:96) at com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.consumeWith(SelectQueryImpl.java:240) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6331.findBrokenIssues(UpgradeTask_Build6331.java:93) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6331.doUpgrade(UpgradeTask_Build6331.java:63) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:693) at com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:542) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:471) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:413) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:348) at com.atlassian.jira.upgrade.UpgradeLauncher.checkIfUpgradeNeeded(UpgradeLauncher.java:106) at com.atlassian.jira.upgrade.UpgradeLauncher.start(UpgradeLauncher.java:54) at com.atlassian.jira.startup.ActiveServicesLauncher.start(ActiveServicesLauncher.java:42) at com.atlassian.jira.startup.DefaultJiraLauncher$3.run(DefaultJiraLauncher.java:133) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:324) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:214) at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:115) at com.atlassian.jira.startup.DefaultJiraLauncher.access$100(DefaultJiraLauncher.java:31) at com.atlassian.jira.startup.DefaultJiraLauncher$1.run(DefaultJiraLauncher.java:78) at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:34) at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:73) at com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:71) <+5> (StandardContext.java:4939) (StandardContext.java:5434) (LifecycleBase.java:150) (ContainerBase.java:1559) (ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) {code} h3.Workaround (!) This workaround involves executing SQL queries on the JIRA database and hence we recommend having/taking a backup of the database either using JIRA XML backup (before the upgrade) or using native database backup tools as a precaution. # Stop JIRA. # From the JIRA database, remove the 'WatchIssue' associations which reference non-existing issues using the following SQL query: *PostgreSQL* {code} delete from "userassociation" where "association_type" = 'WatchIssue' and "sink_node_entity" = 'Issue' and "sink_node_id" not in ( select issue."id" from "jiraissue" issue ); {code} *Microsoft SQL Server* (i) The following query assumes that you are using the schema {{jiraschema}}. If you use a different one, you would need to replace {{jiraschema}} with yours - you could find that out from {{[$JIRA_HOME|https://confluence.atlassian.com/display/JIRA/JIRA+Home+Directory]/dbconfig.xml}} file. {code} delete from jiraschema.userassociation where "association_type" = 'WatchIssue' and "sink_node_entity" = 'Issue' and "sink_node_id" not in ( select issue."id" from jiraschema.jiraissue issue ); {code} *MySQL* Thanks to [Leos Junek's comment below|https://jira.atlassian.com/browse/JRA-39544?focusedCommentId=633965&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-633965] {code} DELETE FROM userassociation WHERE association_type = 'WatchIssue' AND sink_node_entity = 'Issue' AND sink_node_id NOT IN (SELECT issue.id FROM jiraissue issue); {code} *Oracle* Thanks to [Robert Heckel's comment below|https://jira.atlassian.com/browse/JRA-39544?focusedCommentId=634236&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-634236] {code} delete FROM userassociation where association_type = 'WatchIssue' and sink_node_entity = 'Issue' and sink_node_id not in ( select issue.id from jiraissue issue ); commit; {code} # Start JIRA.

    Atlassian JIRA | 2 years ago | Stanislav Dvorscak [Atlassian]
    java.lang.NullPointerException
  2. 0

    Next code will throw NPE: {code} if (!watchesByIssueId.get(issueId).equals(correctWatches)) { result.add(new BrokenIssue(issueId, correctWatches)); } {code} in case, that there is a watcher linked to an issue, which was already deleted. Because it will be not able to get necessary information from this issue. h3.Diagnosis The following NullPointerException appears in {{[$JIRA_HOME|https://confluence.atlassian.com/display/JIRA/JIRA+Home+Directory]/log/atlassian-jira.log}} file: {code} 2014-08-18 02:08:42,924 localhost-startStop-1 INFO [atlassian.jira.upgrade.UpgradeManagerImpl] ___ Performing Upgrade ____________________ 2014-08-18 02:08:43,251 localhost-startStop-1 INFO [atlassian.jira.upgrade.UpgradeManagerImpl] Performing Upgrade Task: JRA-34394: Fixing incorrect watch count for cloned issues 2014-08-18 02:08:43,610 localhost-startStop-1 ERROR [atlassian.jira.upgrade.UpgradeManagerImpl] Exception thrown during upgrade: null java.lang.NullPointerException at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6331$2.consume(UpgradeTask_Build6331.java:105) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6331$2.consume(UpgradeTask_Build6331.java:96) at com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.consumeWith(SelectQueryImpl.java:240) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6331.findBrokenIssues(UpgradeTask_Build6331.java:93) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6331.doUpgrade(UpgradeTask_Build6331.java:63) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:693) at com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:542) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:471) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:413) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:348) at com.atlassian.jira.upgrade.UpgradeLauncher.checkIfUpgradeNeeded(UpgradeLauncher.java:106) at com.atlassian.jira.upgrade.UpgradeLauncher.start(UpgradeLauncher.java:54) at com.atlassian.jira.startup.ActiveServicesLauncher.start(ActiveServicesLauncher.java:42) at com.atlassian.jira.startup.DefaultJiraLauncher$3.run(DefaultJiraLauncher.java:133) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:324) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:214) at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:115) at com.atlassian.jira.startup.DefaultJiraLauncher.access$100(DefaultJiraLauncher.java:31) at com.atlassian.jira.startup.DefaultJiraLauncher$1.run(DefaultJiraLauncher.java:78) at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:34) at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:73) at com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:71) <+5> (StandardContext.java:4939) (StandardContext.java:5434) (LifecycleBase.java:150) (ContainerBase.java:1559) (ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) {code} h3.Workaround (!) This workaround involves executing SQL queries on the JIRA database and hence we recommend having/taking a backup of the database either using JIRA XML backup (before the upgrade) or using native database backup tools as a precaution. # Stop JIRA. # From the JIRA database, remove the 'WatchIssue' associations which reference non-existing issues using the following SQL query: *PostgreSQL* {code} delete from "userassociation" where "association_type" = 'WatchIssue' and "sink_node_entity" = 'Issue' and "sink_node_id" not in ( select issue."id" from "jiraissue" issue ); {code} *Microsoft SQL Server* (i) The following query assumes that you are using the schema {{jiraschema}}. If you use a different one, you would need to replace {{jiraschema}} with yours - you could find that out from {{[$JIRA_HOME|https://confluence.atlassian.com/display/JIRA/JIRA+Home+Directory]/dbconfig.xml}} file. {code} delete from jiraschema.userassociation where "association_type" = 'WatchIssue' and "sink_node_entity" = 'Issue' and "sink_node_id" not in ( select issue."id" from jiraschema.jiraissue issue ); {code} *MySQL* Thanks to [Leos Junek's comment below|https://jira.atlassian.com/browse/JRA-39544?focusedCommentId=633965&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-633965] {code} DELETE FROM userassociation WHERE association_type = 'WatchIssue' AND sink_node_entity = 'Issue' AND sink_node_id NOT IN (SELECT issue.id FROM jiraissue issue); {code} *Oracle* Thanks to [Robert Heckel's comment below|https://jira.atlassian.com/browse/JRA-39544?focusedCommentId=634236&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-634236] {code} delete FROM userassociation where association_type = 'WatchIssue' and sink_node_entity = 'Issue' and sink_node_id not in ( select issue.id from jiraissue issue ); commit; {code} # Start JIRA.

    Atlassian JIRA | 2 years ago | Stanislav Dvorscak [Atlassian]
    java.lang.NullPointerException
  3. 0

    Android: Saving Map State in Google map

    Stack Overflow | 11 months ago | Junie Negentien
    java.lang.RuntimeException: Unable to resume activity {com.ourThesis.junieNegentien2015/com.ourThesis.junieNegentien2015.MainActivity}: java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6331$2.consume()
    2. com.atlassian.jira
      DefaultJiraLauncher.start
      1. com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6331$2.consume(UpgradeTask_Build6331.java:105)
      2. com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6331$2.consume(UpgradeTask_Build6331.java:96)
      3. com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.consumeWith(SelectQueryImpl.java:240)
      4. com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6331.findBrokenIssues(UpgradeTask_Build6331.java:93)
      5. com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6331.doUpgrade(UpgradeTask_Build6331.java:63)
      6. com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:693)
      7. com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:542)
      8. com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:471)
      9. com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:413)
      10. com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:348)
      11. com.atlassian.jira.upgrade.UpgradeLauncher.checkIfUpgradeNeeded(UpgradeLauncher.java:106)
      12. com.atlassian.jira.upgrade.UpgradeLauncher.start(UpgradeLauncher.java:54)
      13. com.atlassian.jira.startup.ActiveServicesLauncher.start(ActiveServicesLauncher.java:42)
      14. com.atlassian.jira.startup.DefaultJiraLauncher$3.run(DefaultJiraLauncher.java:133)
      15. com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:324)
      16. com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:214)
      17. com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:115)
      18. com.atlassian.jira.startup.DefaultJiraLauncher.access$100(DefaultJiraLauncher.java:31)
      19. com.atlassian.jira.startup.DefaultJiraLauncher$1.run(DefaultJiraLauncher.java:78)
      20. com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:34)
      21. com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:73)
      21 frames