-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
thymeleaf-spring5 ClassNotFoundException ognl/PropertyProcessor #203
Comments
OGNL is excluded when Thymeleaf is in a Spring project (when including the If you've got a Spring Boot project, then this should be taken care of automatically if you import the right starter modules and so no use of OGNL will come up and no ClassNotFoundException should be thrown. If you're using Spring Framework and manually configuring your app to use Thymeleaf, then the setup/configuration is a bit more involved but is described in the Thymeleaf + Spring Tutorial doc which you can find here: https://www.thymeleaf.org/doc/tutorials/3.0/thymeleafspring.html#the-springstandard-dialect |
Im using the following package for the project:
It's the only reference to thymeleaf I have in my pom.xml |
I had the same issue as you, and adding this solve the problem for me:
|
Hello there, In my case I am using it in a junit test:
The trick of @mermetbt worked for me...
But now I am facing the issue (yet another :) of spring not taking into account the configuration from src/test/resources/application.properties for thymeleaf :( Thanks, Luis |
After lot of experimentation, following line makes the issue OGNL issue disappear for both Spring and Spring boot: Further, for spring boot to work properly, I had to configure engine as below: As my use case is about simple string replacement in text templates, following is template resolver configuration: |
I can confirm that replacing |
* Downgrading OGNL due to thymeleaf/thymeleaf-spring#203. * Removing extra commented lines.
* Downgrading OGNL due to thymeleaf/thymeleaf-spring#203 (#1041) * Downgrading OGNL due to thymeleaf/thymeleaf-spring#203. * Removing extra commented lines. * Allow zip exclude via config as code (#1044) * Allow the zip-exclude property to be set via config-as-code * Update config-as-code documentation * Fixed closing and reopening of issues for all bug trackers (#1045) * Fixed closing and reopening of issues for all bug trackers * Updated test case data Co-authored-by: Leonel Sanches <[email protected]> Co-authored-by: James Bostock <[email protected]> Co-authored-by: HussainS12 <[email protected]>
* CXFLW-400 Adding changes for break build. * CXFLW-383 Removed name from comments * Test case FIX for CMD line argument. * Merging Development changes in my branch (#1047) * Downgrading OGNL due to thymeleaf/thymeleaf-spring#203 (#1041) * Downgrading OGNL due to thymeleaf/thymeleaf-spring#203. * Removing extra commented lines. * Allow zip exclude via config as code (#1044) * Allow the zip-exclude property to be set via config-as-code * Update config-as-code documentation * Fixed closing and reopening of issues for all bug trackers (#1045) * Fixed closing and reopening of issues for all bug trackers * Updated test case data Co-authored-by: Leonel Sanches <[email protected]> Co-authored-by: James Bostock <[email protected]> Co-authored-by: HussainS12 <[email protected]> Co-authored-by: Satyam Chaurasia <[email protected]> Co-authored-by: Leonel Sanches <[email protected]> Co-authored-by: James Bostock <[email protected]> Co-authored-by: HussainS12 <[email protected]>
* Downgrading OGNL due to thymeleaf/thymeleaf-spring#203.
Hello Everyone, |
Some how in 2024 I am still facing this issue. For anyone that need deep inside, this issue happen because spring automatically use Default Template engine instead of SpringTemplateEngine, this will lead to the need of ognl. @tcuje solution tell Spring that it have to use SpringTemplateEngine instead of TemplateEngine. Btw, for anyone wonder what is templateResolver(). Below code may help you a little bit.
|
I tried to use thymeleaf in my project, but get the following exception:
java.lang.NoClassDefFoundError: ognl/PropertyAccessor
My versions copied from
mvn dependency:tree
I think the issue here is that ognl is excluded by thymeleaf-spring5/pom.xml, see https://github.com/thymeleaf/thymeleaf-spring/blob/3.0-master/thymeleaf-spring5/pom.xml#L318
Unfortunately the relevant commits do not state why it was excluded, see b6a4911 and 896a147
The text was updated successfully, but these errors were encountered: