Hello.
When running the web server with Gretty.. When accessing the layout page, the following exception is exposed and nothing appears on the web browser screen.
-
Exception Log
Caused by: java.lang.ClassCastException: class nz.net.ultraq.thymeleaf.layoutdialect.models.extensions.EventIterator cannot be cast to class [Ljava.lang.Object; (nz.net.ultraq.thymeleaf.layoutdialect.models.extensions.EventIterator is in unnamed module of loader java.net.URLClassLoader @889d9e8; [Ljava.lang.Object; is in module java.base of loader 'bootstrap')
at org.codehaus.groovy.runtime.dgm$236.doMethodInvoke(Unknown Source) ~[groovy-4.0.10.jar:4.0.10]
at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321) ~[groovy-4.0.10.jar:4.0.10]
at nz.net.ultraq.thymeleaf.layoutdialect.models.extensions.IModelExtensions.find(IModelExtensions.groovy:117) ~[thymeleaf-layout-dialect-3.2.1.jar:?]
...
My project environment looks like this
- Spring 6 (Not Spring Boot )
- Thymeleaf
- thymeleaf-spring6:
3.1.1.RELEASE
- thymeleaf-layout-dialect:
3.2.1
- Gretty
4.0.3
When I run the web project, I run it with the command below.
When I ran Gretty and accessed the page with the layout applied, I definitely saw the aforementioned exception.
However, there are two things that are unusual.
✨ Two unusual things
-
If I'm using a direct deployment of Tomcat without using Gretty, I don't get the exception.
-
If I use https://github.com/zhanhb/thymeleaf-layout-dialect, there's no problem running a web project with Gretty.
// TODO: Using gretty with thymeleaf-layout-dialect causes an exception
implementation "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:${thymeleafLayoutVersion}"
// TODO: If I use the thymeleaf-layout-dialect modified by zhanhb, the exception does not occur.
// implementation "com.github.zhanhb:thymeleaf-layout-dialect:${zhanhbThymeleafLayoutVersion}"
✨ Example project to see the problem
I've created an example project for you to see the issue.
Thank you. Have a nice day. 👍
Hello.
When running the web server with Gretty.. When accessing the layout page, the following exception is exposed and nothing appears on the web browser screen.
Exception Log
My project environment looks like this
3.1.1.RELEASE3.2.14.0.310.1.10When I run the web project, I run it with the command below.
When I ran Gretty and accessed the page with the layout applied, I definitely saw the aforementioned exception.
However, there are two things that are unusual.
✨ Two unusual things
If I'm using a direct deployment of Tomcat without using Gretty, I don't get the exception.
If I use
https://github.com/zhanhb/thymeleaf-layout-dialect, there's no problem running a web project with Gretty.✨ Example project to see the problem
I've created an example project for you to see the issue.
Example project github url
Example project Zip File
How to run
Run with Gretty
Accessing the layout page in a web browser
http://localhost:8090/mainThank you. Have a nice day. 👍