Skip to content
This repository was archived by the owner on Apr 5, 2022. It is now read-only.
This repository was archived by the owner on Apr 5, 2022. It is now read-only.

Unable to initialize 'javax.el.ExpressionFactory' after update Spring Boot to 1.5.2 #30

@MichalMichalak

Description

@MichalMichalak

Hello. I am not sure this is the right place to open an issue. If it's not, I'd gladly appreciate if you could share the right person / project.

We are using Spring Boot and Hadoop as shown in Gradle script below.

plugins {
    // before update it was: '1.4.4.RELEASE'
    id 'org.springframework.boot' version '1.5.2.RELEASE'
}
dependencies {
    compile 'org.springframework.data:spring-data-hadoop-boot:2.4.0.RELEASE-cdh5'
}

When trying to get validator, we got following exception.

import javax.validation.Validator;
class Utils {
    Validator v = Validation.buildDefaultValidatorFactory().getValidator();
}
java.lang.ExceptionInInitializerError
	at com.rakuten.felix.listnormalizer.broker.MessageProcessor.handleIncomingMessage(MessageProcessor.java:110)
	at com.rakuten.felix.listnormalizer.test.broker.MessageProcessorTest.handleIncomingMessageTest(MessageProcessorTest.java:115)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:498)
Caused by: javax.validation.ValidationException: HV000183: Unable to initialize 'javax.el.ExpressionFactory'. Check that you have the EL dependencies on the classpath, or use ParameterMessageInterpolator instead
	at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.buildExpressionFactory(ResourceBundleMessageInterpolator.java:102)
	at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.<init>(ResourceBundleMessageInterpolator.java:45)
	at org.hibernate.validator.internal.engine.ConfigurationImpl.getDefaultMessageInterpolator(ConfigurationImpl.java:423)
	at org.hibernate.validator.internal.engine.ConfigurationImpl.getDefaultMessageInterpolatorConfiguredWithClassLoader(ConfigurationImpl.java:575)
	at org.hibernate.validator.internal.engine.ConfigurationImpl.getMessageInterpolator(ConfigurationImpl.java:364)
	at org.hibernate.validator.internal.engine.ValidatorFactoryImpl.<init>(ValidatorFactoryImpl.java:144)
	at org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:38)
	at org.hibernate.validator.internal.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:331)
	at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:110)
	at com.rakuten.felix.listnormalizer.ValidatorUtils.<clinit>(ValidatorUtils.java:11)
	... 4 more
Caused by: javax.el.ELException: Provider com.sun.el.ExpressionFactoryImpl not found
	at javax.el.FactoryFinder.newInstance(FactoryFinder.java:101)
	at javax.el.FactoryFinder.find(FactoryFinder.java:197)
	at javax.el.ExpressionFactory.newInstance(ExpressionFactory.java:189)
	at javax.el.ExpressionFactory.newInstance(ExpressionFactory.java:160)
	at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.buildExpressionFactory(ResourceBundleMessageInterpolator.java:98)
	... 13 more
Caused by: java.lang.ClassNotFoundException: com.sun.el.ExpressionFactoryImpl
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at javax.el.FactoryFinder.newInstance(FactoryFinder.java:87)
	... 17 more

After an investigation we found out that two javax.el.ExpressionFactory classes exist in class path. One from tomcat-embed-el:8.5.11 and other from jsp:jsp-api:2.1. I assumed jsp-api contains old version of ExpressionFactory class and excluded JSP API, which solved the issue.

The question is - shouldn't this be solved in Spring itself? Since I wasn't excluding anything before and it was working fine, I would expect the same behavior after update. Any ideas how to proceed with this? Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions