java.lang.NullPointerException: element cannot be mapped to a null key 2016-04-01 13:09:09.751755500 at java.util.Objects.requireNonNull(Objects.java:228) 2016-04-01 13:09:09.751756500 at java.util.stream.Collectors.lambda$groupingBy$176(Collectors.java:907) 2016-04-01 13:09:09.751756500 at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)

Atlassian JIRA | Xavier Sanchez [Atlassian] | 12 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    h3. Summary When a user has drafts connected to non-existing spaces, they will get a stracktrace when viewing their Drafts. This is sometimes the results of this bug: https://jira.atlassian.com/browse/CONF-41150 h3. Steps to Reproduce # With a user, create a draft # In some situations, the space it was created in may be deleted, but not the draft. # Click 'Profile >> Drafts' h3. Expected Results The user can still access their drafts. h3. Actual Results An error page is shown with this stacktrace {noformat} 2016-04-01 13:09:09.751027500 org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getResumableDraftsBySpace' in class com.atlassian.confluence.user.actions.ViewMyDraftsAction threw exception java.lang.NullPointerException: element cannot be mapped to a null key at /users/viewmydrafts.vm[line 118, column 30] 2016-04-01 13:09:09.751040500 at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:223) 2016-04-01 13:09:09.751041500 at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:262) 2016-04-01 13:09:09.751044500 at org.apache.velocity.runtime.parser.node.ASTReference.evaluate(ASTReference.java:470) 2016-04-01 13:09:09.751045500 at org.apache.velocity.runtime.parser.node.ASTExpression.evaluate(ASTExpression.java:62) 2016-04-01 13:09:09.751045500 at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:85) 2016-04-01 13:09:09.751051500 at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) 2016-04-01 13:09:09.751052500 at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87) 2016-04-01 13:09:09.751052500 at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) 2016-04-01 13:09:09.751053500 at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.getRenderedTagBody(ApplyDecoratorDirective.java:181) 2016-04-01 13:09:09.751057500 at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.render(ApplyDecoratorDirective.java:155) 2016-04-01 13:09:09.751058500 at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175) 2016-04-01 13:09:09.751750500 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 2016-04-01 13:09:09.751751500 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 2016-04-01 13:09:09.751751500 at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 2016-04-01 13:09:09.751754500 at java.lang.Thread.run(Thread.java:745) 2016-04-01 13:09:09.751755500 Caused by: java.lang.NullPointerException: element cannot be mapped to a null key 2016-04-01 13:09:09.751755500 at java.util.Objects.requireNonNull(Objects.java:228) 2016-04-01 13:09:09.751756500 at java.util.stream.Collectors.lambda$groupingBy$176(Collectors.java:907) 2016-04-01 13:09:09.751756500 at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) 2016-04-01 13:09:09.751760500 at java.util.ArrayList.forEach(ArrayList.java:1249) 2016-04-01 13:09:09.751760500 at java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:390) 2016-04-01 13:09:09.751760500 at java.util.stream.Sink$ChainedReference.end(Sink.java:258) 2016-04-01 13:09:09.751761500 at java.util.stream.Sink$ChainedReference.end(Sink.java:258) 2016-04-01 13:09:09.751761500 at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) 2016-04-01 13:09:09.751766500 at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) 2016-04-01 13:09:09.751767500 at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) 2016-04-01 13:09:09.751768500 at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) 2016-04-01 13:09:09.751768500 at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) 2016-04-01 13:09:09.751772500 at com.atlassian.confluence.user.actions.ViewMyDraftsAction.filterAndGroupDrafts(ViewMyDraftsAction.java:107) 2016-04-01 13:09:09.751773500 at com.atlassian.confluence.user.actions.ViewMyDraftsAction.getResumableDraftsBySpace(ViewMyDraftsAction.java:88) 2016-04-01 13:09:09.751773500 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2016-04-01 13:09:09.751774500 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 2016-04-01 13:09:09.751774500 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 2016-04-01 13:09:09.751778500 at java.lang.reflect.Method.invoke(Method.java:497) 2016-04-01 13:09:09.751778500 at org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(PropertyExecutor.java:142) 2016-04-01 13:09:09.751779500 at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:529) 2016-04-01 13:09:09.751799500 at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:198) 2016-04-01 13:09:09.751799500 ... 388 more {noformat} h3. Notes If you want to check only the affected users first, you can use this: {code:sql} select distinct um.username as "creator" from content c join user_mapping um on c.creator = um.user_key where c.contenttype = 'DRAFT' and c.draftspacekey not in (SELECT spacekey FROM SPACES) order by um.username; {code} h3.Workaround # Find all drafts connected to non-existing spaces in the database: {code:sql} select c.contentid, c.title, c.draftspacekey, um.username as "creator" from content c join user_mapping um on c.creator = um.user_key where c.contenttype = 'DRAFT' and c.draftspacekey not in (SELECT spacekey FROM SPACES) order by c.creator; {code} # For every response, log in as the 'creator' and access this (won't work if you log in as any user other than the creator): {noformat} https://instance.atlassian.net/wiki/json/deletedraft.action?draftId=<draft_id>&atl_token=#form_xsrfToken() {noformat} #* Replace the '<draft_id>' for the 'contentid'. # If it works, that line should no longer appear in the select above and this should be shown in the page: {noformat} {} {noformat}

    Atlassian JIRA | 12 months ago | Xavier Sanchez [Atlassian]
    java.lang.NullPointerException: element cannot be mapped to a null key 2016-04-01 13:09:09.751755500 at java.util.Objects.requireNonNull(Objects.java:228) 2016-04-01 13:09:09.751756500 at java.util.stream.Collectors.lambda$groupingBy$176(Collectors.java:907) 2016-04-01 13:09:09.751756500 at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
  2. 0

    h3. Summary When a user has drafts connected to non-existing spaces, they will get a stracktrace when viewing their Drafts. This is sometimes the results of this bug: https://jira.atlassian.com/browse/CONF-41150 h3. Steps to Reproduce # With a user, create a draft # In some situations, the space it was created in may be deleted, but not the draft. # Click 'Profile >> Drafts' h3. Expected Results The user can still access their drafts. h3. Actual Results An error page is shown with this stacktrace {noformat} 2016-04-01 13:09:09.751027500 org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getResumableDraftsBySpace' in class com.atlassian.confluence.user.actions.ViewMyDraftsAction threw exception java.lang.NullPointerException: element cannot be mapped to a null key at /users/viewmydrafts.vm[line 118, column 30] 2016-04-01 13:09:09.751040500 at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:223) 2016-04-01 13:09:09.751041500 at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:262) 2016-04-01 13:09:09.751044500 at org.apache.velocity.runtime.parser.node.ASTReference.evaluate(ASTReference.java:470) 2016-04-01 13:09:09.751045500 at org.apache.velocity.runtime.parser.node.ASTExpression.evaluate(ASTExpression.java:62) 2016-04-01 13:09:09.751045500 at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:85) 2016-04-01 13:09:09.751051500 at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) 2016-04-01 13:09:09.751052500 at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87) 2016-04-01 13:09:09.751052500 at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) 2016-04-01 13:09:09.751053500 at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.getRenderedTagBody(ApplyDecoratorDirective.java:181) 2016-04-01 13:09:09.751057500 at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.render(ApplyDecoratorDirective.java:155) 2016-04-01 13:09:09.751058500 at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175) 2016-04-01 13:09:09.751750500 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 2016-04-01 13:09:09.751751500 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 2016-04-01 13:09:09.751751500 at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 2016-04-01 13:09:09.751754500 at java.lang.Thread.run(Thread.java:745) 2016-04-01 13:09:09.751755500 Caused by: java.lang.NullPointerException: element cannot be mapped to a null key 2016-04-01 13:09:09.751755500 at java.util.Objects.requireNonNull(Objects.java:228) 2016-04-01 13:09:09.751756500 at java.util.stream.Collectors.lambda$groupingBy$176(Collectors.java:907) 2016-04-01 13:09:09.751756500 at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) 2016-04-01 13:09:09.751760500 at java.util.ArrayList.forEach(ArrayList.java:1249) 2016-04-01 13:09:09.751760500 at java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:390) 2016-04-01 13:09:09.751760500 at java.util.stream.Sink$ChainedReference.end(Sink.java:258) 2016-04-01 13:09:09.751761500 at java.util.stream.Sink$ChainedReference.end(Sink.java:258) 2016-04-01 13:09:09.751761500 at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) 2016-04-01 13:09:09.751766500 at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) 2016-04-01 13:09:09.751767500 at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) 2016-04-01 13:09:09.751768500 at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) 2016-04-01 13:09:09.751768500 at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) 2016-04-01 13:09:09.751772500 at com.atlassian.confluence.user.actions.ViewMyDraftsAction.filterAndGroupDrafts(ViewMyDraftsAction.java:107) 2016-04-01 13:09:09.751773500 at com.atlassian.confluence.user.actions.ViewMyDraftsAction.getResumableDraftsBySpace(ViewMyDraftsAction.java:88) 2016-04-01 13:09:09.751773500 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2016-04-01 13:09:09.751774500 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 2016-04-01 13:09:09.751774500 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 2016-04-01 13:09:09.751778500 at java.lang.reflect.Method.invoke(Method.java:497) 2016-04-01 13:09:09.751778500 at org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(PropertyExecutor.java:142) 2016-04-01 13:09:09.751779500 at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:529) 2016-04-01 13:09:09.751799500 at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:198) 2016-04-01 13:09:09.751799500 ... 388 more {noformat} h3. Notes If you want to check only the affected users first, you can use this: {code:sql} select distinct um.username as "creator" from content c join user_mapping um on c.creator = um.user_key where c.contenttype = 'DRAFT' and c.draftspacekey not in (SELECT spacekey FROM SPACES) order by um.username; {code} h3.Workaround # Find all drafts connected to non-existing spaces in the database: {code:sql} select c.contentid, c.title, c.draftspacekey, um.username as "creator" from content c join user_mapping um on c.creator = um.user_key where c.contenttype = 'DRAFT' and c.draftspacekey not in (SELECT spacekey FROM SPACES) order by c.creator; {code} # For every response, log in as the 'creator' and access this (won't work if you log in as any user other than the creator): {noformat} https://instance.atlassian.net/wiki/json/deletedraft.action?draftId=<draft_id>&atl_token=#form_xsrfToken() {noformat} #* Replace the '<draft_id>' for the 'contentid'. # If it works, that line should no longer appear in the select above and this should be shown in the page: {noformat} {} {noformat}

    Atlassian JIRA | 12 months ago | Xavier Sanchez [Atlassian]
    java.lang.NullPointerException: element cannot be mapped to a null key 2016-04-01 13:09:09.751755500 at java.util.Objects.requireNonNull(Objects.java:228) 2016-04-01 13:09:09.751756500 at java.util.stream.Collectors.lambda$groupingBy$176(Collectors.java:907) 2016-04-01 13:09:09.751756500 at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      element cannot be mapped to a null key 2016-04-01 13:09:09.751755500 at java.util.Objects.requireNonNull(Objects.java:228) 2016-04-01 13:09:09.751756500 at java.util.stream.Collectors.lambda$groupingBy$176(Collectors.java:907) 2016-04-01 13:09:09.751756500 at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)

      at java.util.ArrayList.forEach()
    2. Java RT
      Sink$ChainedReference.end
      1. java.util.ArrayList.forEach(ArrayList.java:1249)
      2. java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:390)
      3. java.util.stream.Sink$ChainedReference.end(Sink.java:258)
      3 frames