NoClassDefFoundError: javax/el/ELManager
Caused by: java.lang.NoClassDefFoundError: javax/el/ELManager
at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.buildExpressionFactory(ResourceBundleMessageInterpolator.java:171)
at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.(ResourceBundleMessageInterpolator.java:94)
at org.hibernate.validator.internal.engine.AbstractConfigurationImpl.getDefaultMessageInterpolator(AbstractConfigurationImpl.java:570)
at org.hibernate.validator.internal.engine.AbstractConfigurationImpl.getDefaultMessageInterpolatorConfiguredWithClassLoader(AbstractConfigurationImpl.java:790)
at org.hibernate.validator.internal.engine.AbstractConfigurationImpl.getMessageInterpolator(AbstractConfigurationImpl.java:480)
at org.hibernate.validator.internal.engine.ValidatorFactoryImpl.(ValidatorFactoryImpl.java:151)
at org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:38)
at org.hibernate.validator.internal.engine.AbstractConfigurationImpl.buildValidatorFactory(AbstractConfigurationImpl.java:448)
tomcat部署项目时,启动失败。日志显示找不到对应的类。这是因为你项目引用了高版本的javax/el/ELManager
类,并且你使用的tomcat是低版本,例如你tomcat是7.x。
查看tomcat官网文档 https://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html
不难发现 ELManager
位于 el-api.jar
,并且tomcat7的版本是el-api.jar — EL 2.2 API
2.2
解决方案:
去高版本tomcat复制一个el-api.jar
过来替换tomcat/lib/el-api.jar
出现以上原因一般是因为开发用高版本tomcat、实际部署用低版本tomcat导致!