
Question:
I am attempting to run a project with a servlet that was working a few weeks ago (no modifications have been made since). However, when I run it I now get the following error:
java.lang.ClassNotFoundException: javax.el.StaticFieldELResolver
I've seen similar questions out there such as <a href="https://stackoverflow.com/questions/6360121/java-lang-noclassdeffounderror-javax-el-elresolver-when-running-simplehellobyen" rel="nofollow">this one</a>, but their solutions did not work for me. I've tried the following unsuccessfully:
<ul><li>Removing all other library references other than JDK 1.7 and Apache Tomcat 7.0.41.0</li> <li>Updating theweb.xml
file from 2.5 to 3.0: <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
</li>
<li>Updating the sun-web.xml
file from 2.5 to 3.0: <!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
</li>
<li>Verifying that the Tomcat library includes el-api.jar
and jsp-api.jar
</li>
<li>Setting the CATALINA_HOME
environment variable to point to the Tomcat directory</li>
</ul>The IDE being used is NetBeans 7.4 running Apache Tomcat 7.0.41.0 with Java 7. Any help is greatly appreciated.
<strong>UPDATE:</strong>
Oddly, if I choose to run it with GlassFish instead of Tomcat it runs without error. So there must be some relationship to the Tomcat server.
Answer1:The class javax.el.StaticFieldELResolver
is part of the <a href="http://docs.oracle.com/javaee/7/api/javax/el/StaticFieldELResolver.html" rel="nofollow">EL 3.0 API.</a> AFAIK it is not available in Tomcat 7 versions. <a href="http://tomcat.apache.org/download-80.cgi" rel="nofollow">It is available in Tomcat 8</a>, but that is not in General Availability yet, so use it as your own risks.
You must have changed something.
Answer2:Solution 1: Inner of the apache-tomcat-x.x.xx\lib folder el-api.jar file set classpath environment variable.
Solution 2: copy apache-tomcat-x.x.xx\lib\el-api.jar file in to jreX.X.X_XXX\lib\ext\ folder.
because it is used to preload tomcat server start