java.lang.ClassNotFoundException: javax.el.StaticFieldELResolver

半世苍凉 提交于 2019-12-24 17:12:20

问题


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 this one, but their solutions did not work for me. I've tried the following unsuccessfully:

  • Removing all other library references other than JDK 1.7 and Apache Tomcat 7.0.41.0
  • Updating the web.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">
  • 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">
  • Verifying that the Tomcat library includes el-api.jar and jsp-api.jar
  • Setting the CATALINA_HOME environment variable to point to the Tomcat directory

The IDE being used is NetBeans 7.4 running Apache Tomcat 7.0.41.0 with Java 7. Any help is greatly appreciated.

UPDATE:

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.


回答1:


The class javax.el.StaticFieldELResolver is part of the EL 3.0 API. AFAIK it is not available in Tomcat 7 versions. It is available in Tomcat 8, but that is not in General Availability yet, so use it as your own risks.

You must have changed something.




回答2:


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



来源:https://stackoverflow.com/questions/19746046/java-lang-classnotfoundexception-javax-el-staticfieldelresolver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!