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:
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 126.96.36.199</li> <li>Updating the
web.xmlfile 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.xmlfile 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
jsp-api.jar</li> <li>Setting the
CATALINA_HOMEenvironment variable to point to the Tomcat directory</li> </ul>
The IDE being used is NetBeans 7.4 running Apache Tomcat 188.8.131.52 with Java 7. Any help is greatly appreciated.
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:
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