-
Notifications
You must be signed in to change notification settings - Fork 40.6k
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
Native image - HV000183: Unable to initialize 'jakarta.el.ExpressionFactory'. Check that you have the EL dependencies on the classpath, or use ParameterMessageInterpolator instead #33999
Comments
I don't think we need a Spring Boot issue for this in addition to the existing Spring Cloud issue. @OlgaMaciaszek has re-opened the Spring Cloud issue and is investigating. Closing in favour of the Cloud issue for now at least. |
We have a smoke test for validation that covers |
spring-cloud/spring-cloud-gateway#2802 (comment) describes multiple problems and Olga's going to focus on the @Azbesciak As I said above, we believe that validation of configuration properties works in a native image. If you'd like us to investigate why it is not working for you, please provide a minimal sample that reproduces the |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
From boot
Still occurs. |
The Spring Cloud Gateway issue is still open, so I wouldn't expect this situation to have changed. |
spring-cloud/spring-cloud-gateway#2802 was closed on 30th Jan. |
@Azbesciak As far as I can tell, we're still where we were back in January when I made this comment:
You haven't provided the requested sample so no further progress has been made. |
I also encountered the same problem: https://github.com/vicasong/valid-error-demo |
@vicasong, thanks for the sample. Please open a Spring Framework issue for this. During AOT processing, Framework's |
Is there any news? Have you found a solution to the problem? Or at least, do you know where it is? Please share any new information with us. |
I needed to override the whole |
I found two ways to address this issue: Add the The second workaround was to explicitly specify a message interpolator to work along with import jakarta. validation.*;
import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator;
public class MyValidator {
public void validate() {
ValidatorFactory factory = Validation.byDefaultProvider()
.configure()
.messageInterpolator(new ParameterMessageInterpolator())
.buildValidatorFactory();
Validator validator = factory.usingContext()
.getValidator();
Set<ConstraintViolation<Customer>> violations = validator.validate(bean);
}
} The main problem to address in this issue was the message interpolator that has been used since Bean Validation v2.0 . Although Hibernate Validator is the most commonly used validator alongside Bean Validator (ref), the default message interpolator is provided by jakarta-el, which was not adequately loaded, leading to the error when instantiating |
Hello,
After building the native image in spring boot 3.0.2, there are problems with beans annotated with
@Validated
.The following exception is thrown, for instance, for the fresh spring cloud project (initialzr -> spring 3.0.2, graalvm, cloud gateway, security).
It runs without any problem on the normal JVM (even with
spring.aot.enabled=true
what unfortunately does not surprise me, since it did not change anything in none of my tests).I mentioned it also in spring-cloud/spring-cloud-gateway#2802 (comment) .
That exception is also thrown on JVM, but it is swallowed on some step, whereas it is not in the native run - some try catch is missing, maybe connected with
@ConfigurationProperties
processing.Also, I faced another problem when I replaced every bean with that annotation, which is connected with
ValidationAutoConfiguration
BTW does
org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration
should be possible to exclude viaspringautoconfigure.exclude
? It is annotated with@AutoConfiguration
, but it even runs on JVM when excluded there...The text was updated successfully, but these errors were encountered: