using JJUPIN sendHtmlEmail error "key should not be null!" occurs

Hi Kepler,

We need your help, we are encountering the error "key should not be null!" when using sendHtmlEmail routine.

This works fine on our develpoment instance but when we promote it in Prod error below occurs.

We even tried updating the template.tpl to contain only plain text but still error occurs.

normal email notification works, error only occurs when using the sendHtmlEmail routine.


2014-08-28 12:02:30,807 http-bio-8080-exec-11 ERROR ema5177 722x409x1 1h0bb49 10.131.129.2 /secure/CommentAssignIssue.jspa [commons.ivm.routines.SendEmailRoutine] Could not send mail [ex].
com.atlassian.jira.util.dbc.Assertions$NullArgumentException: key should not be null!
	at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:29)
	at com.atlassian.jira.user.DelegatingApplicationUser.<init>(DelegatingApplicationUser.java:20)
	at com.atlassian.jira.user.util.DefaultUserManager.getAllApplicationUsers(DefaultUserManager.java:99)
	at com.keplerrominfo.jira.commons.jira.user.UserHelper.getUserByEmail(UserHelper.java:487)
	at com.keplerrominfo.jira.commons.ivm.routines.SendEmailRoutine.getAdditionalVariables(SendEmailRoutine.java:655)
	at com.keplerrominfo.jira.commons.ivm.routines.SendEmailRoutine.getTemplateTextAndSendEmail(SendEmailRoutine.java:449)
	at com.keplerrominfo.jira.commons.ivm.routines.SendEmailRoutine.executeRoutineEx(SendEmailRoutine.java:302)
	at com.keplerrominfo.jira.commons.ivm.routines.SendEmailRoutine.executeRoutine(SendEmailRoutine.java:121)
	at com.keplerrominfo.jira.commons.sil.AbstractRoutine.execute(AbstractRoutine.java:55)
	at com.keplerrominfo.jira.commons.sil.ASTCallNode.interpret(ASTCallNode.java:68)
	at com.keplerrominfo.jira.commons.sil.SILNode.interpret(SILNode.java:133)
	at com.keplerrominfo.jira.commons.sil.ASTBlock.interpret(ASTBlock.java:27)
	at com.keplerrominfo.jira.commons.sil.ASTForExpression.interpret(ASTForExpression.java:103)
	at com.keplerrominfo.jira.commons.sil.SILNode.interpret(SILNode.java:133)
	at com.keplerrominfo.jira.commons.sil.ASTParseNode.interpret(ASTParseNode.java:37)
	at com.keplerrominfo.jira.commons.sil.executors.DirectInterpreterExecutor.interpret(DirectInterpreterExecutor.java:50)
	at com.keplerrominfo.jira.commons.sil.SILInterpreter.interpret(SILInterpreter.java:104)
	at com.keplerrominfo.jira.commons.ivm.IssueSILInterpreter.interpret(IssueSILInterpreter.java:166)
	at com.keplerrominfo.jira.commons.sil.routines.CallRoutine.executeRoutine(CallRoutine.java:62)
	at com.keplerrominfo.jira.commons.sil.AbstractRoutine.execute(AbstractRoutine.java:55)
	at com.keplerrominfo.jira.commons.sil.ASTCallNode.interpret(ASTCallNode.java:68)
	at com.keplerrominfo.jira.commons.sil.SILNode.interpret(SILNode.java:133)
	at com.keplerrominfo.jira.commons.sil.ASTParseNode.interpret(ASTParseNode.java:37)
	at com.keplerrominfo.jira.commons.sil.executors.DirectInterpreterExecutor.interpret(DirectInterpreterExecutor.java:50)
	at com.keplerrominfo.jira.commons.sil.SILInterpreter.interpret(SILInterpreter.java:104)
	at com.keplerrominfo.jira.commons.ivm.IssueSILInterpreter.interpret(IssueSILInterpreter.java:166)
	at com.keplerrominfo.jira.commons.silrunner.UnifiedSilRunner.interpret(UnifiedSilRunner.java:130)
	at com.keplerrominfo.jira.commons.silrunner.UnifiedSilRunner.interpret(UnifiedSilRunner.java:90)
	at com.keplerrominfo.jira.commons.silrunner.UnifiedSilRunner.interpret(UnifiedSilRunner.java:64)
	at com.keplerrominfo.jira.plugins.jjupin.sil.SilPostFunction.execute(SilPostFunction.java:43)
	at com.opensymphony.workflow.AbstractWorkflow.executeFunction(AbstractWorkflow.java:1050)
	at com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(AbstractWorkflow.java:1446)
	at com.opensymphony.workflow.AbstractWorkflow.doAction(AbstractWorkflow.java:564)
	at com.atlassian.jira.workflow.OSWorkflowManager.doWorkflowActionInsideTxn(OSWorkflowManager.java:957)
	at com.atlassian.jira.workflow.OSWorkflowManager.doWorkflowAction(OSWorkflowManager.java:912)
	at com.atlassian.jira.bc.issue.DefaultIssueService.transition(DefaultIssueService.java:450)
	at com.atlassian.jira.web.action.issue.CommentAssignIssue.doExecute(CommentAssignIssue.java:192)  <+1> (ActionSupport.java:165)
	at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:87)  <+7> (DefaultInterceptorChain.java:39) (NestedInterceptorChain.java:31) (ChainedInterceptor.java:16) (DefaultInterceptorChain.java:35) (GenericDispatcher.java:225) (GenericDispatcher.java:154) (JiraWebworkActionDispatcher.java:152)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)  <+2> (ApplicationFilterChain.java:305) (ApplicationFilterChain.java:210)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)  <+14> (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (ChainedFilterStepRunner.java:87) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (XContentTypeOptionsNoSniffFilter.java:22) (AbstractHttpFilter.java:31) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (HeaderSanitisingFilter.java:44) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (IteratingFilterChain.java:46) (DelegatingPluginFilter.java:66)
	at com.atlassian.jira.tzdetect.IncludeResourcesFilter.doFilter(IncludeResourcesFilter.java:39)  <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66)
	at com.atlassian.jira.baseurl.IncludeResourcesFilter.doFilter(IncludeResourcesFilter.java:38)  <+8> (AbstractHttpFilter.java:31) (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66) (ContextFilter.java:25) (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66)
	at com.atlassian.mywork.client.filter.ServingRequestsFilter.doFilter(ServingRequestsFilter.java:37)  <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66)
	at com.atlassian.prettyurls.filter.PrettyUrlsDispatcherFilter.doFilter(PrettyUrlsDispatcherFilter.java:60)  <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66)
	at com.atlassian.prettyurls.filter.PrettyUrlsSiteMeshFilter.doFilter(PrettyUrlsSiteMeshFilter.java:92)  <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66)
	at com.atlassian.prettyurls.filter.PrettyUrlsMatcherFilter.doFilter(PrettyUrlsMatcherFilter.java:56)  <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66)
	at com.atlassian.labs.botkiller.BotKillerFilter.doFilter(BotKillerFilter.java:36)  <+23> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (ServletFilterModuleContainerFilter.java:77) (ServletFilterModuleContainerFilter.java:63) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (AccessLogFilter.java:103) (AccessLogFilter.java:87) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (XsrfTokenAdditionRequestFilter.java:54) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (SiteMeshFilter.java:181) (SiteMeshFilter.java:85) (SitemeshPageFilter.java:124) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (ChainedFilterStepRunner.java:87) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (IteratingFilterChain.java:46) (DelegatingPluginFilter.java:66)
	at com.atlassian.prettyurls.filter.PrettyUrlsCombinedMatchDispatcherFilter.doFilter(PrettyUrlsCombinedMatchDispatcherFilter.java:61)  <+22> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (ServletFilterModuleContainerFilter.java:77) (ServletFilterModuleContainerFilter.java:63) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (SecurityFilter.java:234) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (TrustedApplicationsFilter.java:100) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (BaseLoginFilter.java:169) (JiraLoginFilter.java:70) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (IteratingFilterChain.java:46) (DelegatingPluginFilter.java:66) (OAuthFilter.java:61) (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66)
	at com.atlassian.prettyurls.filter.PrettyUrlsCombinedMatchDispatcherFilter.doFilter(PrettyUrlsCombinedMatchDispatcherFilter.java:61)  <+13> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (ServletFilterModuleContainerFilter.java:77) (ServletFilterModuleContainerFilter.java:63) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (ProfilingFilter.java:99) (JIRAProfilingFilter.java:19) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (AbstractJohnsonFilter.java:71) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210)
	at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
	at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
	at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)  <+10> (UrlRewriteFilter.java:394) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (GzipFilter.java:74) (GzipFilter.java:51) (JiraGzipFilter.java:55) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (IteratingFilterChain.java:46) (DelegatingPluginFilter.java:66)
	at com.atlassian.prettyurls.filter.PrettyUrlsCombinedMatchDispatcherFilter.doFilter(PrettyUrlsCombinedMatchDispatcherFilter.java:61)  <+40> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (ServletFilterModuleContainerFilter.java:77) (ServletFilterModuleContainerFilter.java:63) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (ChainedFilterStepRunner.java:87) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (AbstractCachingFilter.java:33) (AbstractHttpFilter.java:31) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (AbstractEncodingFilter.java:41) (AbstractHttpFilter.java:31) (PathMatchingEncodingFilter.java:49) (AbstractHttpFilter.java:31) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (JiraStartupChecklistFilter.java:78) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (MultipartBoundaryCheckFilter.java:41) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (ChainedFilterStepRunner.java:87) (JiraFirstFilter.java:57) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (StandardWrapperValve.java:222) (StandardContextValve.java:123) (AuthenticatorBase.java:502) (StandardHostValve.java:171) (ErrorReportValve.java:100) (StandardEngineValve.java:118) (AccessLogValve.java:953) (CoyoteAdapter.java:408) (AbstractHttp11Processor.java:1041) (AbstractProtocol.java:603) (JIoEndpoint.java:312)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Regards,

eric

3 answers

Most probably users imported from LDAP have empty email adresses or full name attributes. As you can see, the exception occurs in com.atlassian.jira.user.DelegatingApplicationUser.

While these attributes are mandatory from JIRA UI, when importing the users from other (external) directories they are not. You need to correct those entries in your LDAP.

I never tried it, but you can filter such users by adding more filters on your LDAP config:

e.g. add one more and condition to the filter and state that: (mail=*)

Hi Radu,

We dont use LDAP this time, we use the built in Jira authentication. Also all our users where encoded thru Jira UI.

I manually check for emply email and full name in user management and i also run the query below and did not find any empty fullname/email.

SELECT *
  FROM cwd_user
 WHERE display_name IS NULL
    OR email_address IS NULL

Regards,

eric

Hi Radu,

We dont use LDAP this time, we use the built in Jira authentication. Also all our users where encoded thru Jira UI.

I manually check for emply email and full name in user management and i also run the query below and did not find any empty fullname/email.

SELECT *
  FROM cwd_user
 WHERE display_name IS NULL
    OR email_address IS NULL

Regards,

eric

Hi Eric,

I came across this thread while doing some updates to the knowledge base article - https://confluence.atlassian.com/display/JIRAKB/JIRA+Login+Fails+With+the+Message+-+User+exists+but+has+no+unique+key+mappingbased on the Exception.

I'm not sure if these are related, but if the problem is not yet fixed, could you please execute the diagnostic SQLs and confirm if the root issue is the same?

regards,

Bejoy

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in United States

Topic Tuesday: What's your favorite topic?

Good morning All, Our goal is to get you into the habit of while enjoying your favorite morning drink you are checking the NOVA "space" for topics and comments. Your input is really needed and...

57 views 4 0
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you