Skip to content

Spring Boot 3.2 + Thymeleaf: EL1005E Type cannot be found for valid classes #38574

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

Closed
gboersma opened this issue Nov 27, 2023 · 6 comments
Closed
Labels
for: external-project For an external project and not something we can fix

Comments

@gboersma
Copy link

I have a Spring Boot application that runs as expected with Spring Boot 3.1.6. Upgrading to 3.2.0 now causes Thymeleaf exceptions on any page that uses the "T(" + class name (EL1005E: Type cannot be found).

Any ideas?

This is in my pom.xml:

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>nz.net.ultraq.thymeleaf</groupId>
            <artifactId>thymeleaf-layout-dialect</artifactId>
        </dependency>
        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity6</artifactId>
        </dependency>

On my template, I have the following:

<span th:if="${T(com.icsynergy.icrare2.domain.search.SearchAttribute).isUserUtilMethodAttr(searchResultAttr.field)}" th:utext="${userUtilClass.__${searchAttribute.formatUserUtilMethodAttr(searchResultAttr.field)}__(user,searchModel)}">{{attr}}</span>

I get the error:

org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/search/_user_results.html]")
	at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:241) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parseStandalone(AbstractMarkupTemplateParser.java:100) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:666) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1103) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1077) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.thymeleaf.spring6.view.ThymeleafView.renderFragment(ThymeleafView.java:372) ~[thymeleaf-spring6-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.thymeleaf.spring6.view.ThymeleafView.render(ThymeleafView.java:192) ~[thymeleaf-spring6-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1431) ~[spring-webmvc-6.1.1.jar:6.1.1]
	at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1167) ~[spring-webmvc-6.1.1.jar:6.1.1]
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1106) ~[spring-webmvc-6.1.1.jar:6.1.1]
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979) ~[spring-webmvc-6.1.1.jar:6.1.1]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014) ~[spring-webmvc-6.1.1.jar:6.1.1]
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:914) ~[spring-webmvc-6.1.1.jar:6.1.1]
...
Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "T(com.icsynergy.icrare2.domain.search.SearchAttribute).isUserUtilMethodAttr(searchResultAttr.field)" (template: "search/_user_results" - line 91, col 39)
	at org.thymeleaf.spring6.expression.SPELVariableExpressionEvaluator.evaluate(SPELVariableExpressionEvaluator.java:292) ~[thymeleaf-spring6-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.thymeleaf.standard.expression.VariableExpression.executeVariableExpression(VariableExpression.java:166) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.thymeleaf.standard.expression.SimpleExpression.executeSimple(SimpleExpression.java:66) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
	at org.thymeleaf.standard.expression.Expression.execute(Expression.java:109) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
...
Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1005E: Type cannot be found 'com.icsynergy.icrare2.domain.search.SearchAttribute'
	at org.springframework.expression.spel.support.StandardTypeLocator.findType(StandardTypeLocator.java:128)
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 27, 2023
@bclozel
Copy link
Member

bclozel commented Nov 27, 2023

I think this is probably a duplicate of spring-projects/spring-framework#31668

Can you check with Spring Framework 6.1.2-SNAPSHOT and let us know if it doesn't work out?

@bclozel bclozel added the status: waiting-for-feedback We need additional information before we can continue label Nov 27, 2023
@gboersma
Copy link
Author

Thanks! I tried with Spring Framework 6.1.2-SNAPSHOT and all works as expected.

@gboersma
Copy link
Author

Duplicate of spring-projects/spring-framework#31668

@gboersma gboersma reopened this Nov 27, 2023
@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Nov 27, 2023
@gboersma
Copy link
Author

From my perspective, it's closed because I have a workaround. However, anyone that grabs Spring Boot 3.2 will have the same issue. So perhaps you want to resolve a different way.

Please close as you see fit.

@scottfrederick scottfrederick closed this as not planned Won't fix, can't repro, duplicate, stale Nov 27, 2023
@scottfrederick scottfrederick added status: duplicate A duplicate of another issue for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided status: duplicate A duplicate of another issue labels Nov 27, 2023
@gboersma
Copy link
Author

I also confirmed that this one is fixed in Spring Boot 3.2.1-SNAPSHOT.

@wilkinsona
Copy link
Member

Thanks, @gboersma. Much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix
Projects
None yet
Development

No branches or pull requests

5 participants