Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
586 views
in Technique[技术] by (71.8m points)

java - Spring migration 4.3 to 5 on tomcat 8.5 el-api error

When upgrading our Spring 4.3 to 5 using Spring boot initializer on tomcat 8.5, we started getting exceptions:

2021-06-06 12:37:50,482 DEBUG [background-preinit] messageinterpolation.ResourceBundleMessageInterpolator (ResourceBundleMessageInterpolator.java:220) - Failed to load expression factory via classloader ParallelWebappClassLoader
  context: ROOT
  delegate: false
----------> Parent Classloader:
java.net.URLClassLoader@76f856a8

javax.el.ELException: Unable to find ExpressionFactory of type [# Licensed to the Apache Software Foundation (ASF) under one or more]
        at javax.el.ExpressionFactory.newInstance(ExpressionFactory.java:154) ~[el-api.jar:3.0.FR]
        at javax.el.ExpressionFactory.newInstance(ExpressionFactory.java:93) ~[el-api.jar:3.0.FR]
        at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.canLoadExpressionFactory(ResourceBundleMessageInterpolator.java:216) [hibernate-validator-6.2.0.Final.jar:6.2.0.Final]
        at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.buildExpressionFactory(ResourceBundleMessageInterpolator.java:170) [hibernate-validator-6.2.0.Final.jar:6.2.0.Final]
        at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.<init>(ResourceBundleMessageInterpolator.java:94) [hibernate-validator-6.2.0.Final.jar:6.2.0.Final]
        at org.hibernate.validator.internal.engine.AbstractConfigurationImpl.getDefaultMessageInterpolator(AbstractConfigurationImpl.java:573) [hibernate-validator-6.2.0.Final.jar:6.2.0.Final]
        at org.hibernate.validator.internal.engine.AbstractConfigurationImpl.getDefaultMessageInterpolatorConfiguredWithClassLoader(AbstractConfigurationImpl.java:822) [hibernate-validator-6.2.0.Final.jar:6.2.0.Final]
        at org.hibernate.validator.internal.engine.AbstractConfigurationImpl.getMessageInterpolator(AbstractConfigurationImpl.java:483) [hibernate-validator-6.2.0.Final.jar:6.2.0.Final]
        at org.hibernate.validator.internal.engine.ValidatorFactoryImpl.<init>(ValidatorFactoryImpl.java:153) [hibernate-validator-6.2.0.Final.jar:6.2.0.Final]
        at org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:38) [hibernate-validator-6.2.0.Final.jar:6.2.0.Final]
        at org.hibernate.validator.internal.engine.AbstractConfigurationImpl.buildValidatorFactory(AbstractConfigurationImpl.java:451) [hibernate-validator-6.2.0.Final.jar:6.2.0.Final]
        at org.springframework.boot.autoconfigure.BackgroundPreinitializer$ValidationInitializer.run(BackgroundPreinitializer.java:149) [spring-boot-autoconfigure-2.5.0.jar:2.5.0]
        at org.springframework.boot.autoconfigure.BackgroundPreinitializer$1.runSafely(BackgroundPreinitializer.java:111) [spring-boot-autoconfigure-2.5.0.jar:2.5.0]
        at org.springframework.boot.autoconfigure.BackgroundPreinitializer$1.run(BackgroundPreinitializer.java:102) [spring-boot-autoconfigure-2.5.0.jar:2.5.0]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_151]
Caused by: java.lang.ClassNotFoundException: # Licensed to the Apache Software Foundation (ASF) under one or more
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1358) ~[catalina.jar:8.5.50]
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180) ~[catalina.jar:8.5.50]
        at javax.el.ExpressionFactory.newInstance(ExpressionFactory.java:147) ~[el-api.jar:3.0.FR]
        ... 14 more

el-api jar is taken from tomcat/lib and we also changed el-api version from 2 to 3 which still throwing the exception

Is there a known solution to this exceptions?

Can it be ignored?

I found related bug that it won't be fixed

EPEL el6 changed to end-of-life (EOL) status on 2020-11-30. EPEL el6 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You stumbled upon bug 64097: the comments in the META-INF/services/javax.el.ExpressionFactory file are not skipped, hence the strange error.

This issue was fixed in Tomcat version 8.5.51 and 9.0.31.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...