"java.lang.IllegalArgumentException: Too many pattern letters: M" return in the logs while loading Jira Issue Macro in Confluence

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Jira Issue Macro inside the Confluence page returns the following ERROR and when any default Jira Date Fields (Created, Updated, Due Date) are included in the Columns to display:

Refresh didn't work. Try again or click an issue to see it in jira.


Diagnosis

The following ERROR appears in the atlassian-confluence.log while accessing the page that contain the Jira Issue Macro:

2022-06-14 08:55:19,829 ERROR [JIM Marshaller:thread-1] [confluence.util.velocity.VelocityUtils] getRenderedTemplate Error occurred rendering template: templates/extra/jira/staticJiraIssues.vm
 -- url: /display/SPACEKEY/Test | page: 123456789 | traceId: 9adcf2dd88c043db | userName: xxxxx | referer: <CONFLUENCE_BASE_URL>/pages/createpage.action?spaceKey=SPACEKEY&fromPageId=123456789 | action: viewpage
org.apache.velocity.exception.MethodInvocationException: Invocation of method 'valueForFieldDateFormatted' in  class com.atlassian.confluence.extra.jira.columns.JiraIssuesXmlTransformer threw exception java.lang.IllegalArgumentException: Too many pattern letters: M at templates/extra/jira/staticJiraIssues.vm[line 291, column 78]
	at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:342)
	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:284)
	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:262)
	at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:507)
	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:155)
	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:262)
	at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:342)
	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
	at org.apache.velocity.runtime.parser.node.ASTElseIfStatement.render(ASTElseIfStatement.java:92)
	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106)
	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
	at org.apache.velocity.runtime.directive.Foreach.performIteration(Foreach.java:393)
	at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:316)
	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
	at org.apache.velocity.runtime.directive.Foreach.performIteration(Foreach.java:393)
	at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:316)
	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
	at org.apache.velocity.Template.merge(Template.java:328)
	at org.apache.velocity.Template.merge(Template.java:235)
	at com.atlassian.confluence.util.velocity.VelocityUtils.renderTemplateWithoutSwallowingErrors(VelocityUtils.java:70)
	at com.atlassian.confluence.util.velocity.VelocityUtils.renderTemplateWithoutSwallowingErrors(VelocityUtils.java:76)
	at com.atlassian.confluence.util.velocity.VelocityUtils.getRenderedTemplateWithoutSwallowingErrors(VelocityUtils.java:63)
	at com.atlassian.confluence.util.velocity.VelocityUtils.getRenderedTemplate(VelocityUtils.java:42)
	at com.atlassian.confluence.util.velocity.VelocityUtils.getRenderedTemplate(VelocityUtils.java:33)
	at com.atlassian.confluence.extra.jira.JiraIssuesMacro.renderStaticTemplate(JiraIssuesMacro.java:550)
	at com.atlassian.confluence.extra.jira.JiraIssuesMacro.getRenderedTemplate(JiraIssuesMacro.java:537)
	at com.atlassian.confluence.extra.jira.JiraIssuesMacro.execute(JiraIssuesMacro.java:1175)
	at com.atlassian.confluence.extra.jira.executor.StreamableMacroFutureTask.renderValue(StreamableMacroFutureTask.java:74)
	at com.atlassian.confluence.extra.jira.services.DefaultAsyncJiraIssueBatchService.lambda$processRequestWithJql$2(DefaultAsyncJiraIssueBatchService.java:184)
	at com.atlassian.sal.core.executor.ThreadLocalDelegateCallable.call(ThreadLocalDelegateCallable.java:38)
	at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContextInternal(VCacheRequestContextManager.java:84)
	at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:68)
	at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$withRequestContext$1(VCacheRequestContextOperations.java:59)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalArgumentException: Too many pattern letters: M
	at java.base/java.time.format.DateTimeFormatterBuilder.parseField(DateTimeFormatterBuilder.java:1909)
	at java.base/java.time.format.DateTimeFormatterBuilder.parsePattern(DateTimeFormatterBuilder.java:1740)
	at java.base/java.time.format.DateTimeFormatterBuilder.appendPattern(DateTimeFormatterBuilder.java:1708)
	at java.base/java.time.format.DateTimeFormatter.ofPattern(DateTimeFormatter.java:588)
	at com.atlassian.confluence.extra.jira.columns.JiraIssuesXmlTransformer.parseDateWithUserLocale(JiraIssuesXmlTransformer.java:143)
	at com.atlassian.confluence.extra.jira.columns.JiraIssuesXmlTransformer.valueForFieldDateFormatted(JiraIssuesXmlTransformer.java:131)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Enabling DEBUG for the org.apache.http in Confluence shows a HTTP 200 OK response from Jira:

2022-09-06 10:18:16,836 DEBUG [JIM Marshaller:thread-20] [org.apache.http.headers] onRequestSubmitted http-outgoing-41471 >> GET /sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?tempMax=20&returnMax=true&jqlQuery=resolutiondate+%3E%3D+-365d+order+by+updated+DESC+++++++&field=summary&field=issuetype&field=issuekey&field=created&field=reporter&field=assignee&field=priority&field=resolution&field=status&field=link&field=type HTTP/1.1
...
2022-09-06 10:18:17,087 DEBUG [JIM Marshaller:thread-20] [org.apache.http.wire] wire http-outgoing-41471 << "HTTP/1.1 200 OK[\r][\n]"
2022-09-06 10:18:17,090 DEBUG [JIM Marshaller:thread-20] [org.apache.http.wire] wire http-outgoing-41471 << "X-Arequestid: 618x8504x2[\r][\n]"
2022-09-06 10:18:17,090 DEBUG [JIM Marshaller:thread-20] [org.apache.http.wire] wire http-outgoing-41471 << "X-Ausername: xxxxx[\r][\n]"

The DEBUG traces from atlassian-jira-http-dump.log shows that Jira responded with the data that contains the correct Date Format:

172.17.1.7 o618x8504x2 xxxxx [06/Sep/2022:10:18:17 +0200] "GET <JIRA_BASE_URL>/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml HTTP/1.1" 200 27702 0.1670 - "Apache-HttpClient/4.5.13 (Java/11.0.16)" "4777tn"
    	___ Request _____________________________________________________
    	Request URL Parameters : 
    		tempMax=20
    		returnMax=true
    		jqlQuery=resolutiondate >= -365d order by updated DESC       
    		field=summary
    		field=issuetype
    		field=issuekey
    		field=created
    		field=reporter
    		field=assignee
    		field=priority
    		field=resolution
    		field=status
    		field=link
    		field=type
...
<item>
...
<created>Fri, 22 Apr 2022 12:26:39 +0200</created> 
</item>


Cause

The "java.lang.IllegalArgumentException: Too many pattern letters: M" is referring to the letter M in the date formatting (default: MMM dd, yyyy) inside the Confluence General Configuration. In this case, there are additional M in the Date Time Format and Date Format in Confluence General Configuration > Formatting and International Settings :

Solution

Navigate to the Confluence General Configuration > Formatting and International Settings and set the Date Time Format and Date Format to the default MMM dd, yyyy:




Last modified on Sep 7, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.