0

We are using thymeleaf as a template engine with java 8. thymeleaf version is 3.0.0.BETA02. While processing the template sometimes we get below error and after restart it is working fine for same template.

26-01-2021 16:41:23.553 [http-nio-8085-exec-10] ERROR org.thymeleaf.TemplateEngine.process - [THYMELEAF][http-nio-8085-exec-10] Exception processing template "/ukfile.file.core.windows.net/fileshare/[...]32342/RES_PRINT_VIEW.html": Error during execution of processor 'org.thymeleaf.standard.processor.StandardConditionalCommentProcessor' (template: "/ukfile.file.core.windows.net/fileshare/[...]32342/RES_PRINT_VIEW.html" - line 9, col 2)
org.thymeleaf.exceptions.TemplateProcessingException: Error during execution of processor 'org.thymeleaf.standard.processor.StandardConditionalCommentProcessor' (template: "/ukfile.file.core.windows.net/fileshare/[...]32342/RES_PRINT_VIEW.html" - line 9, col 2)
    at org.thymeleaf.processor.comment.AbstractCommentProcessor.process(AbstractCommentProcessor.java:69)
    at org.thymeleaf.util.ProcessorConfigurationUtils$CommentProcessorWrapper.process(ProcessorConfigurationUtils.java:658)
    at org.thymeleaf.engine.ProcessorTemplateHandler.handleComment(ProcessorTemplateHandler.java:813)
    at org.thymeleaf.engine.EngineEventQueue.process(EngineEventQueue.java:330)
    at org.thymeleaf.engine.Model.process(Model.java:180)
    at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:602)
    at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1089)
    at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1052)
    at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1041)
    at com.demo.html.engine.ThymeleafTemplateEngine.process(ThymeleafTemplateEngine.java:79)
    at com.demo.html.builder.TemplateBuilder.processTemplate(TemplateBuilder.java:187)
    at com.demo.html.builder.TemplateBuilder.getHtmlContent(TemplateBuilder.java:127)
    at com.demo.html.controller.HTMLFormService.getXHTML(HTMLFormService.java:45)
    at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ArrayIndexOutOfBoundsException: null
    at org.thymeleaf.text.LimitedSizeCacheTextRepository.removeOldest(LimitedSizeCacheTextRepository.java:790)
    at org.thymeleaf.text.LimitedSizeCacheTextRepository.storeText(LimitedSizeCacheTextRepository.java:679)
    at org.thymeleaf.text.LimitedSizeCacheTextRepository.getText(LimitedSizeCacheTextRepository.java:337)
    at org.thymeleaf.engine.Comment.getComment(Comment.java:98)
    at org.thymeleaf.engine.Comment.charAt(Comment.java:151)
    at org.thymeleaf.standard.util.StandardConditionalCommentUtils.parseConditionalComment(StandardConditionalCommentUtils.java:65)
    at org.thymeleaf.standard.processor.StandardConditionalCommentProcessor.doProcess(StandardConditionalCommentProcessor.java:60)
    at org.thymeleaf.processor.comment.AbstractCommentProcessor.process(AbstractCommentProcessor.java:54)
    ... 65 common frames omitted

Here is RES_PRINT_VIEW.html I want to know that why this error is coming? Even I am not able to find any resource for similar error. any suggestions for things to look at or try to avoid above Error.

  • 1
    For `RES_PRINT_VIEW.html" - line 9, col 2` - what is on that line? What is the surrounding context (the relevant HTML from that file)? What data is being manipulated by Thymeleaf, here? Can you [edit] your question? – andrewJames Jan 27 '21 at 13:36
  • Also, take a look at: [What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it?](https://stackoverflow.com/questions/5554734/what-causes-a-java-lang-arrayindexoutofboundsexception-and-how-do-i-prevent-it/5554811#5554811). – andrewJames Jan 27 '21 at 13:42
  • @andrewjames I have HTML file RES_PRINT_VIEW.html which I have updated here. Sorry I do not have data because issue came in our production environment and our logs are not in debug mode. I will provide you data when issue will replicate again. – vishal patel Jan 28 '21 at 06:16
  • Please do not provide screenshots of text. Please provide the actual text (formatted) in the question. A screenshot of text cannot be searched or tested. Which line is "line 9"? Do we need the entire file? Can you provide only the relevant parts, in a [mre]? – andrewJames Jan 28 '21 at 13:59
  • @andrewjames There is no screenshots. HTML file is uploaded. You can download that file on that link. Sorry I do not have reproducible scenario because it is replicating sometimes. – vishal patel Jan 29 '21 at 12:53
  • I see - it's a link to a document, not to a screenshot. My mistake. Please do not provide a link to your code, like this. Please show the relevant parts of your code in the question itself, as formatted text. It will be difficult to help you, without a reproducible scenario. Can you at least tell us what "line 9" is? – andrewJames Jan 29 '21 at 13:12

0 Answers0