Tomcat 7 java.lang.NoClassDefFoundError: javax/el/ELManager [duplicate] Tomcat 7 java.lang.NoClassDefFoundError: javax/el/ELManager [duplicate] spring spring

Tomcat 7 java.lang.NoClassDefFoundError: javax/el/ELManager [duplicate]


The issue is caused by the fact that this class javax/el/ELManager is introduced in el-api version 3.0.

Tomcat 7 is coming with pre-bundled el-api 2.2 (which is missing the class) and it's picking that at runtime, instead of your el-api jar.

Tomcat 8 has the el-api 3.0 and hence the javax/el/ELManager class is present.

It's best if you can sync your dev/test/prod environments as close as possible.

It makes much more sense to develop against Tomcat 8 in dev, when your test environment has Tomcat 8. As you found out Tomcat 7 and 8 servers comes with different set of libraries, so your code can behave differently against those different set of libraries.


If you want to run your webapp on Tomcat 7 in production, then you should be using Tomcat 7 in your test environment.

What has happened is that you have accidentally introduced a dependency on the EL 3.0 APIs ... and included it in your POM file. It is working find on Tomcat 8. But on Tomcat 7, the platform supports EL 2.1. So when your app attempts to load the classfile for javax.el.ELManager ... it fails.

Solutions:

  • Upgrade your production platform to Tomcat 8
  • Downgrade your dev and test platforms to Tomcat 7, and eliminate any dependencies on the newer APIs from your codebase .

The Apache Tomcat Versions page lists the various spec versions for each of the major versions of Tomcat.


Is there no possibility to solve this issue?

If you were prepared to "butcher" the Tomcat 7 server, you might be able to replace the EL implementation with a newer one. But I would not try that, because 1) it may not work at all, and 2) the result is liable to be difficult to maintain. And you are liable to give your operations, quality assurance and/or security teams an apoplexy!

Is there no possibility to solve this issue with changes in the application?

AFAIK, there is no possibility.

I thought you could try replacing the EL dependency with this:

<dependency>    <groupId>javax.el</groupId>    <artifactId>javax.el-api</artifactId>    <version>3.0.0</version></dependency>

But it doesn't work. According to a comment from Alex:

"Adding the JAR to the application POM does not solve anything. Here its the message printed out by Tomcat bootstrap: "validateJarFile(C:\Software\apache-tomcat-7.0.99\webapps\leonardo-flows-services\WEB-INF\lib\javax.el-api-3.0.0.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class". It conflicts with its lib jar."